gpt
No long description provided.
Installation
dagger install github.com/shykes/x/gpt@b3d45d5fc4927c5992da563148cc36343cc03346
Entrypoint
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:MYSECRET
func (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 sandbox
func (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:MYSECRET
func (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_PATH
func (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 string
func (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_PATH
func (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 history
func (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 string
func (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 string
func (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 string
func (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 string
func (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 module
Function GptSandbox.home is not accessible from the gpt module
Function GptSandbox.home is not accessible from the gpt module
Function GptSandbox.home is not accessible from the gpt module
base() 🔗
Base image for the sandbox host computer
Return Type
Container !
Example
Function GptSandbox.base is not accessible from the gpt module
Function GptSandbox.base is not accessible from the gpt module
Function GptSandbox.base is not accessible from the gpt module
Function GptSandbox.base is not accessible from the gpt module
runs() 🔗
Runs of script execution
Return Type
[Run ! ] !
Example
Function GptSandbox.runs is not accessible from the gpt module
Function GptSandbox.runs is not accessible from the gpt module
Function GptSandbox.runs is not accessible from the gpt module
Function GptSandbox.runs is not accessible from the gpt module
manuals() 🔗
Instruction manuals for the user of the sandbox
Return Type
[Manual ! ] !
Example
Function GptSandbox.manuals is not accessible from the gpt module
Function GptSandbox.manuals is not accessible from the gpt module
Function GptSandbox.manuals is not accessible from the gpt module
Function GptSandbox.manuals is not accessible from the gpt module
history() 🔗
Return Type
[String ! ] !
Example
Function GptSandbox.history is not accessible from the gpt module
Function GptSandbox.history is not accessible from the gpt module
Function GptSandbox.history is not accessible from the gpt module
Function GptSandbox.history is not accessible from the gpt module
host() 🔗
The host container for the sandbox
Return Type
Container !
Example
Function GptSandbox.host is not accessible from the gpt module
Function GptSandbox.host is not accessible from the gpt module
Function GptSandbox.host is not accessible from the gpt module
Function GptSandbox.host is not accessible from the gpt module
withRemoteModule() 🔗
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 module
Function GptSandbox.withRemoteModule is not accessible from the gpt module
Function GptSandbox.withRemoteModule is not accessible from the gpt module
Function GptSandbox.withRemoteModule is not accessible from the gpt module
withLocalModule() 🔗
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 module
Function GptSandbox.withLocalModule is not accessible from the gpt module
Function GptSandbox.withLocalModule is not accessible from the gpt module
Function GptSandbox.withLocalModule is not accessible from the gpt module
changes() 🔗
All filesystem changes made to the host sandbox so far
Return Type
Directory !
Example
Function GptSandbox.changes is not accessible from the gpt module
Function GptSandbox.changes is not accessible from the gpt module
Function GptSandbox.changes is not accessible from the gpt module
Function GptSandbox.changes is not accessible from the gpt module
withUsername() 🔗
Return Type
Sandbox !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
username | String ! | - | No description provided |
Example
Function GptSandbox.withUsername is not accessible from the gpt module
Function GptSandbox.withUsername is not accessible from the gpt module
Function GptSandbox.withUsername is not accessible from the gpt module
Function GptSandbox.withUsername is not accessible from the gpt module
withSecret() 🔗
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 module
Function GptSandbox.withSecret is not accessible from the gpt module
Function GptSandbox.withSecret is not accessible from the gpt module
Function GptSandbox.withSecret is not accessible from the gpt module
withHome() 🔗
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 module
Function GptSandbox.withHome is not accessible from the gpt module
Function GptSandbox.withHome is not accessible from the gpt module
Function GptSandbox.withHome is not accessible from the gpt module
readManual() 🔗
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 module
Function GptSandbox.readManual is not accessible from the gpt module
Function GptSandbox.readManual is not accessible from the gpt module
Function GptSandbox.readManual is not accessible from the gpt module
manual() 🔗
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 module
Function GptSandbox.manual is not accessible from the gpt module
Function GptSandbox.manual is not accessible from the gpt module
Function GptSandbox.manual is not accessible from the gpt module
withNote() 🔗
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 module
Function GptSandbox.withNote is not accessible from the gpt module
Function GptSandbox.withNote is not accessible from the gpt module
Function GptSandbox.withNote is not accessible from the gpt module
withManual() 🔗
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 module
Function GptSandbox.withManual is not accessible from the gpt module
Function GptSandbox.withManual is not accessible from the gpt module
Function GptSandbox.withManual is not accessible from the gpt module
importManuals() 🔗
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 module
Function GptSandbox.importManuals is not accessible from the gpt module
Function GptSandbox.importManuals is not accessible from the gpt module
Function GptSandbox.importManuals is not accessible from the gpt module
lastRun() 🔗
Return Type
Run !
Example
Function GptSandbox.lastRun is not accessible from the gpt module
Function GptSandbox.lastRun is not accessible from the gpt module
Function GptSandbox.lastRun is not accessible from the gpt module
Function GptSandbox.lastRun is not accessible from the gpt module
terminal() 🔗
Open an interactive terminal session
Return Type
Sandbox !
Example
Function GptSandbox.terminal is not accessible from the gpt module
Function GptSandbox.terminal is not accessible from the gpt module
Function GptSandbox.terminal is not accessible from the gpt module
Function GptSandbox.terminal is not accessible from the gpt module
run() 🔗
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 module
Function GptSandbox.run is not accessible from the gpt module
Function GptSandbox.run is not accessible from the gpt module
Function GptSandbox.run is not accessible from the gpt module
Manual 🔗
An instruction manual for the user of the sandbox
key() 🔗
Return Type
String !
Example
Function GptManual.key is not accessible from the gpt module
Function GptManual.key is not accessible from the gpt module
Function GptManual.key is not accessible from the gpt module
Function GptManual.key is not accessible from the gpt module
description() 🔗
Return Type
String !
Example
Function GptManual.description is not accessible from the gpt module
Function GptManual.description is not accessible from the gpt module
Function GptManual.description is not accessible from the gpt module
Function GptManual.description is not accessible from the gpt module
contents() 🔗
Return Type
String !
Example
Function GptManual.contents is not accessible from the gpt module
Function GptManual.contents is not accessible from the gpt module
Function GptManual.contents is not accessible from the gpt module
Function GptManual.contents is not accessible from the gpt module
Run 🔗
username() 🔗
Return Type
String !
Example
Function GptRun.username is not accessible from the gpt module
Function GptRun.username is not accessible from the gpt module
Function GptRun.username is not accessible from the gpt module
Function GptRun.username is not accessible from the gpt module
script() 🔗
Return Type
String !
Example
Function GptRun.script is not accessible from the gpt module
Function GptRun.script is not accessible from the gpt module
Function GptRun.script is not accessible from the gpt module
Function GptRun.script is not accessible from the gpt module
hostBefore() 🔗
Return Type
Container !
Example
Function GptRun.hostBefore is not accessible from the gpt module
Function GptRun.hostBefore is not accessible from the gpt module
Function GptRun.hostBefore is not accessible from the gpt module
Function GptRun.hostBefore is not accessible from the gpt module
hostAfter() 🔗
Return Type
Container !
Example
Function GptRun.hostAfter is not accessible from the gpt module
Function GptRun.hostAfter is not accessible from the gpt module
Function GptRun.hostAfter is not accessible from the gpt module
Function GptRun.hostAfter is not accessible from the gpt module
stdout() 🔗
Return Type
String !
Example
Function GptRun.stdout is not accessible from the gpt module
Function GptRun.stdout is not accessible from the gpt module
Function GptRun.stdout is not accessible from the gpt module
Function GptRun.stdout is not accessible from the gpt module
stderr() 🔗
Return Type
String !
Example
Function GptRun.stderr is not accessible from the gpt module
Function GptRun.stderr is not accessible from the gpt module
Function GptRun.stderr is not accessible from the gpt module
Function GptRun.stderr is not accessible from the gpt module
exitCode() 🔗
Return Type
Integer !
Example
Function GptRun.exitCode is not accessible from the gpt module
Function GptRun.exitCode is not accessible from the gpt module
Function GptRun.exitCode is not accessible from the gpt module
Function GptRun.exitCode is not accessible from the gpt module
short() 🔗
Return Type
String !
Example
Function GptRun.short is not accessible from the gpt module
Function GptRun.short is not accessible from the gpt module
Function GptRun.short is not accessible from the gpt module
Function GptRun.short is not accessible from the gpt module
changes() 🔗
All filesystem changes made by the run
Return Type
Directory !
Example
Function GptRun.changes is not accessible from the gpt module
Function GptRun.changes is not accessible from the gpt module
Function GptRun.changes is not accessible from the gpt module
Function GptRun.changes is not accessible from the gpt module
resultJson() 🔗
Encode the run result as JSON
Return Type
String !
Example
Function GptRun.resultJson is not accessible from the gpt module
Function GptRun.resultJson is not accessible from the gpt module
Function GptRun.resultJson is not accessible from the gpt module
Function GptRun.resultJson is not accessible from the gpt module