Documentation
¶
Index ¶
- func Create_Tool(fn interface{}) (models.FunctionDeclaration, error)
- func Create_Tools(fns []interface{}) ([]models.FunctionDeclaration, error)
- func NewAnthropicModel(modelName string) *anthropicModel.Anthropic_Model
- func NewAnthropicModelWithOptions(modelName string, temperature *float64, maxTokens *int, systemPrompt string) *anthropicModel.Anthropic_Model
- func NewCerebrasModel(modelName string) *cerebras.Cerebras_Model
- func NewCerebrasModelWithOptions(modelName string, temperature *float64, maxTokens *int, systemPrompt string, ...) *cerebras.Cerebras_Model
- func NewGeminiModel(modelName string) *gemini.Gemini_Model
- func NewGroqModel(modelName string) *groq.Groq_Model
- func NewGroqModelWithOptions(modelName string, temperature *float64, maxTokens *int, systemPrompt string) *groq.Groq_Model
- func NewOpenRouterModel(modelName string) *openrouter.OpenRouter_Model
- func NewOpenRouterModelWithBaseURL(modelName, baseURL, apiKeyEnv string, temperature *float64, maxTokens *int) *openrouter.OpenRouter_Model
- func NewOpenRouterModelWithOptions(modelName string, temperature *float64, maxTokens *int, ...) *openrouter.OpenRouter_Model
- func Tool_Approver(tool_name string, tool_args map[string]interface{}) (bool, error)
- type Agent
- func (agent *Agent) ApproveTool(name string, args map[string]interface{}) (bool, error)
- func (agent *Agent) ExecuteTool(functionName string, functionCallArgs map[string]interface{}, sessionID string) (string, error)
- func (agent *Agent) Run(request models.Model_Request, conversationHistory []stores.Message) (models.Model_Response, error)
- func (agent *Agent) Run_Stream(request models.Model_Request, conversationHistory []stores.Message) (<-chan models.Model_Response, <-chan error)
- func (agent *Agent) SetHistoryWarningCallback(callback func(warnings []models.HistoryWarning)) bool
- type AgentError
- type AgentInterface
- type AgentSession
- type HTTPSession
- type HistoryWarner
- type MemoryManager
- type Model
- type ModelProvider
- type ResponseWaiter
- type SSEWriter
- type ToolExecutorFunc
- type WSConfig
- func (c *WSConfig) WithAnthropic(model string) *WSConfig
- func (c *WSConfig) WithCerebras(model string) *WSConfig
- func (c *WSConfig) WithGroq(model string) *WSConfig
- func (c *WSConfig) WithMaxTokens(tokens int) *WSConfig
- func (c *WSConfig) WithModelName(modelName string) *WSConfig
- func (c *WSConfig) WithOpenRouter(model string) *WSConfig
- func (c *WSConfig) WithPostgresStore(host, user, password, dbname string, port int) *WSConfig
- func (c *WSConfig) WithProvider(provider ModelProvider) *WSConfig
- func (c *WSConfig) WithSQLiteStore(dbPath string) *WSConfig
- func (c *WSConfig) WithSiteInfo(url, name string) *WSConfig
- func (c *WSConfig) WithStore(store stores.MessageStore) *WSConfig
- func (c *WSConfig) WithSystemPrompt(systemPrompt string) *WSConfig
- func (c *WSConfig) WithTemperature(temp float64) *WSConfig
- func (c *WSConfig) WithTools(tools []interface{}) *WSConfig
- func (c *WSConfig) WithTraceStore(traceStore stores.TraceStore) *WSConfig
- type WebSocketToolResultMessage
- type WebSocketWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create_Tool ¶
func Create_Tool(fn interface{}) (models.FunctionDeclaration, error)
tool takes a function, finds its generated JSON schema, and returns a Tool struct.
func Create_Tools ¶
func Create_Tools(fns []interface{}) ([]models.FunctionDeclaration, error)
func NewAnthropicModel ¶
func NewAnthropicModel(modelName string) *anthropicModel.Anthropic_Model
NewAnthropicModel creates a new Anthropic model instance
func NewAnthropicModelWithOptions ¶
func NewAnthropicModelWithOptions(modelName string, temperature *float64, maxTokens *int, systemPrompt string) *anthropicModel.Anthropic_Model
NewAnthropicModelWithOptions creates a new Anthropic model with full configuration
func NewCerebrasModel ¶
func NewCerebrasModel(modelName string) *cerebras.Cerebras_Model
NewCerebrasModel creates a new Cerebras model instance
func NewCerebrasModelWithOptions ¶
func NewCerebrasModelWithOptions(modelName string, temperature *float64, maxTokens *int, systemPrompt string, topP *float64, seed *int) *cerebras.Cerebras_Model
NewCerebrasModelWithOptions creates a new Cerebras model with full configuration
func NewGeminiModel ¶
func NewGeminiModel(modelName string) *gemini.Gemini_Model
NewGeminiModel creates a new Gemini model instance
func NewGroqModel ¶
func NewGroqModel(modelName string) *groq.Groq_Model
NewGroqModel creates a new Groq model instance
func NewGroqModelWithOptions ¶
func NewGroqModelWithOptions(modelName string, temperature *float64, maxTokens *int, systemPrompt string) *groq.Groq_Model
NewGroqModelWithOptions creates a new Groq model with full configuration
func NewOpenRouterModel ¶
func NewOpenRouterModel(modelName string) *openrouter.OpenRouter_Model
NewOpenRouterModel creates a new OpenRouter model instance
func NewOpenRouterModelWithBaseURL ¶
func NewOpenRouterModelWithBaseURL(modelName, baseURL, apiKeyEnv string, temperature *float64, maxTokens *int) *openrouter.OpenRouter_Model
NewOpenRouterModelWithBaseURL creates a new OpenRouter-compatible model with custom base URL and API key
func NewOpenRouterModelWithOptions ¶
func NewOpenRouterModelWithOptions(modelName string, temperature *float64, maxTokens *int, siteURL, siteName string) *openrouter.OpenRouter_Model
NewOpenRouterModelWithOptions creates a new OpenRouter model with full configuration
Types ¶
type Agent ¶
type Agent struct {
Model Model
Tools []models.FunctionDeclaration
Memory MemoryManager
}
func Create_Agent ¶
func Create_Agent(model Model, tools []models.FunctionDeclaration, memory ...MemoryManager) Agent
Create_Agent creates an agent with the given model and tools
func Create_Agent_From_Config ¶
func Create_Agent_From_Config(config *WSConfig, tools []models.FunctionDeclaration, memory ...MemoryManager) Agent
Create_Agent_From_Config creates an agent from a WSConfig
func (*Agent) ApproveTool ¶
ApproveTool checks if a tool should be auto-approved
func (*Agent) ExecuteTool ¶
func (agent *Agent) ExecuteTool(functionName string, functionCallArgs map[string]interface{}, sessionID string) (string, error)
ExecuteTool executes a tool dynamically by name and arguments
func (*Agent) Run ¶
func (agent *Agent) Run(request models.Model_Request, conversationHistory []stores.Message) (models.Model_Response, error)
func (*Agent) Run_Stream ¶
func (agent *Agent) Run_Stream(request models.Model_Request, conversationHistory []stores.Message) (<-chan models.Model_Response, <-chan error)
func (*Agent) SetHistoryWarningCallback ¶
func (agent *Agent) SetHistoryWarningCallback(callback func(warnings []models.HistoryWarning)) bool
SetHistoryWarningCallback sets a callback for history warnings if the model supports it Returns true if the model supports warnings, false otherwise
type AgentError ¶
type AgentError = sessions.AgentError
type AgentInterface ¶
type AgentInterface = sessions.AgentInterface
type AgentSession ¶
type AgentSession = sessions.AgentSession
Re-export session types for backward compatibility
func NewAgentSession ¶
func NewAgentSession(sessionID string, userID string, conn *websocket.Conn, agent *Agent, store stores.MessageStore, memory MemoryManager) *AgentSession
Re-export constructor functions
type HTTPSession ¶
type HTTPSession = sessions.HTTPSession
func NewHTTPSession ¶
func NewHTTPSession(conversationID string, agent *Agent, store stores.MessageStore) *HTTPSession
type HistoryWarner ¶
type HistoryWarner interface {
SetHistoryWarningCallback(callback func(warnings []models.HistoryWarning))
}
HistoryWarner is an optional interface that models can implement to report warnings when adapting conversation history
type MemoryManager ¶
type MemoryManager = sessions.MemoryManager
type Model ¶
type Model interface {
Model_Request(request models.Model_Request, tools []models.FunctionDeclaration, conversationHistory []stores.Message) (models.Model_Response, error)
Stream_Model_Request(request models.Model_Request, tools []models.FunctionDeclaration, conversationHistory []stores.Message) (<-chan models.Model_Response, <-chan error)
}
type ModelProvider ¶
type ModelProvider string
ModelProvider represents the AI model provider to use
const ( ProviderGemini ModelProvider = "gemini" ProviderOpenRouter ModelProvider = "openrouter" ProviderGroq ModelProvider = "groq" ProviderCerebras ModelProvider = "cerebras" ProviderAnthropic ModelProvider = "anthropic" )
type ResponseWaiter ¶
type ResponseWaiter = sessions.ResponseWaiter
type ToolExecutorFunc ¶
type ToolExecutorFunc = sessions.ToolExecutorFunc
type WSConfig ¶
type WSConfig struct {
ModelName string
Tools []interface{}
Store stores.MessageStore
TraceStore stores.TraceStore // Optional: Store for execution traces
Provider ModelProvider // AI model provider (gemini, openrouter, groq)
SiteURL string // Optional: Site URL for OpenRouter rankings
SiteName string // Optional: Site name for OpenRouter rankings
Temperature *float64 // Optional: Temperature for model generation
MaxTokens *int // Optional: Max tokens for model generation
SystemPrompt string // Optional: System prompt for the AI
}
WSConfig holds configuration for WebSocket controllers
func NewAnthropicConfig ¶
NewAnthropicConfig creates a new configuration with Anthropic as the provider
func NewCerebrasConfig ¶
NewCerebrasConfig creates a new configuration with Cerebras as the provider
func NewGroqConfig ¶
NewGroqConfig creates a new configuration with Groq as the provider
func NewOpenRouterConfig ¶
NewOpenRouterConfig creates a new configuration with OpenRouter as the provider
func NewWSConfig ¶
func NewWSConfig() *WSConfig
NewWSConfig creates a new WebSocket configuration with default values
func (*WSConfig) WithAnthropic ¶
WithAnthropic sets Anthropic as the provider with the specified model
func (*WSConfig) WithCerebras ¶
WithCerebras sets Cerebras as the provider with the specified model
func (*WSConfig) WithMaxTokens ¶
WithMaxTokens sets the max tokens for model generation
func (*WSConfig) WithModelName ¶
WithModelName sets the model name for the configuration
func (*WSConfig) WithOpenRouter ¶
WithOpenRouter sets OpenRouter as the provider with the specified model
func (*WSConfig) WithPostgresStore ¶
WithPostgresStore sets a PostgreSQL store with the specified connection parameters
func (*WSConfig) WithProvider ¶
func (c *WSConfig) WithProvider(provider ModelProvider) *WSConfig
WithProvider sets the AI model provider
func (*WSConfig) WithSQLiteStore ¶
WithSQLiteStore sets a SQLite store with the specified database path
func (*WSConfig) WithSiteInfo ¶
WithSiteInfo sets the site URL and name for OpenRouter rankings
func (*WSConfig) WithStore ¶
func (c *WSConfig) WithStore(store stores.MessageStore) *WSConfig
WithStore sets the message store for the configuration
func (*WSConfig) WithSystemPrompt ¶
WithSystemPrompt sets the system prompt for the AI
func (*WSConfig) WithTemperature ¶
WithTemperature sets the temperature for model generation
func (*WSConfig) WithTraceStore ¶
func (c *WSConfig) WithTraceStore(traceStore stores.TraceStore) *WSConfig
WithTraceStore sets the trace store for execution trace persistence
type WebSocketToolResultMessage ¶
type WebSocketToolResultMessage = sessions.WebSocketToolResultMessage
type WebSocketWriter ¶
type WebSocketWriter = sessions.WebSocketWriter
Directories
¶
| Path | Synopsis |
|---|---|
|
Package common_tools provides a collection of tools for AI agents.
|
Package common_tools provides a collection of tools for AI agents. |
|
Package docs Code generated by swaggo/swag.
|
Package docs Code generated by swaggo/swag. |
|
elevenlabs
|
|
|
direct_session
command
|
|