Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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"`
Url *contentImage `json:"image_url,omitempty"`
// Tool Result
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"`
// Any tool calls
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
// Tool Call Id
ToolCallId string `json:"tool_call_id,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 MessageChunk ¶ added in v1.0.5
type MessageChunk struct {
Id string `json:"id,omitempty"`
Model string `json:"model,omitempty"`
Created int64 `json:"created,omitempty"`
SystemFingerprint string `json:"system_fingerprint,omitempty"`
TokenUsage *TokenUsage `json:"usage,omitempty"`
Choices []MessageChoice `json:"choices,omitempty"`
}
Chat completion chunk
func (MessageChunk) String ¶ added in v1.0.5
func (m MessageChunk) 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
type TokenUsage ¶ added in v1.0.5
type TokenUsage struct {
PromptTokens int `json:"prompt_tokens,omitempty"`
CompletionTokens int `json:"completion_tokens,omitempty"`
TotalTokens int `json:"total_tokens,omitempty"`
}
Token usage
type Tool ¶ added in v1.0.2
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type,omitempty"`
Parameters *toolParameters `json:"parameters,omitempty"` // Used by OpenAI, Mistral
InputSchema *toolParameters `json:"input_schema,omitempty"` // Used by anthropic
}
A tool function
type ToolCall ¶ added in v1.0.5
type ToolCall struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Function ToolFunction `json:"function,omitempty"`
}
Tool Call
type ToolFunction ¶ added in v1.0.5
type ToolFunction struct {
Name string `json:"name,omitempty"`
Arguments string `json:"arguments,omitempty"`
}
Tool Function and Arguments
Click to show internal directories.
Click to hide internal directories.