Documentation
¶
Index ¶
- type EmbedModel
- type GenModel
- type Generator
- type GeneratorOption
- func WithMaxTokens(maxTokens int) GeneratorOption
- func WithModel(model GenModel) GeneratorOption
- func WithOutput(element any) GeneratorOption
- func WithStopAt(stop ...string) GeneratorOption
- func WithSystem(prompt string) GeneratorOption
- func WithTemperature(temperature float64) GeneratorOption
- func WithTool(tool tools.Tool) GeneratorOption
- func WithTools(tools ...tools.Tool) GeneratorOption
- func WithTopP(topP float64) GeneratorOption
- type LLM
- type Response
- type ToolCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbedModel ¶
type GenModel ¶
type GenModel struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
InputContentTypes []string `json:"input_content_types,omitempty"`
InputMaxToken int `json:"input_max_token,omitempty"`
OutputMaxToken int `json:"output_max_token,omitempty"`
SupportTools bool `json:"support_tools,omitempty"`
SupportStructuredOutput bool `json:"support_structured_output,omitempty"`
}
type Generator ¶
type Generator interface {
// Model lets you specify which model to use
Model(model GenModel) Generator
// System lets you specify a system prompt, ie, the prompt that the model will use to generate a response
System(prompt string) Generator
// Output lets you specify the output schema, eg for unmarshalling reuslt into a struct.
Output(element any) Generator
// Tools lets you specifics a selection of tools that the ai may use
Tools(tool ...tools.Tool) Generator
// Tool lets you specifics which tool to use, eg, ai.NoTool, ai.AutoTool, ai.RequiredTool or a specific tool
Tool(tool tools.Tool) Generator
StopAt(stop ...string) Generator
Temperature(temperature float64) Generator
TopP(topP float64) Generator
MaxTokens(maxTokens int) Generator
Prompt(prompt ...prompt.Prompt) (Response, error)
}
type GeneratorOption ¶
func WithMaxTokens ¶
func WithMaxTokens(maxTokens int) GeneratorOption
func WithModel ¶
func WithModel(model GenModel) GeneratorOption
func WithOutput ¶
func WithOutput(element any) GeneratorOption
func WithStopAt ¶
func WithStopAt(stop ...string) GeneratorOption
func WithSystem ¶
func WithSystem(prompt string) GeneratorOption
func WithTemperature ¶
func WithTemperature(temperature float64) GeneratorOption
func WithTool ¶
func WithTool(tool tools.Tool) GeneratorOption
func WithTools ¶
func WithTools(tools ...tools.Tool) GeneratorOption
func WithTopP ¶
func WithTopP(topP float64) GeneratorOption
type LLM ¶
type LLM interface {
Generator(options ...GeneratorOption) Generator
}
type Response ¶
type Response interface {
// AsText will return the response as a string and an error if no response exist
// is the response is json, it will be present in this string
AsText() (string, error)
// AsTools will return the name of the tool to use, the argument to pass to the tool, in json format form specified schema, and an error if the response is not a tool
AsTools() ([]ToolCallback, error)
// Eval will run the callback associated with a tool response, otherwise it will return an error
Eval() (err error)
// Unmarshal will unmarshal the response into the provided reference
Unmarshal(ref any) error
}
type ToolCallback ¶
Click to show internal directories.
Click to hide internal directories.