Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶ added in v1.0.4
type Agent interface {
// Enumerate the tools available
Tools() []Tool
// Run a tool with parameters and return the result
Run(context.Context, string, any) (any, error)
}
An agent is a collection of tools that can be called
type Content ¶ added in v1.0.2
type Content struct {
Id string `json:"id,omitempty"`
Type string `json:"type" writer:",width:4"`
Text string `json:"text,omitempty" writer:",width:60,wrap"`
Source *contentSource `json:"source,omitempty"`
ToolId string `json:"tool_use_id,omitempty"`
Result string `json:"content,omitempty"`
// contains filtered or unexported fields
}
Message Content
func ToolResult ¶ added in v1.0.3
Return a tool result
type Embeddings ¶
type Embeddings struct {
Id string `json:"id" writer:",width:32"`
Data []Embedding `json:"data" writer:",wrap"`
Model string `json:"model"`
Usage struct {
PromptTokerns int `json:"prompt_tokens"`
TotalTokens int `json:"total_tokens"`
} `json:"usage" writer:",wrap"`
}
An set of created embeddings
type Message ¶
type Message struct {
// user, system or assistant
Role string `json:"role,omitempty"`
// Message Id
Id string `json:"id,omitempty"`
// Model
Model string `json:"model,omitempty"`
// Content can be a string, array of strings, content
// object or an array of content objects
Content any `json:"content,omitempty"`
// Time the message was created, in unix seconds
Created int64 `json:"created,omitempty"`
}
A chat completion message
func NewMessage ¶ added in v1.0.2
Create a new message, with optional content
type MessageChoice ¶
type MessageChoice struct {
Message *Message `json:"message,omitempty"`
Delta *MessageDelta `json:"delta,omitempty"`
Index int `json:"index"`
FinishReason string `json:"finish_reason,omitempty"`
}
One choice of chat completion messages
func (MessageChoice) String ¶ added in v1.0.4
func (m MessageChoice) String() string
type MessageDelta ¶ added in v1.0.4
type MessageDelta struct {
Role string `json:"role,omitempty"`
Content string `json:"content,omitempty"`
}
Delta between messages (for streaming responses)
func (MessageDelta) String ¶ added in v1.0.4
func (m MessageDelta) String() string
type Model ¶
type Model struct {
Id string `json:"id" writer:",width:30"`
Created int64 `json:"created,omitempty"`
Owner string `json:"owned_by,omitempty"`
}
A model object
Click to show internal directories.
Click to hide internal directories.