llm
No long description provided.
Installation
dagger install github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1Entrypoint
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| model | String | "gpt-4o" | LLM model name |
| 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 LLM context |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
func (m *MyModule) Example() *dagger.Llm {
return dag.
Llm()
}@function
def example() -> dagger.Llm:
return (
dag.llm()
)@func()
example(): Llm {
return dag
.llm()
}Types
Llm 🔗
sandbox() 🔗
Return Type
Sandbox ! Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
sandboxfunc (m *MyModule) Example() *dagger.LlmSandbox {
return dag.
Llm().
Sandbox()
}@function
def example() -> dagger.LlmSandbox:
return (
dag.llm()
.sandbox()
)@func()
example(): LlmSandbox {
return dag
.llm()
.sandbox()
}withToken() 🔗
Configure an API token to authenticate against the LLM provider
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| token | Secret ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-token --token env:MYSECRETfunc (m *MyModule) Example(token *dagger.Secret) *dagger.Llm {
return dag.
Llm().
WithToken(token)
}@function
def example(token: dagger.Secret) -> dagger.Llm:
return (
dag.llm()
.with_token(token)
)@func()
example(token: Secret): Llm {
return dag
.llm()
.withToken(token)
}withEndpoint() 🔗
Configure an API endpoint to send LLM requests Use this for local models, or hosted models that support multiple endpoints
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| endpoint | Service ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-endpoint --endpoint PROTOCOL://HOST:PORTfunc (m *MyModule) Example(endpoint *dagger.Service) *dagger.Llm {
return dag.
Llm().
WithEndpoint(endpoint)
}@function
def example(endpoint: dagger.Service) -> dagger.Llm:
return (
dag.llm()
.with_endpoint(endpoint)
)@func()
example(endpoint: Service): Llm {
return dag
.llm()
.withEndpoint(endpoint)
}withSandbox() 🔗
Return Type
Llm !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(sandbox *dagger.LlmSandbox) *dagger.Llm {
return dag.
Llm().
WithSandbox(sandbox)
}@function
def example(sandbox: dagger.LlmSandbox) -> dagger.Llm:
return (
dag.llm()
.with_sandbox(sandbox)
)@func()
example(sandbox: LlmSandbox): Llm {
return dag
.llm()
.withSandbox(sandbox)
}withSecret() 🔗
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
| value | Secret ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-secret --name string --value env:MYSECRETfunc (m *MyModule) Example(name string, value *dagger.Secret) *dagger.Llm {
return dag.
Llm().
WithSecret(name, value)
}@function
def example(name: str, value: dagger.Secret) -> dagger.Llm:
return (
dag.llm()
.with_secret(name, value)
)@func()
example(name: string, value: Secret): Llm {
return dag
.llm()
.withSecret(name, value)
}withDirectory() 🔗
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dir | Directory ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-directory --dir DIR_PATHfunc (m *MyModule) Example(dir *dagger.Directory) *dagger.Llm {
return dag.
Llm().
WithDirectory(dir)
}@function
def example(dir: dagger.Directory) -> dagger.Llm:
return (
dag.llm()
.with_directory(dir)
)@func()
example(dir: Directory): Llm {
return dag
.llm()
.withDirectory(dir)
}withRemoteModule() 🔗
Configure a remote module as context for the sandbox
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| address | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-remote-module --address stringfunc (m *MyModule) Example(address string) *dagger.Llm {
return dag.
Llm().
WithRemoteModule(address)
}@function
def example(address: str) -> dagger.Llm:
return (
dag.llm()
.with_remote_module(address)
)@func()
example(address: string): Llm {
return dag
.llm()
.withRemoteModule(address)
}withLocalModule() 🔗
Configure a local module as context for the sandbox
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| module | Directory ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-local-module --module DIR_PATHfunc (m *MyModule) Example(module *dagger.Directory) *dagger.Llm {
return dag.
Llm().
WithLocalModule(module)
}@function
def example(module: dagger.Directory) -> dagger.Llm:
return (
dag.llm()
.with_local_module(module)
)@func()
example(module: Directory): Llm {
return dag
.llm()
.withLocalModule(module)
}history() 🔗
Return Type
[String ! ] ! Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
historyfunc (m *MyModule) Example(ctx context.Context) []string {
return dag.
Llm().
History(ctx)
}@function
async def example() -> List[str]:
return await (
dag.llm()
.history()
)@func()
async example(): Promise<string[]> {
return dag
.llm()
.history()
}withPrompt() 🔗
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| prompt | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-prompt --prompt stringfunc (m *MyModule) Example(prompt string) *dagger.Llm {
return dag.
Llm().
WithPrompt(prompt)
}@function
def example(prompt: str) -> dagger.Llm:
return (
dag.llm()
.with_prompt(prompt)
)@func()
example(prompt: string): Llm {
return dag
.llm()
.withPrompt(prompt)
}withSystemPrompt() 🔗
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| prompt | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
with-system-prompt --prompt stringfunc (m *MyModule) Example(prompt string) *dagger.Llm {
return dag.
Llm().
WithSystemPrompt(prompt)
}@function
def example(prompt: str) -> dagger.Llm:
return (
dag.llm()
.with_system_prompt(prompt)
)@func()
example(prompt: string): Llm {
return dag
.llm()
.withSystemPrompt(prompt)
}ask() 🔗
Return Type
Llm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| prompt | String ! | - | The message to send the model |
Example
dagger -m github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1 call \
ask --prompt stringfunc (m *MyModule) Example(prompt string) *dagger.Llm {
return dag.
Llm().
Ask(prompt)
}@function
def example(prompt: str) -> dagger.Llm:
return (
dag.llm()
.ask(prompt)
)@func()
example(prompt: string): Llm {
return dag
.llm()
.ask(prompt)
}Sandbox 🔗
home() 🔗
The sandbox’s home directory
Return Type
Directory ! Example
Function LlmSandbox.home is not accessible from the llm moduleFunction LlmSandbox.home is not accessible from the llm moduleFunction LlmSandbox.home is not accessible from the llm moduleFunction LlmSandbox.home is not accessible from the llm modulebase() 🔗
Base image for the sandbox host computer
Return Type
Container ! Example
Function LlmSandbox.base is not accessible from the llm moduleFunction LlmSandbox.base is not accessible from the llm moduleFunction LlmSandbox.base is not accessible from the llm moduleFunction LlmSandbox.base is not accessible from the llm moduleruns() 🔗
Runs of script execution
Return Type
[Run ! ] ! Example
Function LlmSandbox.runs is not accessible from the llm moduleFunction LlmSandbox.runs is not accessible from the llm moduleFunction LlmSandbox.runs is not accessible from the llm moduleFunction LlmSandbox.runs is not accessible from the llm modulemanuals() 🔗
Instruction manuals for the user of the sandbox
Return Type
[Manual ! ] ! Example
Function LlmSandbox.manuals is not accessible from the llm moduleFunction LlmSandbox.manuals is not accessible from the llm moduleFunction LlmSandbox.manuals is not accessible from the llm moduleFunction LlmSandbox.manuals is not accessible from the llm modulehistory() 🔗
Return Type
[String ! ] ! Example
Function LlmSandbox.history is not accessible from the llm moduleFunction LlmSandbox.history is not accessible from the llm moduleFunction LlmSandbox.history is not accessible from the llm moduleFunction LlmSandbox.history is not accessible from the llm modulehost() 🔗
The host container for the sandbox
Return Type
Container ! Example
Function LlmSandbox.host is not accessible from the llm moduleFunction LlmSandbox.host is not accessible from the llm moduleFunction LlmSandbox.host is not accessible from the llm moduleFunction LlmSandbox.host is not accessible from the llm 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 LlmSandbox.withRemoteModule is not accessible from the llm moduleFunction LlmSandbox.withRemoteModule is not accessible from the llm moduleFunction LlmSandbox.withRemoteModule is not accessible from the llm moduleFunction LlmSandbox.withRemoteModule is not accessible from the llm 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 LlmSandbox.withLocalModule is not accessible from the llm moduleFunction LlmSandbox.withLocalModule is not accessible from the llm moduleFunction LlmSandbox.withLocalModule is not accessible from the llm moduleFunction LlmSandbox.withLocalModule is not accessible from the llm modulechanges() 🔗
All filesystem changes made to the host sandbox so far
Return Type
Directory ! Example
Function LlmSandbox.changes is not accessible from the llm moduleFunction LlmSandbox.changes is not accessible from the llm moduleFunction LlmSandbox.changes is not accessible from the llm moduleFunction LlmSandbox.changes is not accessible from the llm modulewithUsername() 🔗
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| username | String ! | - | No description provided |
Example
Function LlmSandbox.withUsername is not accessible from the llm moduleFunction LlmSandbox.withUsername is not accessible from the llm moduleFunction LlmSandbox.withUsername is not accessible from the llm moduleFunction LlmSandbox.withUsername is not accessible from the llm modulewithSecret() 🔗
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
| value | Secret ! | - | No description provided |
Example
Function LlmSandbox.withSecret is not accessible from the llm moduleFunction LlmSandbox.withSecret is not accessible from the llm moduleFunction LlmSandbox.withSecret is not accessible from the llm moduleFunction LlmSandbox.withSecret is not accessible from the llm modulewithHome() 🔗
Configure the sandbox’s home directory
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| home | Directory ! | - | No description provided |
Example
Function LlmSandbox.withHome is not accessible from the llm moduleFunction LlmSandbox.withHome is not accessible from the llm moduleFunction LlmSandbox.withHome is not accessible from the llm moduleFunction LlmSandbox.withHome is not accessible from the llm modulereadManual() 🔗
Lookup a manual and return its contents.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| key | String ! | - | No description provided |
Example
Function LlmSandbox.readManual is not accessible from the llm moduleFunction LlmSandbox.readManual is not accessible from the llm moduleFunction LlmSandbox.readManual is not accessible from the llm moduleFunction LlmSandbox.readManual is not accessible from the llm modulemanual() 🔗
Lookup a manual
Return Type
Manual !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| key | String ! | - | No description provided |
Example
Function LlmSandbox.manual is not accessible from the llm moduleFunction LlmSandbox.manual is not accessible from the llm moduleFunction LlmSandbox.manual is not accessible from the llm moduleFunction LlmSandbox.manual is not accessible from the llm 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 LlmSandbox.withNote is not accessible from the llm moduleFunction LlmSandbox.withNote is not accessible from the llm moduleFunction LlmSandbox.withNote is not accessible from the llm moduleFunction LlmSandbox.withNote is not accessible from the llm 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 LlmSandbox.withManual is not accessible from the llm moduleFunction LlmSandbox.withManual is not accessible from the llm moduleFunction LlmSandbox.withManual is not accessible from the llm moduleFunction LlmSandbox.withManual is not accessible from the llm 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 LlmSandbox.importManuals is not accessible from the llm moduleFunction LlmSandbox.importManuals is not accessible from the llm moduleFunction LlmSandbox.importManuals is not accessible from the llm moduleFunction LlmSandbox.importManuals is not accessible from the llm modulelastRun() 🔗
Return Type
Run ! Example
Function LlmSandbox.lastRun is not accessible from the llm moduleFunction LlmSandbox.lastRun is not accessible from the llm moduleFunction LlmSandbox.lastRun is not accessible from the llm moduleFunction LlmSandbox.lastRun is not accessible from the llm moduleterminal() 🔗
Open an interactive terminal session
Return Type
Sandbox ! Example
Function LlmSandbox.terminal is not accessible from the llm moduleFunction LlmSandbox.terminal is not accessible from the llm moduleFunction LlmSandbox.terminal is not accessible from the llm moduleFunction LlmSandbox.terminal is not accessible from the llm modulerun() 🔗
Run a script in the sandbox
Return Type
Sandbox !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| script | String ! | - | No description provided |
Example
Function LlmSandbox.run is not accessible from the llm moduleFunction LlmSandbox.run is not accessible from the llm moduleFunction LlmSandbox.run is not accessible from the llm moduleFunction LlmSandbox.run is not accessible from the llm moduleManual 🔗
An instruction manual for the user of the sandbox
name() 🔗
Return Type
String ! Example
Function LlmManual.name is not accessible from the llm moduleFunction LlmManual.name is not accessible from the llm moduleFunction LlmManual.name is not accessible from the llm moduleFunction LlmManual.name is not accessible from the llm moduledescription() 🔗
Return Type
String ! Example
Function LlmManual.description is not accessible from the llm moduleFunction LlmManual.description is not accessible from the llm moduleFunction LlmManual.description is not accessible from the llm moduleFunction LlmManual.description is not accessible from the llm modulecontents() 🔗
Return Type
String ! Example
Function LlmManual.contents is not accessible from the llm moduleFunction LlmManual.contents is not accessible from the llm moduleFunction LlmManual.contents is not accessible from the llm moduleFunction LlmManual.contents is not accessible from the llm moduleRun 🔗
username() 🔗
Return Type
String ! Example
Function LlmRun.username is not accessible from the llm moduleFunction LlmRun.username is not accessible from the llm moduleFunction LlmRun.username is not accessible from the llm moduleFunction LlmRun.username is not accessible from the llm modulescript() 🔗
Return Type
String ! Example
Function LlmRun.script is not accessible from the llm moduleFunction LlmRun.script is not accessible from the llm moduleFunction LlmRun.script is not accessible from the llm moduleFunction LlmRun.script is not accessible from the llm modulehostBefore() 🔗
Return Type
Container ! Example
Function LlmRun.hostBefore is not accessible from the llm moduleFunction LlmRun.hostBefore is not accessible from the llm moduleFunction LlmRun.hostBefore is not accessible from the llm moduleFunction LlmRun.hostBefore is not accessible from the llm modulehostAfter() 🔗
Return Type
Container ! Example
Function LlmRun.hostAfter is not accessible from the llm moduleFunction LlmRun.hostAfter is not accessible from the llm moduleFunction LlmRun.hostAfter is not accessible from the llm moduleFunction LlmRun.hostAfter is not accessible from the llm modulestdout() 🔗
Return Type
String ! Example
Function LlmRun.stdout is not accessible from the llm moduleFunction LlmRun.stdout is not accessible from the llm moduleFunction LlmRun.stdout is not accessible from the llm moduleFunction LlmRun.stdout is not accessible from the llm modulestderr() 🔗
Return Type
String ! Example
Function LlmRun.stderr is not accessible from the llm moduleFunction LlmRun.stderr is not accessible from the llm moduleFunction LlmRun.stderr is not accessible from the llm moduleFunction LlmRun.stderr is not accessible from the llm moduleexitCode() 🔗
Return Type
Integer ! Example
Function LlmRun.exitCode is not accessible from the llm moduleFunction LlmRun.exitCode is not accessible from the llm moduleFunction LlmRun.exitCode is not accessible from the llm moduleFunction LlmRun.exitCode is not accessible from the llm moduleshort() 🔗
Return Type
String ! Example
Function LlmRun.short is not accessible from the llm moduleFunction LlmRun.short is not accessible from the llm moduleFunction LlmRun.short is not accessible from the llm moduleFunction LlmRun.short is not accessible from the llm modulechanges() 🔗
All filesystem changes made by the run
Return Type
Directory ! Example
Function LlmRun.changes is not accessible from the llm moduleFunction LlmRun.changes is not accessible from the llm moduleFunction LlmRun.changes is not accessible from the llm moduleFunction LlmRun.changes is not accessible from the llm moduletoJson() 🔗
Return Type
String ! Example
Function LlmRun.toJson is not accessible from the llm moduleFunction LlmRun.toJson is not accessible from the llm moduleFunction LlmRun.toJson is not accessible from the llm moduleFunction LlmRun.toJson is not accessible from the llm module