Documentation
¶
Index ¶
- func GenerateStrictJSONSchema(t reflect.Type) map[string]interface{}
- type AgentConfigUpdate
- type AgentHandoff
- type AudioContent
- type ChatChunk
- type ChatContent
- type ChatContext
- func (c *ChatContext) Append(item ChatItem)
- func (c *ChatContext) Copy() *ChatContext
- func (c *ChatContext) FindInsertionIndex(createdAt time.Time) int
- func (c *ChatContext) Merge(other *ChatContext)
- func (c *ChatContext) Messages() []*ChatMessage
- func (c *ChatContext) ToProviderFormat(format string) ([]map[string]any, any)
- func (c *ChatContext) Truncate(maxItems int)
- type ChatItem
- type ChatMessage
- type ChatOption
- type ChatOptions
- type ChatRole
- type ChoiceDelta
- type CompletionUsage
- type DiffOps
- type FallbackAdapter
- type FunctionCall
- type FunctionCallOutput
- type FunctionToolCall
- type ImageContent
- type LLM
- type LLMStream
- type MCPServer
- type MCPServerHTTP
- type MCPServerStdio
- type MetricsReport
- type RealtimeCapabilities
- type RealtimeEvent
- type RealtimeEventType
- type RealtimeModel
- type RealtimeSession
- type RemoteChatContext
- type Tool
- type ToolChoice
- type ToolContext
- func (c *ToolContext) Copy() *ToolContext
- func (c *ToolContext) Flatten() []Tool
- func (c *ToolContext) FunctionTools() map[string]Tool
- func (c *ToolContext) GetFunctionTool(name string) Tool
- func (c *ToolContext) ProviderTools() []Tool
- func (c *ToolContext) Toolsets() []Toolset
- func (c *ToolContext) UpdateTools(tools []interface{}) error
- type Toolset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateStrictJSONSchema ¶
GenerateStrictJSONSchema inspects a Go function or struct to generate an OpenAI-compatible "strict" JSON schema. It enforces additionalProperties: false and makes all fields required by default, unless optional tags are provided.
Types ¶
type AgentConfigUpdate ¶
type AgentConfigUpdate struct {
ID string
Instructions *string
ToolsAdded []string
ToolsRemoved []string
CreatedAt time.Time
}
func (*AgentConfigUpdate) GetCreatedAt ¶
func (a *AgentConfigUpdate) GetCreatedAt() time.Time
func (*AgentConfigUpdate) GetID ¶
func (a *AgentConfigUpdate) GetID() string
func (*AgentConfigUpdate) GetType ¶
func (a *AgentConfigUpdate) GetType() string
type AgentHandoff ¶
func (*AgentHandoff) GetCreatedAt ¶
func (a *AgentHandoff) GetCreatedAt() time.Time
func (*AgentHandoff) GetID ¶
func (a *AgentHandoff) GetID() string
func (*AgentHandoff) GetType ¶
func (a *AgentHandoff) GetType() string
type AudioContent ¶
type ChatChunk ¶
type ChatChunk struct {
ID string
Delta *ChoiceDelta
Usage *CompletionUsage
}
type ChatContent ¶
type ChatContent struct {
Text string
Image *ImageContent
Audio *AudioContent
}
type ChatContext ¶
type ChatContext struct {
Items []ChatItem
}
func NewChatContext ¶
func NewChatContext() *ChatContext
func (*ChatContext) Append ¶
func (c *ChatContext) Append(item ChatItem)
func (*ChatContext) Copy ¶
func (c *ChatContext) Copy() *ChatContext
func (*ChatContext) FindInsertionIndex ¶
func (c *ChatContext) FindInsertionIndex(createdAt time.Time) int
func (*ChatContext) Merge ¶
func (c *ChatContext) Merge(other *ChatContext)
func (*ChatContext) Messages ¶
func (c *ChatContext) Messages() []*ChatMessage
func (*ChatContext) ToProviderFormat ¶
func (c *ChatContext) ToProviderFormat(format string) ([]map[string]any, any)
func (*ChatContext) Truncate ¶
func (c *ChatContext) Truncate(maxItems int)
type ChatMessage ¶
type ChatMessage struct {
ID string
Role ChatRole
Content []ChatContent
Interrupted bool
TranscriptConfidence *float64
Extra map[string]any
CreatedAt time.Time
}
func (*ChatMessage) GetCreatedAt ¶
func (m *ChatMessage) GetCreatedAt() time.Time
func (*ChatMessage) GetID ¶
func (m *ChatMessage) GetID() string
func (*ChatMessage) GetType ¶
func (m *ChatMessage) GetType() string
func (*ChatMessage) TextContent ¶
func (m *ChatMessage) TextContent() string
type ChatOption ¶
type ChatOption func(*ChatOptions)
func WithParallelToolCalls ¶
func WithParallelToolCalls(parallel bool) ChatOption
func WithToolChoice ¶
func WithToolChoice(choice ToolChoice) ChatOption
func WithTools ¶
func WithTools(tools []Tool) ChatOption
type ChatOptions ¶
type ChatOptions struct {
Tools []Tool
ToolChoice ToolChoice
ParallelToolCalls bool
}
type ChoiceDelta ¶
type ChoiceDelta struct {
Role ChatRole
Content string
ToolCalls []FunctionToolCall
Extra map[string]any
}
type CompletionUsage ¶
type DiffOps ¶
type DiffOps struct {
ToRemove []string
ToCreate [][2]*string // [previous_item_id, id]
ToUpdate [][2]*string // [previous_item_id, id]
}
func ComputeChatCtxDiff ¶
func ComputeChatCtxDiff(oldCtx, newCtx *ChatContext) *DiffOps
type FallbackAdapter ¶
type FallbackAdapter struct {
// contains filtered or unexported fields
}
func NewFallbackAdapter ¶
func NewFallbackAdapter(llms []LLM) *FallbackAdapter
func (*FallbackAdapter) Chat ¶
func (f *FallbackAdapter) Chat(ctx context.Context, chatCtx *ChatContext, opts ...ChatOption) (LLMStream, error)
type FunctionCall ¶
type FunctionCall struct {
ID string
CallID string
Name string
Arguments string
Extra map[string]any
GroupID *string
CreatedAt time.Time
}
func (*FunctionCall) GetCreatedAt ¶
func (f *FunctionCall) GetCreatedAt() time.Time
func (*FunctionCall) GetID ¶
func (f *FunctionCall) GetID() string
func (*FunctionCall) GetType ¶
func (f *FunctionCall) GetType() string
type FunctionCallOutput ¶
type FunctionCallOutput struct {
ID string
CallID string
Name string
Output string
IsError bool
CreatedAt time.Time
}
func (*FunctionCallOutput) GetCreatedAt ¶
func (f *FunctionCallOutput) GetCreatedAt() time.Time
func (*FunctionCallOutput) GetID ¶
func (f *FunctionCallOutput) GetID() string
func (*FunctionCallOutput) GetType ¶
func (f *FunctionCallOutput) GetType() string
type FunctionToolCall ¶
type ImageContent ¶
type LLM ¶
type LLM interface {
Chat(ctx context.Context, chatCtx *ChatContext, opts ...ChatOption) (LLMStream, error)
}
type MCPServerHTTP ¶
type MCPServerHTTP struct {
URL string
TransportType string
AllowedTools []string
Headers map[string]string
}
func NewMCPServerHTTP ¶
func NewMCPServerHTTP(url string) *MCPServerHTTP
func (*MCPServerHTTP) Close ¶
func (s *MCPServerHTTP) Close() error
func (*MCPServerHTTP) Initialize ¶
func (s *MCPServerHTTP) Initialize(ctx context.Context) error
type MCPServerStdio ¶
type MCPServerStdio struct {
Command string
Args []string
Env map[string]string
Cwd string
// contains filtered or unexported fields
}
func NewMCPServerStdio ¶
func NewMCPServerStdio(command string, args []string) *MCPServerStdio
func (*MCPServerStdio) Close ¶
func (s *MCPServerStdio) Close() error
func (*MCPServerStdio) Initialize ¶
func (s *MCPServerStdio) Initialize(ctx context.Context) error
type MetricsReport ¶
type MetricsReport struct {
Usage telemetry.UsageSummary
CreatedAt time.Time
}
func (*MetricsReport) GetCreatedAt ¶
func (m *MetricsReport) GetCreatedAt() time.Time
func (*MetricsReport) GetID ¶
func (m *MetricsReport) GetID() string
func (*MetricsReport) GetType ¶
func (m *MetricsReport) GetType() string
type RealtimeCapabilities ¶
type RealtimeEvent ¶
type RealtimeEvent struct {
Type RealtimeEventType
Data []byte // For audio frames
Text string // For text deltas
Function *FunctionToolCall
Error error
}
type RealtimeEventType ¶
type RealtimeEventType string
const ( RealtimeEventTypeAudio RealtimeEventType = "audio" RealtimeEventTypeText RealtimeEventType = "text" RealtimeEventTypeFunctionCall RealtimeEventType = "function_call" RealtimeEventTypeSpeechStarted RealtimeEventType = "speech_started" RealtimeEventTypeSpeechStopped RealtimeEventType = "speech_stopped" RealtimeEventTypeError RealtimeEventType = "error" )
type RealtimeModel ¶
type RealtimeModel interface {
Session() (RealtimeSession, error)
Close() error
}
type RealtimeSession ¶
type RealtimeSession interface {
UpdateInstructions(instructions string) error
UpdateChatContext(chatCtx *ChatContext) error
UpdateTools(tools []Tool) error
Interrupt() error
Close() error
EventCh() <-chan RealtimeEvent
PushAudio(frame *model.AudioFrame) error
}
type RemoteChatContext ¶
type RemoteChatContext struct {
// contains filtered or unexported fields
}
func NewRemoteChatContext ¶
func NewRemoteChatContext() *RemoteChatContext
func (*RemoteChatContext) Delete ¶
func (c *RemoteChatContext) Delete(itemID string) error
func (*RemoteChatContext) Get ¶
func (c *RemoteChatContext) Get(itemID string) ChatItem
func (*RemoteChatContext) Insert ¶
func (c *RemoteChatContext) Insert(previousItemID *string, message ChatItem) error
func (*RemoteChatContext) ToChatCtx ¶
func (c *RemoteChatContext) ToChatCtx() *ChatContext
type ToolChoice ¶
type ToolChoice any
type ToolContext ¶
type ToolContext struct {
// contains filtered or unexported fields
}
func EmptyToolContext ¶
func EmptyToolContext() *ToolContext
func NewToolContext ¶
func NewToolContext(tools []interface{}) *ToolContext
func (*ToolContext) Copy ¶
func (c *ToolContext) Copy() *ToolContext
func (*ToolContext) Flatten ¶
func (c *ToolContext) Flatten() []Tool
func (*ToolContext) FunctionTools ¶
func (c *ToolContext) FunctionTools() map[string]Tool
func (*ToolContext) GetFunctionTool ¶
func (c *ToolContext) GetFunctionTool(name string) Tool
func (*ToolContext) ProviderTools ¶
func (c *ToolContext) ProviderTools() []Tool
func (*ToolContext) Toolsets ¶
func (c *ToolContext) Toolsets() []Toolset
func (*ToolContext) UpdateTools ¶
func (c *ToolContext) UpdateTools(tools []interface{}) error
Click to show internal directories.
Click to hide internal directories.