llm
No long description provided.
Installation
dagger install github.com/shykes/x/llm@114dc8a4f4c6e4723935ff3ae636ab6906e03dd1
Entrypoint
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() *Llm {
return dag.
Llm()
}
@function
def example() -> dag.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 \
sandbox
func (m *myModule) example() *LlmSandbox {
return dag.
Llm().
Sandbox()
}
@function
def example() -> dag.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:MYSECRET
func (m *myModule) example(token *Secret) *Llm {
return dag.
Llm().
WithToken(token)
}
@function
def example(token: dagger.Secret) -> dag.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:PORT
func (m *myModule) example(endpoint *Service) *Llm {
return dag.
Llm().
WithEndpoint(endpoint)
}
@function
def example(endpoint: dagger.Service) -> dag.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 *LlmSandbox) *Llm {
return dag.
Llm().
WithSandbox(sandbox)
}
@function
def example(sandbox: dag.LlmSandbox) -> dag.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:MYSECRET
func (m *myModule) example(name string, value *Secret) *Llm {
return dag.
Llm().
WithSecret(name, value)
}
@function
def example(name: str, value: dagger.Secret) -> dag.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_PATH
func (m *myModule) example(dir *Directory) *Llm {
return dag.
Llm().
WithDirectory(dir)
}
@function
def example(dir: dagger.Directory) -> dag.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 string
func (m *myModule) example(address string) *Llm {
return dag.
Llm().
WithRemoteModule(address)
}
@function
def example(address: str) -> dag.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_PATH
func (m *myModule) example(module *Directory) *Llm {
return dag.
Llm().
WithLocalModule(module)
}
@function
def example(module: dagger.Directory) -> dag.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 \
history
func (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 string
func (m *myModule) example(prompt string) *Llm {
return dag.
Llm().
WithPrompt(prompt)
}
@function
def example(prompt: str) -> dag.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 string
func (m *myModule) example(prompt string) *Llm {
return dag.
Llm().
WithSystemPrompt(prompt)
}
@function
def example(prompt: str) -> dag.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 string
func (m *myModule) example(prompt string) *Llm {
return dag.
Llm().
Ask(prompt)
}
@function
def example(prompt: str) -> dag.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 module
Function LlmSandbox.home is not accessible from the llm module
Function LlmSandbox.home is not accessible from the llm module
Function LlmSandbox.home is not accessible from the llm module
base() 🔗
Base image for the sandbox host computer
Return Type
Container !
Example
Function LlmSandbox.base is not accessible from the llm module
Function LlmSandbox.base is not accessible from the llm module
Function LlmSandbox.base is not accessible from the llm module
Function LlmSandbox.base is not accessible from the llm module
runs() 🔗
Runs of script execution
Return Type
[Run ! ] !
Example
Function LlmSandbox.runs is not accessible from the llm module
Function LlmSandbox.runs is not accessible from the llm module
Function LlmSandbox.runs is not accessible from the llm module
Function LlmSandbox.runs is not accessible from the llm module
manuals() 🔗
Instruction manuals for the user of the sandbox
Return Type
[Manual ! ] !
Example
Function LlmSandbox.manuals is not accessible from the llm module
Function LlmSandbox.manuals is not accessible from the llm module
Function LlmSandbox.manuals is not accessible from the llm module
Function LlmSandbox.manuals is not accessible from the llm module
history() 🔗
Return Type
[String ! ] !
Example
Function LlmSandbox.history is not accessible from the llm module
Function LlmSandbox.history is not accessible from the llm module
Function LlmSandbox.history is not accessible from the llm module
Function LlmSandbox.history is not accessible from the llm module
host() 🔗
The host container for the sandbox
Return Type
Container !
Example
Function LlmSandbox.host is not accessible from the llm module
Function LlmSandbox.host is not accessible from the llm module
Function LlmSandbox.host is not accessible from the llm module
Function LlmSandbox.host is not accessible from the llm 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 LlmSandbox.withRemoteModule is not accessible from the llm module
Function LlmSandbox.withRemoteModule is not accessible from the llm module
Function LlmSandbox.withRemoteModule is not accessible from the llm module
Function LlmSandbox.withRemoteModule is not accessible from the llm 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 LlmSandbox.withLocalModule is not accessible from the llm module
Function LlmSandbox.withLocalModule is not accessible from the llm module
Function LlmSandbox.withLocalModule is not accessible from the llm module
Function LlmSandbox.withLocalModule is not accessible from the llm module
changes() 🔗
All filesystem changes made to the host sandbox so far
Return Type
Directory !
Example
Function LlmSandbox.changes is not accessible from the llm module
Function LlmSandbox.changes is not accessible from the llm module
Function LlmSandbox.changes is not accessible from the llm module
Function LlmSandbox.changes is not accessible from the llm module
withUsername() 🔗
Return Type
Sandbox !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
username | String ! | - | No description provided |
Example
Function LlmSandbox.withUsername is not accessible from the llm module
Function LlmSandbox.withUsername is not accessible from the llm module
Function LlmSandbox.withUsername is not accessible from the llm module
Function LlmSandbox.withUsername is not accessible from the llm module
withSecret() 🔗
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 module
Function LlmSandbox.withSecret is not accessible from the llm module
Function LlmSandbox.withSecret is not accessible from the llm module
Function LlmSandbox.withSecret is not accessible from the llm module
withHome() 🔗
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 module
Function LlmSandbox.withHome is not accessible from the llm module
Function LlmSandbox.withHome is not accessible from the llm module
Function LlmSandbox.withHome is not accessible from the llm 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 LlmSandbox.readManual is not accessible from the llm module
Function LlmSandbox.readManual is not accessible from the llm module
Function LlmSandbox.readManual is not accessible from the llm module
Function LlmSandbox.readManual is not accessible from the llm module
manual() 🔗
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 module
Function LlmSandbox.manual is not accessible from the llm module
Function LlmSandbox.manual is not accessible from the llm module
Function LlmSandbox.manual is not accessible from the llm 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 LlmSandbox.withNote is not accessible from the llm module
Function LlmSandbox.withNote is not accessible from the llm module
Function LlmSandbox.withNote is not accessible from the llm module
Function LlmSandbox.withNote is not accessible from the llm 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 LlmSandbox.withManual is not accessible from the llm module
Function LlmSandbox.withManual is not accessible from the llm module
Function LlmSandbox.withManual is not accessible from the llm module
Function LlmSandbox.withManual is not accessible from the llm 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 LlmSandbox.importManuals is not accessible from the llm module
Function LlmSandbox.importManuals is not accessible from the llm module
Function LlmSandbox.importManuals is not accessible from the llm module
Function LlmSandbox.importManuals is not accessible from the llm module
lastRun() 🔗
Return Type
Run !
Example
Function LlmSandbox.lastRun is not accessible from the llm module
Function LlmSandbox.lastRun is not accessible from the llm module
Function LlmSandbox.lastRun is not accessible from the llm module
Function LlmSandbox.lastRun is not accessible from the llm module
terminal() 🔗
Open an interactive terminal session
Return Type
Sandbox !
Example
Function LlmSandbox.terminal is not accessible from the llm module
Function LlmSandbox.terminal is not accessible from the llm module
Function LlmSandbox.terminal is not accessible from the llm module
Function LlmSandbox.terminal is not accessible from the llm module
run() 🔗
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 module
Function LlmSandbox.run is not accessible from the llm module
Function LlmSandbox.run is not accessible from the llm module
Function LlmSandbox.run is not accessible from the llm module
Manual 🔗
An instruction manual for the user of the sandbox
name() 🔗
Return Type
String !
Example
Function LlmManual.name is not accessible from the llm module
Function LlmManual.name is not accessible from the llm module
Function LlmManual.name is not accessible from the llm module
Function LlmManual.name is not accessible from the llm module
description() 🔗
Return Type
String !
Example
Function LlmManual.description is not accessible from the llm module
Function LlmManual.description is not accessible from the llm module
Function LlmManual.description is not accessible from the llm module
Function LlmManual.description is not accessible from the llm module
contents() 🔗
Return Type
String !
Example
Function LlmManual.contents is not accessible from the llm module
Function LlmManual.contents is not accessible from the llm module
Function LlmManual.contents is not accessible from the llm module
Function LlmManual.contents is not accessible from the llm module
Run 🔗
username() 🔗
Return Type
String !
Example
Function LlmRun.username is not accessible from the llm module
Function LlmRun.username is not accessible from the llm module
Function LlmRun.username is not accessible from the llm module
Function LlmRun.username is not accessible from the llm module
script() 🔗
Return Type
String !
Example
Function LlmRun.script is not accessible from the llm module
Function LlmRun.script is not accessible from the llm module
Function LlmRun.script is not accessible from the llm module
Function LlmRun.script is not accessible from the llm module
hostBefore() 🔗
Return Type
Container !
Example
Function LlmRun.hostBefore is not accessible from the llm module
Function LlmRun.hostBefore is not accessible from the llm module
Function LlmRun.hostBefore is not accessible from the llm module
Function LlmRun.hostBefore is not accessible from the llm module
hostAfter() 🔗
Return Type
Container !
Example
Function LlmRun.hostAfter is not accessible from the llm module
Function LlmRun.hostAfter is not accessible from the llm module
Function LlmRun.hostAfter is not accessible from the llm module
Function LlmRun.hostAfter is not accessible from the llm module
stdout() 🔗
Return Type
String !
Example
Function LlmRun.stdout is not accessible from the llm module
Function LlmRun.stdout is not accessible from the llm module
Function LlmRun.stdout is not accessible from the llm module
Function LlmRun.stdout is not accessible from the llm module
stderr() 🔗
Return Type
String !
Example
Function LlmRun.stderr is not accessible from the llm module
Function LlmRun.stderr is not accessible from the llm module
Function LlmRun.stderr is not accessible from the llm module
Function LlmRun.stderr is not accessible from the llm module
exitCode() 🔗
Return Type
Integer !
Example
Function LlmRun.exitCode is not accessible from the llm module
Function LlmRun.exitCode is not accessible from the llm module
Function LlmRun.exitCode is not accessible from the llm module
Function LlmRun.exitCode is not accessible from the llm module
short() 🔗
Return Type
String !
Example
Function LlmRun.short is not accessible from the llm module
Function LlmRun.short is not accessible from the llm module
Function LlmRun.short is not accessible from the llm module
Function LlmRun.short is not accessible from the llm module
changes() 🔗
All filesystem changes made by the run
Return Type
Directory !
Example
Function LlmRun.changes is not accessible from the llm module
Function LlmRun.changes is not accessible from the llm module
Function LlmRun.changes is not accessible from the llm module
Function LlmRun.changes is not accessible from the llm module
toJson() 🔗
Return Type
String !
Example
Function LlmRun.toJson is not accessible from the llm module
Function LlmRun.toJson is not accessible from the llm module
Function LlmRun.toJson is not accessible from the llm module
Function LlmRun.toJson is not accessible from the llm module