Documentation
¶
Index ¶
- Variables
- func AutoCompact(ctx context.Context, client LLMClient, history []Message, sessionID string) ([]Message, *TokenUsage, error)
- func Build(workingDir, skillsCatalog, subagentsCatalog string, mode AgentMode) string
- func BuildAdversaryPrompt(workingDir string) string
- func BuildAutoCompactionPrompt() string
- func BuildBtwPrompt(workingDir string) string
- func BuildCompactionPrompt(extraPrompt string) string
- func FormatMessageForProvider(message Message) string
- func ProjectInstructions(workingDir string) string
- func ToGenkitTool(t tools.Tool) *ai.ToolDef[any, any]
- func ToGenkitTools(registry *tools.Registry) []ai.ToolRef
- type AgentMode
- type AnthropicClient
- type AutoCompactionEvent
- type BedrockClient
- type ClientConfig
- type ContextBreakdown
- type ContextMessage
- type ContextToolDef
- type GenkitClient
- type HistoricalToolActivity
- type LLMClient
- type Message
- type OpenAICodexClient
- type OpenAICompatibleClient
- type OpenAIResponsesClient
- type Provider
- type Role
- type StreamEvent
- type StreamEventType
- type StreamOptions
- type TokenUsage
- type ToolCall
- type TurnMemory
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrContextWindowExceeded = errors.New("context window exceeded")
Functions ¶
func AutoCompact ¶
func BuildAdversaryPrompt ¶
func BuildAutoCompactionPrompt ¶
func BuildAutoCompactionPrompt() string
func BuildBtwPrompt ¶
func BuildCompactionPrompt ¶
func ProjectInstructions ¶
Types ¶
type AnthropicClient ¶
type AnthropicClient struct {
// contains filtered or unexported fields
}
func NewAnthropicClient ¶
func NewAnthropicClient(cfg *ClientConfig) (*AnthropicClient, error)
func (*AnthropicClient) Reset ¶
func (c *AnthropicClient) Reset()
func (*AnthropicClient) StreamChat ¶
func (c *AnthropicClient) StreamChat( ctx context.Context, messages []Message, toolRegistry *tools.Registry, opts ...StreamOptions, ) (<-chan StreamEvent, error)
type AutoCompactionEvent ¶
type AutoCompactionEvent struct {
Cancel func()
Replacement []Message
Usage *TokenUsage
Error error
}
type BedrockClient ¶
type BedrockClient struct {
// contains filtered or unexported fields
}
func NewBedrockClient ¶
func NewBedrockClient(cfg *ClientConfig) (*BedrockClient, error)
func (*BedrockClient) Reset ¶
func (c *BedrockClient) Reset()
func (*BedrockClient) StreamChat ¶
func (c *BedrockClient) StreamChat( ctx context.Context, messages []Message, toolRegistry *tools.Registry, opts ...StreamOptions, ) (<-chan StreamEvent, error)
type ClientConfig ¶
type ContextBreakdown ¶
type ContextBreakdown struct {
SystemPromptTokens int
ToolDefinitionCount int
ToolDefTokens int
UserMessageTokens int
AssistantTokens int
ToolResultTokens int
TotalEstimated int
}
func EstimateContextBreakdown ¶
func EstimateContextBreakdown(systemPrompt string, toolDefs []ContextToolDef, messages []ContextMessage) ContextBreakdown
type ContextMessage ¶
type ContextMessage struct {
Role Role
Content string
ToolActivity []HistoricalToolActivity
}
type ContextToolDef ¶
type GenkitClient ¶
type GenkitClient struct {
// contains filtered or unexported fields
}
func NewGenkitClient ¶
func NewGenkitClient(cfg *ClientConfig) (*GenkitClient, error)
func (*GenkitClient) Reset ¶
func (c *GenkitClient) Reset()
func (*GenkitClient) StreamChat ¶
func (c *GenkitClient) StreamChat( ctx context.Context, messages []Message, toolRegistry *tools.Registry, opts ...StreamOptions, ) (<-chan StreamEvent, error)
type HistoricalToolActivity ¶
type HistoricalToolActivity struct {
TextOffset int `json:"text_offset"`
Tool string `json:"tool"`
Input map[string]any `json:"input,omitempty"`
Status string `json:"status"`
ExitCode *int `json:"exit_code,omitempty"`
HasRawOutput bool `json:"-"`
RawOutput any `json:"-"`
RetainedOutput any `json:"retained_output,omitempty"`
}
type LLMClient ¶
type LLMClient interface {
StreamChat(ctx context.Context, messages []Message, toolRegistry *tools.Registry, opts ...StreamOptions) (<-chan StreamEvent, error)
Reset()
}
type Message ¶
type Message struct {
Role Role
Content string
TurnMemory *TurnMemory
}
func BuildCompactionRequest ¶
func CloneMessage ¶
func CloneMessages ¶
type OpenAICodexClient ¶
type OpenAICodexClient struct {
// contains filtered or unexported fields
}
func NewOpenAICodexClient ¶
func NewOpenAICodexClient(cfg *ClientConfig) (*OpenAICodexClient, error)
func (*OpenAICodexClient) Reset ¶
func (c *OpenAICodexClient) Reset()
func (*OpenAICodexClient) StreamChat ¶
func (c *OpenAICodexClient) StreamChat(ctx context.Context, messages []Message, toolRegistry *tools.Registry, opts ...StreamOptions) (<-chan StreamEvent, error)
type OpenAICompatibleClient ¶
type OpenAICompatibleClient struct {
// contains filtered or unexported fields
}
func NewOpenAICompatibleClient ¶
func NewOpenAICompatibleClient(cfg *ClientConfig) (*OpenAICompatibleClient, error)
func (*OpenAICompatibleClient) Reset ¶
func (c *OpenAICompatibleClient) Reset()
func (*OpenAICompatibleClient) StreamChat ¶
func (c *OpenAICompatibleClient) StreamChat( ctx context.Context, messages []Message, toolRegistry *tools.Registry, opts ...StreamOptions, ) (<-chan StreamEvent, error)
type OpenAIResponsesClient ¶
type OpenAIResponsesClient struct {
// contains filtered or unexported fields
}
func NewOpenAIResponsesClient ¶
func NewOpenAIResponsesClient(cfg *ClientConfig) (*OpenAIResponsesClient, error)
func (*OpenAIResponsesClient) Reset ¶
func (c *OpenAIResponsesClient) Reset()
func (*OpenAIResponsesClient) StreamChat ¶
func (c *OpenAIResponsesClient) StreamChat( ctx context.Context, messages []Message, toolRegistry *tools.Registry, opts ...StreamOptions, ) (<-chan StreamEvent, error)
type StreamEvent ¶
type StreamEvent struct {
Type StreamEventType
Content string
Error error
ToolCall *ToolCall
Usage *TokenUsage
Attempt int
AutoCompaction *AutoCompactionEvent
}
type StreamEventType ¶
type StreamEventType string
const ( StreamEventTypeChunk StreamEventType = "chunk" StreamEventTypeReasoningChunk StreamEventType = "reasoning_chunk" StreamEventTypeDone StreamEventType = "done" StreamEventTypeError StreamEventType = "error" StreamEventTypeToolStart StreamEventType = "tool_start" StreamEventTypeToolEnd StreamEventType = "tool_end" StreamEventTypeUsage StreamEventType = "usage" StreamEventTypeRetry StreamEventType = "retry" StreamEventTypeIncomplete StreamEventType = "incomplete" StreamEventTypeAutoCompactionStarted StreamEventType = "auto_compaction_started" StreamEventTypeAutoCompactionApplied StreamEventType = "auto_compaction_applied" StreamEventTypeAutoCompactionCancelled StreamEventType = "auto_compaction_cancelled" StreamEventTypeAutoCompactionFailed StreamEventType = "auto_compaction_failed" )
type StreamOptions ¶
type TokenUsage ¶
type TurnMemory ¶
type TurnMemory struct {
ToolActivity []HistoricalToolActivity `json:"tool_activity,omitempty"`
}
func CloneTurnMemory ¶
func CloneTurnMemory(memory *TurnMemory) *TurnMemory
func (*TurnMemory) IsEmpty ¶
func (m *TurnMemory) IsEmpty() bool
Click to show internal directories.
Click to hide internal directories.