-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kubectl example #175
base: main
Are you sure you want to change the base?
Add kubectl example #175
Conversation
@@ -0,0 +1,42 @@ | |||
tools: sys.write, kubectl, helm, browser | |||
|
|||
Do not make parallel function calls. Only call one function at a time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and line 5 should no longer be needed as we baked this into the system prompt of gptscript (see: https://github.com/gptscript-ai/gptscript/pull/161/files)
I'll merge this as-is, but I'm curious if you see unexpected behavior without these two lines.
9. Open a browser on vote.LBIP.nip.io but make sur to replace the LBIP placeholder with the content of lb-ip.txt in this URL first | ||
|
||
--- | ||
name: kubectl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember if we discussed this, but this is technically a "safer" way to implement:
name: kubectl
description: use kubectl command to manage k8s resources
args: arguments: the arguments for the kubectl command
!#/bin/bash
kubectl ${arguments}
Can you do it this way or was there a particular reason you didn't? I can't recall the details of the convos we had around this.
@cjellick I've updated the kubectl and helm tool so it uses the safer way but it does not work (none of the resources are created). I cannot have this tool working:
While this one is working:
Any ideas what I'm missing here ? Also, if I do not use this instructions:
The order of the instructions does not seem to be respected. I'm using gptscript version v0.4.1+d9f1c0d0, are the changes already in that one ? |
@cjellick I've tested with v0.4.2+40746442 but I get the same issue. This script:
produces the following output:
but no kubectl nor helm function have been called in the process. |
Might it make more sense to create the cluster, like what happens here? https://www.youtube.com/watch?v=rEQh8aEGo5o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat random question - how does it know how to use kubectl or helm? I don't see a knowledge retrieval step.
--- | ||
name: browser | ||
tools: sys.exec | ||
args: url: the url to open | ||
description: open a browser window | ||
|
||
You are only in charge of opening a browser window on the requested url | ||
You can only use the sys.exec tool to open a browser window |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not use our browser tool for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, I need to open a window so show the application. Can the browser tool open a window ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! That's what it is designed to do.
examples/kubectl.gpt
Outdated
6. Wait for the IP address of the traefik Service to be available and save it in the file ./lb-ip.txt | ||
7. Create the file ./ingress.yaml and make sure it contains the yaml specification of an Ingress resource which exposes the vote-ui Service on vote.LBIP.nip.io and the result-ui Service on result.LBIP.nip.io, first making sure to replace the LBIP placeholders with the content of the file ./lb-ip.txt | ||
8. Create the Ingress resource specified in ./ingress.yaml | ||
9. Open a browser on vote.LBIP.nip.io but make sur to replace the LBIP placeholder with the content of lb-ip.txt in this URL first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
9. Open a browser on vote.LBIP.nip.io but make sur to replace the LBIP placeholder with the content of lb-ip.txt in this URL first | |
9. Open a browser on vote.LBIP.nip.io but make sure to replace the LBIP placeholder with the content of lb-ip.txt in this URL first |
examples/regular-tasks/README.md
Outdated
|
||
- Create a DigitalOcean PAT token and export it in the DIGITALOCEAN_ACCESS_TOKEN environment variable | ||
|
||
- Create a new ssh key on your local machin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
- Create a new ssh key on your local machin | |
- Create a new SSH key on your local machine |
examples/regular-tasks/README.md
Outdated
ssh-keygen -f /tmp/do_gptscript | ||
``` | ||
|
||
- Define a new ssh key in DigitalOcean using the public part of the ssh key created above and call it *gptscript* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
- Define a new ssh key in DigitalOcean using the public part of the ssh key created above and call it *gptscript* | |
- Define a new SSH key in DigitalOcean using the public part of the SSH key created above and call it `gptscript` |
examples/regular-tasks/README.md
Outdated
|
||
![webhooks](./picts/webhooks-2.png) | ||
|
||
- Once you'r done do not forget to remove the DigitalOcean VM created in the process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
- Once you'r done do not forget to remove the DigitalOcean VM created in the process | |
- Once you're done, do not forget to remove the DigitalOcean VM created in the process |
|
||
Create a task which verifies every minute if the website ${url} is reachable and sends the status code to the following HTTP POST request: | ||
- URL is https://webhooks.app/data | ||
- Authorization bearer is ${token} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is just an example, but it is bad practice to hand credentials to the LLM, so I think this should be changed a bit. Tokens should only be handled by pure code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right. I'll change that to make sure the token is retrieved beforehand and is not provided to the LLM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified the script to that the token is not sent to the LLM
@g-linville @tylerslaton I've addressed your comment. |
Could you try and use the browser tool here? I think it'd be a good use case for it. |
No description provided.