Documentation
¶
Index ¶
- func DefaultPaths() (user, project string, err error)
- func HistoryPath() (string, error)
- func ResolveValue(value string) (string, error)
- type API
- type Agent
- type Client
- func (c *Client) AgentForPrompt(prompt string) string
- func (c *Client) Chat(ctx context.Context, request Request) (Response, error)
- func (c *Client) ChatStream(ctx context.Context, request Request) (<-chan StreamEvent, error)
- func (c *Client) Complete(ctx context.Context, request Request) (Response, error)
- func (c *Client) GenerateTitle(ctx context.Context, message string) (string, error)
- func (c *Client) SupportsTools(agentID string) bool
- func (c *Client) TitleAgentID() string
- type Config
- type Conversation
- type History
- func (h *History) AppendMessage(ctx context.Context, connectionID, conversationID string, message Message) error
- func (h *History) Clear(ctx context.Context, connectionID string) error
- func (h *History) Close() error
- func (h *History) Conversations(ctx context.Context, connectionID string) ([]Conversation, error)
- func (h *History) DeleteConversation(ctx context.Context, connectionID, conversationID string) error
- func (h *History) Messages(ctx context.Context, connectionID, conversationID string) ([]Message, error)
- func (h *History) NewConversation(ctx context.Context, connectionID, title string) (Conversation, error)
- func (h *History) RenameConversation(ctx context.Context, connectionID, conversationID, title string) error
- type Message
- type Provider
- type Request
- type Response
- type Role
- type StreamEvent
- type StreamEventKind
- type ToolCall
- type ToolDefinition
- type ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPaths ¶
func HistoryPath ¶
func ResolveValue ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AgentForPrompt ¶
func (*Client) ChatStream ¶
ChatStream sends a streaming chat request, returning a channel of StreamEvents. The channel is safe to read until closed.
func (*Client) Complete ¶
Complete sends a non-streaming chat request with optional tool definitions and returns the parsed turn (text + tool calls). Provider-specific wire translation is handled per adapter.
func (*Client) GenerateTitle ¶
GenerateTitle asks the cheap agent to summarize a first user message into a short conversation title.
func (*Client) SupportsTools ¶
SupportsTools reports whether the given agent's provider supports function calling.
func (*Client) TitleAgentID ¶
TitleAgentID returns the cheap agent used for auxiliary calls such as conversation titles: spark when configured, otherwise assistant.
type Config ¶
type Conversation ¶
type History ¶
type History struct {
// contains filtered or unexported fields
}
func OpenHistory ¶
func (*History) AppendMessage ¶
func (h *History) AppendMessage(ctx context.Context, connectionID, conversationID string, message Message) error
AppendMessage inserts only through a scope-checked parent conversation, so a wrong connection scope is a silent no-op instead of a cross-scope write.
func (*History) Conversations ¶
func (*History) DeleteConversation ¶
func (*History) NewConversation ¶
type Request ¶
type Request struct {
AgentID string
Messages []Message
Context string
Tools []ToolDefinition
}
type StreamEvent ¶
type StreamEvent struct {
Kind StreamEventKind
Delta string // incremental content token (empty for terminal events)
Response *Response // non-nil on successful completion (carries Agent + full Content)
Err error // non-nil on error
ToolCall ToolCall // populated when Kind is EventToolCall
}
StreamEvent is an event on the channel returned by ChatStream.
type StreamEventKind ¶
type StreamEventKind string
const ( EventDelta StreamEventKind = "delta" EventDone StreamEventKind = "done" EventToolCall StreamEventKind = "tool_call" )
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Input map[string]any `json:"input"`
}
ToolCall represents a tool invocation requested by the AI.