gpt
No long description provided.
Installation
dagger install github.com/shykes/x/gpt@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd
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@56bfdb8bf9a3a79fb63d02a75d5bf065894979cd call \
--token env:MYSECRET
func (m *myModule) example(token *Secret) *Gpt {
return dag.
Gpt(token)
}
@function
def example(token: dagger.Secret, ) -> dag.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 log
func (m *myModule) example(ctx context.Context, token *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 workdir
func (m *myModule) example(token *Secret) *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_PATH
func (m *myModule) example(token *Secret, dir *Directory) *Gpt {
return dag.
Gpt(token).
WithKnowledgeDir(dir)
}
@function
def example(token: dagger.Secret, dir: dagger.Directory) -> dag.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 string
func (m *myModule) example(token *Secret, name string, description string, contents string) *Gpt {
return dag.
Gpt(token).
WithKnowledge(name, description, contents)
}
@function
def example(token: dagger.Secret, name: str, description: str, contents: str) -> dag.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 string
func (m *myModule) example(token *Secret, name string) *GptKnowledge {
return dag.
Gpt(token).
Knowledge(name)
}
@function
def example(token: dagger.Secret, name: str) -> dag.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 string
func (m *myModule) example(token *Secret, callId string, content string) *Gpt {
return dag.
Gpt(token).
WithToolOutput(callId, content)
}
@function
def example(token: dagger.Secret, call_id: str, content: str) -> dag.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 string
func (m *myModule) example(token *Secret, prompt string) *Gpt {
return dag.
Gpt(token).
WithPrompt(prompt)
}
@function
def example(token: dagger.Secret, prompt: str) -> dag.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 string
func (m *myModule) example(token *Secret, prompt string) *Gpt {
return dag.
Gpt(token).
WithSystemPrompt(prompt)
}
@function
def example(token: dagger.Secret, prompt: str) -> dag.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_PATH
func (m *myModule) example(token *Secret, workdir *Directory) *Gpt {
return dag.
Gpt(token).
WithWorkdir(workdir)
}
@function
def example(token: dagger.Secret, workdir: dagger.Directory) -> dag.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 string
func (m *myModule) example(token *Secret, prompt string) *Gpt {
return dag.
Gpt(token).
Ask(prompt)
}
@function
def example(token: dagger.Secret, prompt: str) -> dag.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-file
func (m *myModule) example(token *Secret) *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-env
func (m *myModule) example(token *Secret) *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 \
name
func (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 \
description
func (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 \
contents
func (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()
}