Documentation
¶
Index ¶
- func WithIncludeIntermediateMessages(include bool) func(*StreamConfig)
- type AgentEventType
- type AgentStreamEvent
- type AgentTaskServiceInterface
- type CollectionRef
- type DataStore
- type DeleteOption
- type DeleteOptions
- type Document
- type Embedder
- type GenerateOption
- func WithFrequencyPenalty(frequencyPenalty float64) GenerateOption
- func WithMaxIterations(maxIterations int) GenerateOption
- func WithMemory(memory Memory) GenerateOption
- func WithPresencePenalty(presencePenalty float64) GenerateOption
- func WithReasoning(enabled bool, budget ...int) GenerateOption
- func WithResponseFormat(format ResponseFormat) GenerateOption
- func WithStopSequences(stopSequences []string) GenerateOption
- func WithStreamConfig(config StreamConfig) GenerateOption
- func WithSystemMessage(systemMessage string) GenerateOption
- func WithTemperature(temperature float64) GenerateOption
- func WithTopP(topP float64) GenerateOption
- type GenerateOptions
- type GetMessagesOption
- type GetMessagesOptions
- type Guardrails
- type InternalTool
- type JSONSchema
- type LLM
- type LLMConfig
- type MCPServer
- type MCPTool
- type MCPToolResponse
- type Memory
- type Message
- type MessageRole
- type ParameterSpec
- type QueryOption
- type QueryOptions
- type ResponseFormat
- type ResponseFormatType
- type RetryPolicy
- type SearchOption
- func WithBM25(useBM25 bool) SearchOption
- func WithEmbedding(useEmbedding bool) SearchOption
- func WithFields(fields ...string) SearchOption
- func WithFilters(filters map[string]interface{}) SearchOption
- func WithKeyword(useKeyword bool) SearchOption
- func WithMinScore(score float32) SearchOption
- func WithNearText(useNearText bool) SearchOption
- func WithTenantSearch(tenant string) SearchOption
- type SearchOptions
- type SearchResult
- type Span
- type StoreOption
- type StoreOptions
- type StreamConfig
- type StreamEvent
- type StreamEventType
- type StreamingAgent
- type StreamingLLM
- type TaskExecutor
- type TaskOptions
- type TaskPlanner
- type TaskResult
- type TaskService
- type Tool
- type ToolCall
- type ToolCallEvent
- type ToolRegistry
- type ToolWithDisplayName
- type Tracer
- type Transaction
- type VectorStore
- type VectorStoreConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithIncludeIntermediateMessages ¶
func WithIncludeIntermediateMessages(include bool) func(*StreamConfig)
WithIncludeIntermediateMessages returns a StreamConfig option to include intermediate messages
Types ¶
type AgentEventType ¶
type AgentEventType string
AgentEventType represents the type of agent streaming event
const ( AgentEventContent AgentEventType = "content" AgentEventThinking AgentEventType = "thinking" AgentEventToolCall AgentEventType = "tool_call" AgentEventToolResult AgentEventType = "tool_result" AgentEventError AgentEventType = "error" AgentEventComplete AgentEventType = "complete" )
type AgentStreamEvent ¶
type AgentStreamEvent struct {
Type AgentEventType `json:"type"`
Content string `json:"content,omitempty"`
ToolCall *ToolCallEvent `json:"tool_call,omitempty"`
ThinkingStep string `json:"thinking_step,omitempty"`
Error error `json:"error,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
AgentStreamEvent represents a streaming event from an agent
type AgentTaskServiceInterface ¶
type AgentTaskServiceInterface[AgentTask any, AgentCreateRequest any, AgentApproveRequest any, AgentTaskUpdate any] interface { // CreateTask creates a new task CreateTask(ctx context.Context, req AgentCreateRequest) (AgentTask, error) // GetTask gets a task by ID GetTask(ctx context.Context, taskID string) (AgentTask, error) // ListTasks returns all tasks for a user ListTasks(ctx context.Context, userID string) ([]AgentTask, error) // ApproveTaskPlan approves or rejects a task plan ApproveTaskPlan(ctx context.Context, taskID string, req AgentApproveRequest) (AgentTask, error) // UpdateTask updates an existing task with new steps or modifications UpdateTask(ctx context.Context, taskID string, conversationID string, updates []AgentTaskUpdate) (AgentTask, error) // AddTaskLog adds a log entry to a task AddTaskLog(ctx context.Context, taskID string, message string, level string) error }
AgentTaskServiceInterface is a generic interface for agent task services
type CollectionRef ¶
type CollectionRef interface {
// Insert inserts a document into the collection
Insert(ctx context.Context, data map[string]interface{}) (string, error)
// Get retrieves a document by ID
Get(ctx context.Context, id string) (map[string]interface{}, error)
// Update updates a document by ID
Update(ctx context.Context, id string, data map[string]interface{}) error
// Delete deletes a document by ID
Delete(ctx context.Context, id string) error
// Query queries documents in the collection
Query(ctx context.Context, filter map[string]interface{}, options ...QueryOption) ([]map[string]interface{}, error)
}
CollectionRef represents a reference to a collection/table
type DataStore ¶
type DataStore interface {
// Collection returns a reference to a specific collection/table
Collection(name string) CollectionRef
// Transaction executes multiple operations in a transaction
Transaction(ctx context.Context, fn func(tx Transaction) error) error
// Close closes the database connection
Close() error
}
DataStore represents a database for storing structured data
type DeleteOption ¶
type DeleteOption func(*DeleteOptions)
DeleteOption represents an option for deleting documents
func WithTenantDelete ¶
func WithTenantDelete(tenant string) DeleteOption
WithTenantDelete sets the tenant for native multi-tenancy delete operations
type DeleteOptions ¶
type DeleteOptions struct {
// Class is the class/collection name to delete from
Class string
// Tenant is the tenant name for native multi-tenancy
Tenant string
}
DeleteOptions contains options for deleting documents
type Document ¶
type Document struct {
// ID is the unique identifier for the document
ID string
// Content is the text content of the document
Content string
// Vector is the embedding vector for the document
// If nil, the vector store will generate it
Vector []float32
// Metadata contains additional information about the document
Metadata map[string]interface{}
}
Document represents a document to be stored in a vector store
type Embedder ¶
type Embedder interface {
// Embed generates an embedding for the given text
Embed(ctx context.Context, text string) ([]float32, error)
// EmbedBatch generates embeddings for multiple texts
EmbedBatch(ctx context.Context, texts []string) ([][]float32, error)
// CalculateSimilarity calculates the similarity between two embeddings
CalculateSimilarity(vec1, vec2 []float32, metric string) (float32, error)
}
Embedder represents a service that can convert text into embeddings
type GenerateOption ¶
type GenerateOption func(options *GenerateOptions)
GenerateOption represents options for text generation
func WithFrequencyPenalty ¶
func WithFrequencyPenalty(frequencyPenalty float64) GenerateOption
WithFrequencyPenalty creates a GenerateOption to set the frequency penalty
func WithMaxIterations ¶
func WithMaxIterations(maxIterations int) GenerateOption
WithMaxIterations creates a GenerateOption to set the maximum number of tool-calling iterations
func WithMemory ¶
func WithMemory(memory Memory) GenerateOption
WithMemory creates a GenerateOption to set the memory for storing tool calls and results
func WithPresencePenalty ¶
func WithPresencePenalty(presencePenalty float64) GenerateOption
WithPresencePenalty creates a GenerateOption to set the presence penalty
func WithReasoning ¶
func WithReasoning(enabled bool, budget ...int) GenerateOption
WithReasoning creates a GenerateOption to enable native reasoning tokens
func WithResponseFormat ¶
func WithResponseFormat(format ResponseFormat) GenerateOption
WithResponseFormat creates a GenerateOption to set the response format
func WithStopSequences ¶
func WithStopSequences(stopSequences []string) GenerateOption
WithStopSequences creates a GenerateOption to set the stop sequences
func WithStreamConfig ¶
func WithStreamConfig(config StreamConfig) GenerateOption
WithStreamConfig creates a GenerateOption to set the streaming configuration
func WithSystemMessage ¶
func WithSystemMessage(systemMessage string) GenerateOption
WithSystemMessage creates a GenerateOption to set the system message
func WithTemperature ¶
func WithTemperature(temperature float64) GenerateOption
WithTemperature creates a GenerateOption to set the temperature
func WithTopP ¶
func WithTopP(topP float64) GenerateOption
WithTopP creates a GenerateOption to set the top_p
type GenerateOptions ¶
type GenerateOptions struct {
LLMConfig *LLMConfig // LLM config for the generation
OrgID string // For multi-tenancy
SystemMessage string // System message for chat models
ResponseFormat *ResponseFormat // Optional expected response format
MaxIterations int // Maximum number of tool-calling iterations (0 = use default)
Memory Memory // Optional memory for storing tool calls and results
StreamConfig *StreamConfig // Optional streaming configuration
}
GenerateOptions contains configuration for text generation
type GetMessagesOption ¶
type GetMessagesOption func(*GetMessagesOptions)
GetMessagesOption represents an option for retrieving messages
func WithLimit ¶
func WithLimit(limit int) GetMessagesOption
WithLimit sets the maximum number of messages to retrieve
func WithQuery ¶
func WithQuery(query string) GetMessagesOption
WithQuery sets a search query for relevant messages
func WithRoles ¶
func WithRoles(roles ...string) GetMessagesOption
WithRoles filters messages by role
type GetMessagesOptions ¶
type GetMessagesOptions struct {
// Limit is the maximum number of messages to retrieve
Limit int
// Roles filters messages by role
Roles []string
// Query is a search query for relevant messages
Query string
}
GetMessagesOptions contains options for retrieving messages
type Guardrails ¶
type Guardrails interface {
// ProcessInput processes user input before sending to the LLM
ProcessInput(ctx context.Context, input string) (string, error)
// ProcessOutput processes LLM output before returning to the user
ProcessOutput(ctx context.Context, output string) (string, error)
}
Guardrails represents a system for ensuring safe and appropriate responses
type InternalTool ¶
type InternalTool interface {
// Internal returns true if this tool's usage should be hidden from users
// This can be used to filter tool calls in OnToolCall or other display contexts
Internal() bool
}
InternalTool is an optional interface that tools can implement to indicate they should be hidden from users
type JSONSchema ¶
type JSONSchema map[string]interface{}
func (JSONSchema) MarshalJSON ¶
func (s JSONSchema) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface
type LLM ¶
type LLM interface {
// Generate generates text based on the provided prompt
Generate(ctx context.Context, prompt string, options ...GenerateOption) (string, error)
// GenerateWithTools generates text and can use tools
GenerateWithTools(ctx context.Context, prompt string, tools []Tool, options ...GenerateOption) (string, error)
// Name returns the name of the LLM provider
Name() string
// SupportsStreaming returns true if this LLM supports streaming
SupportsStreaming() bool
}
LLM represents a large language model provider
type LLMConfig ¶
type LLMConfig struct {
Temperature float64 // Temperature for the generation
TopP float64 // Top P for the generation
FrequencyPenalty float64 // Frequency penalty for the generation
PresencePenalty float64 // Presence penalty for the generation
StopSequences []string // Stop sequences for the generation
Reasoning string // Reasoning mode (minimal, low, medium, high) to control reasoning effort
EnableReasoning bool // Enable native reasoning tokens (Anthropic thinking/OpenAI o1)
ReasoningBudget int // Optional token budget for reasoning (Anthropic only)
}
type MCPServer ¶
type MCPServer interface {
// Initialize initializes the connection to the MCP server
Initialize(ctx context.Context) error
// ListTools lists the tools available on the MCP server
ListTools(ctx context.Context) ([]MCPTool, error)
// CallTool calls a tool on the MCP server
CallTool(ctx context.Context, name string, args interface{}) (*MCPToolResponse, error)
// Close closes the connection to the MCP server
Close() error
}
MCPServer represents a connection to an MCP server
type MCPToolResponse ¶
type MCPToolResponse struct {
Content interface{}
IsError bool
}
MCPToolResponse represents a response from a tool call
type Memory ¶
type Memory interface {
// AddMessage adds a message to memory
AddMessage(ctx context.Context, message Message) error
// GetMessages retrieves messages from memory
GetMessages(ctx context.Context, options ...GetMessagesOption) ([]Message, error)
// Clear clears the memory
Clear(ctx context.Context) error
}
Memory represents a memory store for agent conversations
type Message ¶
type Message struct {
// Role is the role of the message sender
Role MessageRole
// Content is the content of the message
Content string
// Metadata contains additional information about the message
Metadata map[string]interface{}
// ToolCallID is used for tool messages to reference the tool call
ToolCallID string
// ToolCalls contains tool call information for assistant messages
ToolCalls []ToolCall
}
Message represents a message in a conversation
type MessageRole ¶
type MessageRole string
MessageRole represents the role of a message sender
const ( // MessageRoleUser represents a user message MessageRoleUser MessageRole = "user" // MessageRoleAssistant represents an assistant message MessageRoleAssistant MessageRole = "assistant" // MessageRoleSystem represents a system message MessageRoleSystem MessageRole = "system" // MessageRoleTool represents a tool response message MessageRoleTool MessageRole = "tool" )
type ParameterSpec ¶
type ParameterSpec struct {
// Type is the data type of the parameter (string, number, boolean, etc.)
Type string
// Description describes what the parameter is for
Description string
// Required indicates if the parameter is required
Required bool
// Default is the default value for the parameter
Default interface{}
// Enum is a list of possible values for the parameter
Enum []interface{}
// Items is the type of the items in the parameter
Items *ParameterSpec
}
ParameterSpec defines the specification for a tool parameter
type QueryOption ¶
type QueryOption func(*QueryOptions)
QueryOption represents an option for querying documents
func QueryWithLimit ¶
func QueryWithLimit(limit int) QueryOption
QueryWithLimit sets the maximum number of documents to return
func QueryWithOffset ¶
func QueryWithOffset(offset int) QueryOption
QueryWithOffset sets the number of documents to skip
func QueryWithOrderBy ¶
func QueryWithOrderBy(field string, direction string) QueryOption
QueryWithOrderBy sets the field to order by and the direction
type QueryOptions ¶
type QueryOptions struct {
// Limit is the maximum number of documents to return
Limit int
// Offset is the number of documents to skip
Offset int
// OrderBy specifies the field to order by
OrderBy string
// OrderDirection specifies the order direction (asc or desc)
OrderDirection string
}
QueryOptions contains options for querying documents
type ResponseFormat ¶
type ResponseFormat struct {
Type ResponseFormatType
Name string // The name of the struct/object to be returned
Schema JSONSchema // JSON schema representation of the struct
}
ResponseFormat defines the format of the response from the LLM
type ResponseFormatType ¶
type ResponseFormatType string
const ( ResponseFormatJSON ResponseFormatType = "json_object" ResponseFormatText ResponseFormatType = "text" )
type RetryPolicy ¶
type RetryPolicy struct {
// MaxRetries is the maximum number of retries
MaxRetries int
// InitialBackoff is the initial backoff duration
InitialBackoff time.Duration
// MaxBackoff is the maximum backoff duration
MaxBackoff time.Duration
// BackoffMultiplier is the multiplier for backoff duration after each retry
BackoffMultiplier float64
}
RetryPolicy defines how tasks should be retried
type SearchOption ¶
type SearchOption func(*SearchOptions)
SearchOption represents an option for searching documents
func WithEmbedding ¶
func WithEmbedding(useEmbedding bool) SearchOption
WithEmbedding sets whether to use embedding for the search
func WithFields ¶
func WithFields(fields ...string) SearchOption
WithFields sets the specific fields to retrieve in search results
func WithFilters ¶
func WithFilters(filters map[string]interface{}) SearchOption
WithFilters sets metadata filters
func WithKeyword ¶
func WithKeyword(useKeyword bool) SearchOption
WithKeyword sets whether to use keyword search
func WithMinScore ¶
func WithMinScore(score float32) SearchOption
WithMinScore sets the minimum similarity score
func WithNearText ¶
func WithNearText(useNearText bool) SearchOption
WithNearText sets whether to use nearText search
func WithTenantSearch ¶
func WithTenantSearch(tenant string) SearchOption
WithTenantSearch sets the tenant for native multi-tenancy search operations
type SearchOptions ¶
type SearchOptions struct {
// MinScore is the minimum similarity score (0-1)
MinScore float32
// Filters are metadata filters to apply to the search
Filters map[string]interface{}
// Class is the class/collection name to search in
Class string
// UseEmbedding indicates whether to use embedding for the search
UseEmbedding bool
// UseBM25 indicates whether to use BM25 search instead of vector search
UseBM25 bool
// UseNearText indicates whether to use nearText search
UseNearText bool
// UseKeyword indicates whether to use keyword search
UseKeyword bool
// Tenant is the tenant name for native multi-tenancy
Tenant string
// Fields specifies which fields to retrieve. If empty, all fields will be retrieved dynamically
Fields []string
}
SearchOptions contains options for searching documents
type SearchResult ¶
type SearchResult struct {
// Document is the found document
Document Document
// Score is the similarity score (0-1, higher is more similar)
Score float32
}
SearchResult represents a document found in a search
type Span ¶
type Span interface {
// End ends the span
End()
// AddEvent adds an event to the span
AddEvent(name string, attributes map[string]interface{})
// SetAttribute sets an attribute on the span
SetAttribute(key string, value interface{})
RecordError(err error)
}
Span represents a span in a trace
type StoreOption ¶
type StoreOption func(*StoreOptions)
StoreOption represents an option for storing documents
func WithBatchSize ¶
func WithBatchSize(size int) StoreOption
WithBatchSize sets the batch size for storing documents
func WithGenerateVectors ¶
func WithGenerateVectors(generate bool) StoreOption
WithGenerateVectors sets whether to generate vectors
func WithTenant ¶
func WithTenant(tenant string) StoreOption
WithTenant sets the tenant for native multi-tenancy operations
type StoreOptions ¶
type StoreOptions struct {
// BatchSize is the number of documents to store in each batch
BatchSize int
// GenerateVectors indicates whether to generate vectors for documents
GenerateVectors bool
// Class is the class/collection name to store documents in
Class string
// Tenant is the tenant name for native multi-tenancy
Tenant string
}
StoreOptions contains options for storing documents
type StreamConfig ¶
type StreamConfig struct {
// BufferSize determines the channel buffer size
BufferSize int
// IncludeThinking whether to include thinking events
IncludeThinking bool
// IncludeToolProgress whether to include tool execution progress
IncludeToolProgress bool
// IncludeIntermediateMessages whether to include intermediate messages between tool iterations
IncludeIntermediateMessages bool
}
StreamConfig contains configuration for streaming behavior
func DefaultStreamConfig ¶
func DefaultStreamConfig() StreamConfig
DefaultStreamConfig returns default streaming configuration
type StreamEvent ¶
type StreamEvent struct {
Type StreamEventType `json:"type"`
Content string `json:"content,omitempty"`
ToolCall *ToolCall `json:"tool_call,omitempty"`
Error error `json:"error,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
StreamEvent represents a single event in a stream
type StreamEventType ¶
type StreamEventType string
StreamEventType represents the type of streaming event
const ( // Core streaming events StreamEventMessageStart StreamEventType = "message_start" StreamEventContentDelta StreamEventType = "content_delta" StreamEventContentComplete StreamEventType = "content_complete" StreamEventMessageStop StreamEventType = "message_stop" StreamEventError StreamEventType = "error" // Tool-related events StreamEventToolUse StreamEventType = "tool_use" StreamEventToolResult StreamEventType = "tool_result" // Thinking/reasoning events StreamEventThinking StreamEventType = "thinking" )
type StreamingAgent ¶
type StreamingAgent interface {
// RunStream executes the agent with streaming response
RunStream(ctx context.Context, input string) (<-chan AgentStreamEvent, error)
}
StreamingAgent represents an agent with streaming capabilities
type StreamingLLM ¶
type StreamingLLM interface {
LLM
// GenerateStream generates text with streaming response
GenerateStream(ctx context.Context, prompt string, options ...GenerateOption) (<-chan StreamEvent, error)
// GenerateWithToolsStream generates text with tools and streaming response
GenerateWithToolsStream(ctx context.Context, prompt string, tools []Tool, options ...GenerateOption) (<-chan StreamEvent, error)
}
StreamingLLM extends LLM with streaming capabilities
type TaskExecutor ¶
type TaskExecutor interface {
// ExecuteSync executes a task synchronously
ExecuteSync(ctx context.Context, taskName string, params interface{}, opts *TaskOptions) (*TaskResult, error)
// ExecuteAsync executes a task asynchronously and returns a channel for the result
ExecuteAsync(ctx context.Context, taskName string, params interface{}, opts *TaskOptions) (<-chan *TaskResult, error)
// ExecuteWorkflow initiates a temporal workflow
ExecuteWorkflow(ctx context.Context, workflowName string, params interface{}, opts *TaskOptions) (*TaskResult, error)
// ExecuteWorkflowAsync initiates a temporal workflow asynchronously
ExecuteWorkflowAsync(ctx context.Context, workflowName string, params interface{}, opts *TaskOptions) (<-chan *TaskResult, error)
// CancelTask cancels a running task
CancelTask(ctx context.Context, taskID string) error
// GetTaskStatus gets the status of a task
GetTaskStatus(ctx context.Context, taskID string) (string, error)
// ExecuteStep executes a single step in a task's plan
ExecuteStep(ctx context.Context, task interface{}, step interface{}) error
// ExecuteTask executes all steps in a task's plan
ExecuteTask(ctx context.Context, task interface{}) error
}
TaskExecutor is the interface for executing tasks
type TaskOptions ¶
type TaskOptions struct {
// Timeout specifies the maximum duration for task execution
Timeout *time.Duration
// RetryPolicy specifies the retry policy for the task
RetryPolicy *RetryPolicy
// Metadata contains additional information for the task execution
Metadata map[string]interface{}
}
TaskOptions represents options for task execution
type TaskPlanner ¶
type TaskPlanner interface {
// CreatePlan creates a plan for a task
CreatePlan(ctx context.Context, task interface{}) (string, error)
}
TaskPlanner defines the interface for planning a task
type TaskResult ¶
type TaskResult struct {
// Data contains the result data
Data interface{}
// Error contains any error that occurred during task execution
Error error
// Metadata contains additional information about the task execution
Metadata map[string]interface{}
}
TaskResult represents the result of a task execution
type TaskService ¶
type TaskService interface {
// CreateTask creates a new task
CreateTask(ctx context.Context, req interface{}) (interface{}, error)
// GetTask gets a task by ID
GetTask(ctx context.Context, taskID string) (interface{}, error)
// ListTasks returns tasks filtered by the provided criteria
ListTasks(ctx context.Context, filter interface{}) ([]interface{}, error)
// ApproveTaskPlan approves or rejects a task plan
ApproveTaskPlan(ctx context.Context, taskID string, req interface{}) (interface{}, error)
// UpdateTask updates an existing task with new steps or modifications
UpdateTask(ctx context.Context, taskID string, updates interface{}) (interface{}, error)
// AddTaskLog adds a log entry to a task
AddTaskLog(ctx context.Context, taskID string, message string, level string) error
}
TaskService defines the interface for task management This is a unified interface combining task and core.Service
type Tool ¶
type Tool interface {
// Name returns the name of the tool
Name() string
// Description returns a description of what the tool does
Description() string
// Run executes the tool with the given input
Run(ctx context.Context, input string) (string, error)
// Parameters returns the parameters that the tool accepts
Parameters() map[string]ParameterSpec
// Execute executes the tool with the given arguments
Execute(ctx context.Context, args string) (string, error)
}
Tool represents a tool that can be used by an agent
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Internal bool `json:"internal,omitempty"`
Arguments string `json:"arguments"`
}
ToolCall represents a tool call made by the assistant
type ToolCallEvent ¶
type ToolCallEvent struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Internal bool `json:"internal,omitempty"`
Arguments string `json:"arguments,omitempty"`
Result string `json:"result,omitempty"`
Status string `json:"status"` // "starting", "executing", "completed", "error"
}
ToolCallEvent represents a tool call in streaming context
type ToolRegistry ¶
type ToolRegistry interface {
// Register registers a tool with the registry
Register(tool Tool)
// Get returns a tool by name
Get(name string) (Tool, bool)
// List returns all registered tools
List() []Tool
}
ToolRegistry is a registry of available tools
type ToolWithDisplayName ¶
type ToolWithDisplayName interface {
// DisplayName returns a human-friendly name for the tool
DisplayName() string
}
ToolWithDisplayName is an optional interface that tools can implement to provide a human-friendly display name
type Tracer ¶
type Tracer interface {
// StartSpan starts a new span and returns a new context containing the span
StartSpan(ctx context.Context, name string) (context.Context, Span)
// StartTraceSession starts a root trace session for a request with the given contextID
// This creates a root span that will group all subsequent operations under the same trace
StartTraceSession(ctx context.Context, contextID string) (context.Context, Span)
}
Tracer represents a tracing system for observability
type Transaction ¶
type Transaction interface {
// Collection returns a reference to a specific collection/table within the transaction
Collection(name string) CollectionRef
// Commit commits the transaction
Commit() error
// Rollback rolls back the transaction
Rollback() error
}
Transaction represents a database transaction
type VectorStore ¶
type VectorStore interface {
Store(ctx context.Context, documents []Document, options ...StoreOption) error
Get(ctx context.Context, id string, options ...StoreOption) (*Document, error)
Search(ctx context.Context, query string, limit int, options ...SearchOption) ([]SearchResult, error)
SearchByVector(ctx context.Context, vector []float32, limit int, options ...SearchOption) ([]SearchResult, error)
Delete(ctx context.Context, ids []string, options ...DeleteOption) error
// Global operations for shared data (no tenant context)
GlobalStore(ctx context.Context, documents []Document, options ...StoreOption) error
GlobalSearch(ctx context.Context, query string, limit int, options ...SearchOption) ([]SearchResult, error)
GlobalSearchByVector(ctx context.Context, vector []float32, limit int, options ...SearchOption) ([]SearchResult, error)
GlobalDelete(ctx context.Context, ids []string, options ...DeleteOption) error
// Tenant management for native multi-tenancy
CreateTenant(ctx context.Context, tenantName string) error
DeleteTenant(ctx context.Context, tenantName string) error
ListTenants(ctx context.Context) ([]string, error)
}
VectorStore interface defines operations for vector storage and retrieval
type VectorStoreConfig ¶
type VectorStoreConfig struct {
// Host is the hostname of the vector store server
Host string
// APIKey is the authentication key for the vector store
APIKey string
// Scheme is the URL scheme (http or https)
Scheme string
// ClassPrefix is the default prefix for class/collection names
ClassPrefix string
// DistanceMetric is the similarity metric to use (e.g., "cosine", "euclidean", "dot")
DistanceMetric string
}
VectorStoreConfig contains configuration for vector stores