Documentation
¶
Index ¶
- type ApprovalAction
- type CancelledEvent
- type ChatChunkEvent
- type ChatCompleteEvent
- type ChatErrorEvent
- type ChatEvent
- type ChatEventType
- type ChatMetrics
- type ChatService
- type ChatStartEvent
- type ConversationEntry
- type ConversationRepository
- type ExportFormat
- type FetchResult
- type FetchService
- type FileInfo
- type FileService
- type ModelService
- type ToolCallEvent
- type ToolDefinition
- type ToolService
- type WebSearchResponse
- type WebSearchResult
- type WebSearchService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalAction ¶
type ApprovalAction int
ApprovalAction defines the possible approval actions for tool calls
const ( ApprovalApprove ApprovalAction = iota // Approve and execute ApprovalReject // Deny and cancel )
type CancelledEvent ¶
CancelledEvent indicates a request was cancelled
func (CancelledEvent) GetRequestID ¶
func (e CancelledEvent) GetRequestID() string
func (CancelledEvent) GetTimestamp ¶
func (e CancelledEvent) GetTimestamp() time.Time
func (CancelledEvent) GetType ¶
func (e CancelledEvent) GetType() ChatEventType
type ChatChunkEvent ¶
type ChatChunkEvent struct {
RequestID string
Timestamp time.Time
Content string
ToolCalls []sdk.ChatCompletionMessageToolCall
Delta bool
}
ChatChunkEvent represents a streaming chunk of chat response
func (ChatChunkEvent) GetRequestID ¶
func (e ChatChunkEvent) GetRequestID() string
func (ChatChunkEvent) GetTimestamp ¶
func (e ChatChunkEvent) GetTimestamp() time.Time
func (ChatChunkEvent) GetType ¶
func (e ChatChunkEvent) GetType() ChatEventType
type ChatCompleteEvent ¶
type ChatCompleteEvent struct {
RequestID string
Timestamp time.Time
Message string
ToolCalls []sdk.ChatCompletionMessageToolCall
Metrics *ChatMetrics
}
ChatCompleteEvent indicates chat completion
func (ChatCompleteEvent) GetRequestID ¶
func (e ChatCompleteEvent) GetRequestID() string
func (ChatCompleteEvent) GetTimestamp ¶
func (e ChatCompleteEvent) GetTimestamp() time.Time
func (ChatCompleteEvent) GetType ¶
func (e ChatCompleteEvent) GetType() ChatEventType
type ChatErrorEvent ¶
ChatErrorEvent represents an error during chat
func (ChatErrorEvent) GetRequestID ¶
func (e ChatErrorEvent) GetRequestID() string
func (ChatErrorEvent) GetTimestamp ¶
func (e ChatErrorEvent) GetTimestamp() time.Time
func (ChatErrorEvent) GetType ¶
func (e ChatErrorEvent) GetType() ChatEventType
type ChatEvent ¶
type ChatEvent interface {
GetType() ChatEventType
GetRequestID() string
GetTimestamp() time.Time
}
ChatEvent represents events during chat operations
type ChatEventType ¶
type ChatEventType int
ChatEventType defines types of chat events
const ( EventChatStart ChatEventType = iota EventChatChunk EventChatComplete EventChatError EventToolCall EventCancelled )
type ChatMetrics ¶
type ChatMetrics struct {
Duration time.Duration
Usage *sdk.CompletionUsage
}
ChatMetrics holds performance and usage metrics
type ChatService ¶
type ChatService interface {
SendMessage(ctx context.Context, model string, messages []sdk.Message) (<-chan ChatEvent, error)
CancelRequest(requestID string) error
GetMetrics(requestID string) *ChatMetrics
}
ChatService handles chat completion operations
type ChatStartEvent ¶
ChatStartEvent indicates a chat request has started
func (ChatStartEvent) GetRequestID ¶
func (e ChatStartEvent) GetRequestID() string
func (ChatStartEvent) GetTimestamp ¶
func (e ChatStartEvent) GetTimestamp() time.Time
func (ChatStartEvent) GetType ¶
func (e ChatStartEvent) GetType() ChatEventType
type ConversationEntry ¶
type ConversationEntry struct {
Message sdk.Message `json:"message"`
Model string `json:"model,omitempty"`
Time time.Time `json:"time"`
}
ConversationEntry represents a message in the conversation with metadata
type ConversationRepository ¶
type ConversationRepository interface {
AddMessage(msg ConversationEntry) error
GetMessages() []ConversationEntry
Clear() error
Export(format ExportFormat) ([]byte, error)
GetMessageCount() int
UpdateLastMessage(content string) error
UpdateLastMessageToolCalls(toolCalls *[]sdk.ChatCompletionMessageToolCall) error
}
ConversationRepository handles conversation storage and retrieval
type ExportFormat ¶
type ExportFormat string
ExportFormat defines the format for exporting conversations
const ( ExportMarkdown ExportFormat = "markdown" ExportJSON ExportFormat = "json" ExportText ExportFormat = "text" )
type FetchResult ¶ added in v0.11.0
type FetchResult struct {
Content string `json:"content"`
URL string `json:"url"`
Status int `json:"status"`
Size int64 `json:"size"`
ContentType string `json:"content_type"`
Cached bool `json:"cached"`
Metadata map[string]string `json:"metadata,omitempty"`
}
FetchResult represents the result of a fetch operation
type FetchService ¶ added in v0.11.0
type FetchService interface {
ValidateURL(url string) error
FetchContent(ctx context.Context, target string) (*FetchResult, error)
ClearCache()
GetCacheStats() map[string]interface{}
}
FetchService handles content fetching operations
type FileService ¶
type FileService interface {
ListProjectFiles() ([]string, error)
ReadFile(path string) (string, error)
ReadFileLines(path string, startLine, endLine int) (string, error)
ValidateFile(path string) error
GetFileInfo(path string) (FileInfo, error)
}
FileService handles file operations
type ModelService ¶
type ModelService interface {
ListModels(ctx context.Context) ([]string, error)
SelectModel(modelID string) error
GetCurrentModel() string
IsModelAvailable(modelID string) bool
ValidateModel(modelID string) error
}
ModelService handles model selection and information
type ToolCallEvent ¶
ToolCallEvent represents a tool call request
func (ToolCallEvent) GetRequestID ¶
func (e ToolCallEvent) GetRequestID() string
func (ToolCallEvent) GetTimestamp ¶
func (e ToolCallEvent) GetTimestamp() time.Time
func (ToolCallEvent) GetType ¶
func (e ToolCallEvent) GetType() ChatEventType
type ToolDefinition ¶
type ToolDefinition struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters interface{} `json:"parameters"`
}
ToolDefinition describes an available tool
type ToolService ¶
type ToolService interface {
ListTools() []ToolDefinition
ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (string, error)
IsToolEnabled(name string) bool
ValidateTool(name string, args map[string]interface{}) error
}
ToolService handles tool execution
type WebSearchResponse ¶ added in v0.13.0
type WebSearchResponse struct {
Query string `json:"query"`
Engine string `json:"engine"`
Results []WebSearchResult `json:"results"`
Total int `json:"total"`
Time time.Duration `json:"time"`
Error string `json:"error,omitempty"`
}
WebSearchResponse represents the complete search response
type WebSearchResult ¶ added in v0.13.0
type WebSearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet"`
}
WebSearchResult represents a single search result
type WebSearchService ¶ added in v0.13.0
type WebSearchService interface {
SearchGoogle(ctx context.Context, query string, maxResults int) (*WebSearchResponse, error)
SearchDuckDuckGo(ctx context.Context, query string, maxResults int) (*WebSearchResponse, error)
IsEnabled() bool
SetEnabled(enabled bool)
}
WebSearchService handles web search operations