gpt
No long description provided.
Installation
dagger install github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346Entrypoint
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| token | Secret ! | - | OpenAI API token |
| model | String | "gpt-4o" | OpenAI model |
| knowledgeDir | Directory | - | A builtin knowledge library, made of text files. First paragraph is the description. The rest is the contents. |
| systemPrompt | File | - | A system prompt to inject into the GPT context |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRETfunc (m *MyModule) Example(token *dagger.Secret) *dagger.Gpt {
return dag.
Gpt(token)
}@function
def example(token: dagger.Secret, ) -> dagger.Gpt:
return (
dag.gpt(token)
)@func()
example(token: Secret, ): Gpt {
return dag
.gpt(token)
}Types
Gpt 🔗
sandbox() 🔗
Return Type
Sandbox ! Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET sandboxfunc (m *MyModule) Example(token *dagger.Secret) *dagger.GptSandbox {
return dag.
Gpt(token).
Sandbox()
}@function
def example(token: dagger.Secret, ) -> dagger.GptSandbox:
return (
dag.gpt(token)
.sandbox()
)@func()
example(token: Secret, ): GptSandbox {
return dag
.gpt(token)
.sandbox()
}withSandbox() 🔗
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| sandbox | Sandbox ! | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(token *dagger.Secret, sandbox *dagger.GptSandbox) *dagger.Gpt {
return dag.
Gpt(token).
WithSandbox(sandbox)
}@function
def example(token: dagger.Secret, sandbox: dagger.GptSandbox) -> dagger.Gpt:
return (
dag.gpt(token)
.with_sandbox(sandbox)
)@func()
example(token: Secret, sandbox: GptSandbox): Gpt {
return dag
.gpt(token)
.withSandbox(sandbox)
}withSecret() 🔗
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
| value | Secret ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET with-secret --name string --value env:MYSECRETfunc (m *MyModule) Example(token *dagger.Secret, name string, value *dagger.Secret) *dagger.Gpt {
return dag.
Gpt(token).
WithSecret(name, value)
}@function
def example(token: dagger.Secret, name: str, value: dagger.Secret) -> dagger.Gpt:
return (
dag.gpt(token)
.with_secret(name, value)
)@func()
example(token: Secret, name: string, value: Secret): Gpt {
return dag
.gpt(token)
.withSecret(name, value)
}withDirectory() 🔗
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dir | Directory ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET with-directory --dir DIR_PATHfunc (m *MyModule) Example(token *dagger.Secret, dir *dagger.Directory) *dagger.Gpt {
return dag.
Gpt(token).
WithDirectory(dir)
}@function
def example(token: dagger.Secret, dir: dagger.Directory) -> dagger.Gpt:
return (
dag.gpt(token)
.with_directory(dir)
)@func()
example(token: Secret, dir: Directory): Gpt {
return dag
.gpt(token)
.withDirectory(dir)
}withRemoteModule() 🔗
Configure a remote module as context for the sandbox
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| address | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET with-remote-module --address stringfunc (m *MyModule) Example(token *dagger.Secret, address string) *dagger.Gpt {
return dag.
Gpt(token).
WithRemoteModule(address)
}@function
def example(token: dagger.Secret, address: str) -> dagger.Gpt:
return (
dag.gpt(token)
.with_remote_module(address)
)@func()
example(token: Secret, address: string): Gpt {
return dag
.gpt(token)
.withRemoteModule(address)
}withLocalModule() 🔗
Configure a local module as context for the sandbox
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| module | Directory ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET with-local-module --module DIR_PATHfunc (m *MyModule) Example(token *dagger.Secret, module *dagger.Directory) *dagger.Gpt {
return dag.
Gpt(token).
WithLocalModule(module)
}@function
def example(token: dagger.Secret, module: dagger.Directory) -> dagger.Gpt:
return (
dag.gpt(token)
.with_local_module(module)
)@func()
example(token: Secret, module: Directory): Gpt {
return dag
.gpt(token)
.withLocalModule(module)
}history() 🔗
Return Type
[String ! ] ! Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET historyfunc (m *MyModule) Example(ctx context.Context, token *dagger.Secret) []string {
return dag.
Gpt(token).
History(ctx)
}@function
async def example(token: dagger.Secret, ) -> List[str]:
return await (
dag.gpt(token)
.history()
)@func()
async example(token: Secret, ): Promise<string[]> {
return dag
.gpt(token)
.history()
}withToolOutput() 🔗
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| callId | String ! | - | No description provided |
| content | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET with-tool-output --call-id string --content stringfunc (m *MyModule) Example(token *dagger.Secret, callId string, content string) *dagger.Gpt {
return dag.
Gpt(token).
WithToolOutput(callId, content)
}@function
def example(token: dagger.Secret, call_id: str, content: str) -> dagger.Gpt:
return (
dag.gpt(token)
.with_tool_output(call_id, content)
)@func()
example(token: Secret, callId: string, content: string): Gpt {
return dag
.gpt(token)
.withToolOutput(callId, content)
}withPrompt() 🔗
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| prompt | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET with-prompt --prompt stringfunc (m *MyModule) Example(token *dagger.Secret, prompt string) *dagger.Gpt {
return dag.
Gpt(token).
WithPrompt(prompt)
}@function
def example(token: dagger.Secret, prompt: str) -> dagger.Gpt:
return (
dag.gpt(token)
.with_prompt(prompt)
)@func()
example(token: Secret, prompt: string): Gpt {
return dag
.gpt(token)
.withPrompt(prompt)
}withSystemPrompt() 🔗
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| prompt | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET with-system-prompt --prompt stringfunc (m *MyModule) Example(token *dagger.Secret, prompt string) *dagger.Gpt {
return dag.
Gpt(token).
WithSystemPrompt(prompt)
}@function
def example(token: dagger.Secret, prompt: str) -> dagger.Gpt:
return (
dag.gpt(token)
.with_system_prompt(prompt)
)@func()
example(token: Secret, prompt: string): Gpt {
return dag
.gpt(token)
.withSystemPrompt(prompt)
}ask() 🔗
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| prompt | String ! | - | The message to send the model |
Example
dagger -m github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346 call \
--token env:MYSECRET ask --prompt stringfunc (m *MyModule) Example(token *dagger.Secret, prompt string) *dagger.Gpt {
return dag.
Gpt(token).
Ask(prompt)
}@function
def example(token: dagger.Secret, prompt: str) -> dagger.Gpt:
return (
dag.gpt(token)
.ask(prompt)
)@func()
example(token: Secret, prompt: string): Gpt {
return dag
.gpt(token)
.ask(prompt)
}Sandbox 🔗
home() 🔗
The sandbox’s home directory
Return Type
Directory ! Example
Function GptSandbox.home is not accessible from the gpt moduleFunction GptSandbox.home is not accessible from the gpt moduleFunction GptSandbox.home is not accessible from the gpt moduleFunction GptSandbox.home is not accessible from the gpt modulebase() 🔗
Base image for the sandbox host computer
Return Type
Container ! Example
Function GptSandbox.base is not accessible from the gpt moduleFunction GptSandbox.base is not accessible from the gpt moduleFunction GptSandbox.base is not accessible from the gpt moduleFunction GptSandbox.base is not accessible from the gpt moduleruns() 🔗
Runs of script execution
Return Type
[Run ! ] ! Example
Function GptSandbox.runs is not accessible from the gpt moduleFunction GptSandbox.runs is not accessible from the gpt moduleFunction GptSandbox.runs is not accessible from the gpt moduleFunction GptSandbox.runs is not accessible from the gpt modulemanuals() 🔗
Instruction manuals for the user of the sandbox
Return Type
[Manual ! ] ! Example
Function GptSandbox.manuals is not accessible from the gpt moduleFunction GptSandbox.manuals is not accessible from the gpt moduleFunction GptSandbox.manuals is not accessible from the gpt moduleFunction GptSandbox.manuals is not accessible from the gpt modulehistory() 🔗
Return Type
[String ! ] ! Example
Function GptSandbox.history is not accessible from the gpt moduleFunction GptSandbox.history is not accessible from the gpt moduleFunction GptSandbox.history is not accessible from the gpt moduleFunction GptSandbox.history is not accessible from the gpt modulehost() 🔗
The host container for the sandbox
Return Type
Container ! Example
Function GptSandbox.host is not accessible from the gpt moduleFunction GptSandbox.host is not accessible from the gpt moduleFunction GptSandbox.host is not accessible from the gpt moduleFunction GptSandbox.host is not accessible from the gpt modulewithRemoteModule() 🔗
Configure a remote module as context for the sandbox
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| address | String ! | - | No description provided |
Example
Function GptSandbox.withRemoteModule is not accessible from the gpt moduleFunction GptSandbox.withRemoteModule is not accessible from the gpt moduleFunction GptSandbox.withRemoteModule is not accessible from the gpt moduleFunction GptSandbox.withRemoteModule is not accessible from the gpt modulewithLocalModule() 🔗
Configure a local module as context for the sandbox
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| module | Directory ! | - | No description provided |
Example
Function GptSandbox.withLocalModule is not accessible from the gpt moduleFunction GptSandbox.withLocalModule is not accessible from the gpt moduleFunction GptSandbox.withLocalModule is not accessible from the gpt moduleFunction GptSandbox.withLocalModule is not accessible from the gpt modulechanges() 🔗
All filesystem changes made to the host sandbox so far
Return Type
Directory ! Example
Function GptSandbox.changes is not accessible from the gpt moduleFunction GptSandbox.changes is not accessible from the gpt moduleFunction GptSandbox.changes is not accessible from the gpt moduleFunction GptSandbox.changes is not accessible from the gpt modulewithUsername() 🔗
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| username | String ! | - | No description provided |
Example
Function GptSandbox.withUsername is not accessible from the gpt moduleFunction GptSandbox.withUsername is not accessible from the gpt moduleFunction GptSandbox.withUsername is not accessible from the gpt moduleFunction GptSandbox.withUsername is not accessible from the gpt modulewithSecret() 🔗
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
| value | Secret ! | - | No description provided |
Example
Function GptSandbox.withSecret is not accessible from the gpt moduleFunction GptSandbox.withSecret is not accessible from the gpt moduleFunction GptSandbox.withSecret is not accessible from the gpt moduleFunction GptSandbox.withSecret is not accessible from the gpt modulewithHome() 🔗
Configure the sandbox’s home directory
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| home | Directory ! | - | No description provided |
Example
Function GptSandbox.withHome is not accessible from the gpt moduleFunction GptSandbox.withHome is not accessible from the gpt moduleFunction GptSandbox.withHome is not accessible from the gpt moduleFunction GptSandbox.withHome is not accessible from the gpt modulereadManual() 🔗
Lookup a manual and return its contents.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| key | String ! | - | No description provided |
Example
Function GptSandbox.readManual is not accessible from the gpt moduleFunction GptSandbox.readManual is not accessible from the gpt moduleFunction GptSandbox.readManual is not accessible from the gpt moduleFunction GptSandbox.readManual is not accessible from the gpt modulemanual() 🔗
Lookup a manual
Return Type
Manual !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| key | String ! | - | No description provided |
Example
Function GptSandbox.manual is not accessible from the gpt moduleFunction GptSandbox.manual is not accessible from the gpt moduleFunction GptSandbox.manual is not accessible from the gpt moduleFunction GptSandbox.manual is not accessible from the gpt modulewithNote() 🔗
Add a note to the sandbox history on behalf of the sandbox user
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| note | String ! | - | No description provided |
| username | String | - | The name of the user leaving the note. Default to the sandbox username |
Example
Function GptSandbox.withNote is not accessible from the gpt moduleFunction GptSandbox.withNote is not accessible from the gpt moduleFunction GptSandbox.withNote is not accessible from the gpt moduleFunction GptSandbox.withNote is not accessible from the gpt modulewithManual() 🔗
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| key | String ! | - | Unique key for the manual |
| description | String ! | - | Description for the knowledge. Keep it short, like the cover of a book. |
| contents | String ! | - | Contents of the manual |
Example
Function GptSandbox.withManual is not accessible from the gpt moduleFunction GptSandbox.withManual is not accessible from the gpt moduleFunction GptSandbox.withManual is not accessible from the gpt moduleFunction GptSandbox.withManual is not accessible from the gpt moduleimportManuals() 🔗
Import manuals from a directory into the sandbox Any .txt or .md file will be read. - The filename (minus the extension) is the key - The first paragraph is the description - The rest of the file is the contents
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dir | Directory ! | - | No description provided |
Example
Function GptSandbox.importManuals is not accessible from the gpt moduleFunction GptSandbox.importManuals is not accessible from the gpt moduleFunction GptSandbox.importManuals is not accessible from the gpt moduleFunction GptSandbox.importManuals is not accessible from the gpt modulelastRun() 🔗
Return Type
Run ! Example
Function GptSandbox.lastRun is not accessible from the gpt moduleFunction GptSandbox.lastRun is not accessible from the gpt moduleFunction GptSandbox.lastRun is not accessible from the gpt moduleFunction GptSandbox.lastRun is not accessible from the gpt moduleterminal() 🔗
Open an interactive terminal session
Return Type
Sandbox ! Example
Function GptSandbox.terminal is not accessible from the gpt moduleFunction GptSandbox.terminal is not accessible from the gpt moduleFunction GptSandbox.terminal is not accessible from the gpt moduleFunction GptSandbox.terminal is not accessible from the gpt modulerun() 🔗
Run a script in the sandbox
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| script | String ! | - | No description provided |
Example
Function GptSandbox.run is not accessible from the gpt moduleFunction GptSandbox.run is not accessible from the gpt moduleFunction GptSandbox.run is not accessible from the gpt moduleFunction GptSandbox.run is not accessible from the gpt moduleManual 🔗
An instruction manual for the user of the sandbox
key() 🔗
Return Type
String ! Example
Function GptManual.key is not accessible from the gpt moduleFunction GptManual.key is not accessible from the gpt moduleFunction GptManual.key is not accessible from the gpt moduleFunction GptManual.key is not accessible from the gpt moduledescription() 🔗
Return Type
String ! Example
Function GptManual.description is not accessible from the gpt moduleFunction GptManual.description is not accessible from the gpt moduleFunction GptManual.description is not accessible from the gpt moduleFunction GptManual.description is not accessible from the gpt modulecontents() 🔗
Return Type
String ! Example
Function GptManual.contents is not accessible from the gpt moduleFunction GptManual.contents is not accessible from the gpt moduleFunction GptManual.contents is not accessible from the gpt moduleFunction GptManual.contents is not accessible from the gpt moduleRun 🔗
username() 🔗
Return Type
String ! Example
Function GptRun.username is not accessible from the gpt moduleFunction GptRun.username is not accessible from the gpt moduleFunction GptRun.username is not accessible from the gpt moduleFunction GptRun.username is not accessible from the gpt modulescript() 🔗
Return Type
String ! Example
Function GptRun.script is not accessible from the gpt moduleFunction GptRun.script is not accessible from the gpt moduleFunction GptRun.script is not accessible from the gpt moduleFunction GptRun.script is not accessible from the gpt modulehostBefore() 🔗
Return Type
Container ! Example
Function GptRun.hostBefore is not accessible from the gpt moduleFunction GptRun.hostBefore is not accessible from the gpt moduleFunction GptRun.hostBefore is not accessible from the gpt moduleFunction GptRun.hostBefore is not accessible from the gpt modulehostAfter() 🔗
Return Type
Container ! Example
Function GptRun.hostAfter is not accessible from the gpt moduleFunction GptRun.hostAfter is not accessible from the gpt moduleFunction GptRun.hostAfter is not accessible from the gpt moduleFunction GptRun.hostAfter is not accessible from the gpt modulestdout() 🔗
Return Type
String ! Example
Function GptRun.stdout is not accessible from the gpt moduleFunction GptRun.stdout is not accessible from the gpt moduleFunction GptRun.stdout is not accessible from the gpt moduleFunction GptRun.stdout is not accessible from the gpt modulestderr() 🔗
Return Type
String ! Example
Function GptRun.stderr is not accessible from the gpt moduleFunction GptRun.stderr is not accessible from the gpt moduleFunction GptRun.stderr is not accessible from the gpt moduleFunction GptRun.stderr is not accessible from the gpt moduleexitCode() 🔗
Return Type
Integer ! Example
Function GptRun.exitCode is not accessible from the gpt moduleFunction GptRun.exitCode is not accessible from the gpt moduleFunction GptRun.exitCode is not accessible from the gpt moduleFunction GptRun.exitCode is not accessible from the gpt moduleshort() 🔗
Return Type
String ! Example
Function GptRun.short is not accessible from the gpt moduleFunction GptRun.short is not accessible from the gpt moduleFunction GptRun.short is not accessible from the gpt moduleFunction GptRun.short is not accessible from the gpt modulechanges() 🔗
All filesystem changes made by the run
Return Type
Directory ! Example
Function GptRun.changes is not accessible from the gpt moduleFunction GptRun.changes is not accessible from the gpt moduleFunction GptRun.changes is not accessible from the gpt moduleFunction GptRun.changes is not accessible from the gpt moduleresultJson() 🔗
Encode the run result as JSON
Return Type
String ! Example
Function GptRun.resultJson is not accessible from the gpt moduleFunction GptRun.resultJson is not accessible from the gpt moduleFunction GptRun.resultJson is not accessible from the gpt moduleFunction GptRun.resultJson is not accessible from the gpt module