gpt
No long description provided.
Installation
dagger install github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cdEntrypoint
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@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd 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 🔗
log() 🔗
Return Type
[String ! ] ! Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET logfunc (m *MyModule) Example(ctx context.Context, token *dagger.Secret) []string {
return dag.
Gpt(token).
Log(ctx)
}@function
async def example(token: dagger.Secret, ) -> List[str]:
return await (
dag.gpt(token)
.log()
)@func()
async example(token: Secret, ): Promise<string[]> {
return dag
.gpt(token)
.log()
}workdir() 🔗
Return Type
Directory ! Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET workdirfunc (m *MyModule) Example(token *dagger.Secret) *dagger.Directory {
return dag.
Gpt(token).
Workdir()
}@function
def example(token: dagger.Secret, ) -> dagger.Directory:
return (
dag.gpt(token)
.workdir()
)@func()
example(token: Secret, ): Directory {
return dag
.gpt(token)
.workdir()
}withKnowledgeDir() 🔗
Add knowledge by reading text files from a directory Any .txt or .md file will be read. - The first paragraph is the description - The rest of the file is the contents
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dir | Directory ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET with-knowledge-dir --dir DIR_PATHfunc (m *MyModule) Example(token *dagger.Secret, dir *dagger.Directory) *dagger.Gpt {
return dag.
Gpt(token).
WithKnowledgeDir(dir)
}@function
def example(token: dagger.Secret, dir: dagger.Directory) -> dagger.Gpt:
return (
dag.gpt(token)
.with_knowledge_dir(dir)
)@func()
example(token: Secret, dir: Directory): Gpt {
return dag
.gpt(token)
.withKnowledgeDir(dir)
}withKnowledge() 🔗
Inject knowledge
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | Unique name. Not semantically meaningful |
| description | String ! | - | Description for the knowledge. Keep it short, like the cover of a book. The model uses it to decide which book to read |
| contents | String ! | - | Contents of the knowledge. This is like the contents of the book. It will only be read by the model if it decides to lookup based on the description. |
Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET with-knowledge --name string --description string --contents stringfunc (m *MyModule) Example(token *dagger.Secret, name string, description string, contents string) *dagger.Gpt {
return dag.
Gpt(token).
WithKnowledge(name, description, contents)
}@function
def example(token: dagger.Secret, name: str, description: str, contents: str) -> dagger.Gpt:
return (
dag.gpt(token)
.with_knowledge(name, description, contents)
)@func()
example(token: Secret, name: string, description: string, contents: string): Gpt {
return dag
.gpt(token)
.withKnowledge(name, description, contents)
}knowledge() 🔗
Lookup a piece of knowledge by name
Return Type
Knowledge !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET knowledge --name stringfunc (m *MyModule) Example(token *dagger.Secret, name string) *dagger.GptKnowledge {
return dag.
Gpt(token).
Knowledge(name)
}@function
def example(token: dagger.Secret, name: str) -> dagger.GptKnowledge:
return (
dag.gpt(token)
.knowledge(name)
)@func()
example(token: Secret, name: string): GptKnowledge {
return dag
.gpt(token)
.knowledge(name)
}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@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd 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@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd 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@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd 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)
}withWorkdir() 🔗
Attach a new workdir for the AI’s shell
Return Type
Gpt !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| workdir | Directory ! | - | No description provided |
Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET with-workdir --workdir DIR_PATHfunc (m *MyModule) Example(token *dagger.Secret, workdir *dagger.Directory) *dagger.Gpt {
return dag.
Gpt(token).
WithWorkdir(workdir)
}@function
def example(token: dagger.Secret, workdir: dagger.Directory) -> dagger.Gpt:
return (
dag.gpt(token)
.with_workdir(workdir)
)@func()
example(token: Secret, workdir: Directory): Gpt {
return dag
.gpt(token)
.withWorkdir(workdir)
}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@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd 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)
}historyFile() 🔗
Return Type
File ! Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET history-filefunc (m *MyModule) Example(token *dagger.Secret) *dagger.File {
return dag.
Gpt(token).
HistoryFile()
}@function
def example(token: dagger.Secret, ) -> dagger.File:
return (
dag.gpt(token)
.history_file()
)@func()
example(token: Secret, ): File {
return dag
.gpt(token)
.historyFile()
}toolEnv() 🔗
Return Type
Container ! Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET tool-envfunc (m *MyModule) Example(token *dagger.Secret) *dagger.Container {
return dag.
Gpt(token).
ToolEnv()
}@function
def example(token: dagger.Secret, ) -> dagger.Container:
return (
dag.gpt(token)
.tool_env()
)@func()
example(token: Secret, ): Container {
return dag
.gpt(token)
.toolEnv()
}Knowledge 🔗
An individual piece of knowledge
name() 🔗
Return Type
String ! Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
knowledge --name string \
namefunc (m *MyModule) Example(ctx context.Context, name string) string {
return dag.
Gpt().
Knowledge(name).
Name(ctx)
}@function
async def example(name: str) -> str:
return await (
dag.gpt()
.knowledge(name)
.name()
)@func()
async example(name: string): Promise<string> {
return dag
.gpt()
.knowledge(name)
.name()
}description() 🔗
Return Type
String ! Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
knowledge --name string \
descriptionfunc (m *MyModule) Example(ctx context.Context, name string) string {
return dag.
Gpt().
Knowledge(name).
Description(ctx)
}@function
async def example(name: str) -> str:
return await (
dag.gpt()
.knowledge(name)
.description()
)@func()
async example(name: string): Promise<string> {
return dag
.gpt()
.knowledge(name)
.description()
}contents() 🔗
Return Type
String ! Example
dagger -m github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
knowledge --name string \
contentsfunc (m *MyModule) Example(ctx context.Context, name string) string {
return dag.
Gpt().
Knowledge(name).
Contents(ctx)
}@function
async def example(name: str) -> str:
return await (
dag.gpt()
.knowledge(name)
.contents()
)@func()
async example(name: string): Promise<string> {
return dag
.gpt()
.knowledge(name)
.contents()
}