Documentation
¶
Index ¶
- func ResolveWebSearchProviderName(opts WebSearchToolOptions, query string) (string, error)
- func ToolAgentID(ctx context.Context) string
- func ToolChannel(ctx context.Context) string
- func ToolChatID(ctx context.Context) string
- func ToolMessageID(ctx context.Context) string
- func ToolSessionKey(ctx context.Context) string
- func ToolSessionScope(ctx context.Context) *session.SessionScope
- func WebSearchProviderReady(opts WebSearchToolOptions, name string) bool
- func WithToolContext(ctx context.Context, channel, chatID string) context.Context
- func WithToolInboundContext(ctx context.Context, channel, chatID, messageID, replyToMessageID string) context.Context
- func WithToolSessionContext(ctx context.Context, agentID, sessionKey string, scope *session.SessionScope) context.Context
- type APIKeyIterator
- type APIKeyPool
- type AsyncCallback
- type BaiduSearchProvider
- type BraveSearchProvider
- type DuckDuckGoSearchProvider
- type FindSkillsTool
- type GLMSearchProvider
- type InstallSkillTool
- type MCPManager
- type MCPTool
- func (t *MCPTool) Description() string
- func (t *MCPTool) Execute(ctx context.Context, args map[string]any) *ToolResult
- func (t *MCPTool) Name() string
- func (t *MCPTool) Parameters() map[string]any
- func (t *MCPTool) PromptMetadata() toolshared.PromptMetadata
- func (t *MCPTool) SetMaxInlineTextRunes(limit int)
- func (t *MCPTool) SetMediaStore(store media.MediaStore)
- func (t *MCPTool) SetWorkspace(workspace string)
- type MessageTool
- func (t *MessageTool) Description() string
- func (t *MessageTool) Execute(ctx context.Context, args map[string]any) *ToolResult
- func (t *MessageTool) HasSentInRound(sessionKey string) bool
- func (t *MessageTool) HasSentTo(sessionKey, channel, chatID string) bool
- func (t *MessageTool) Name() string
- func (t *MessageTool) Parameters() map[string]any
- func (t *MessageTool) ResetSentInRound(sessionKey string)
- func (t *MessageTool) SetSendCallback(callback SendCallbackWithContext)
- type PerplexitySearchProvider
- type ReactionCallback
- type ReactionTool
- type SearXNGSearchProvider
- type SearchProvider
- type SearchResultItem
- type SendCallbackWithContext
- type SendTTSTool
- type SogouSearchProvider
- type TavilySearchProvider
- type Tool
- type ToolResult
- type WebFetchTool
- func NewWebFetchTool(maxChars int, format string, fetchLimitBytes int64) (*WebFetchTool, error)
- func NewWebFetchToolWithConfig(maxChars int, proxy string, format string, fetchLimitBytes int64, ...) (*WebFetchTool, error)
- func NewWebFetchToolWithProxy(maxChars int, proxy string, format string, fetchLimitBytes int64, ...) (*WebFetchTool, error)
- type WebSearchTool
- type WebSearchToolOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveWebSearchProviderName ¶ added in v0.2.8
func ResolveWebSearchProviderName(opts WebSearchToolOptions, query string) (string, error)
func ToolAgentID ¶
func ToolChannel ¶
func ToolChatID ¶
func ToolMessageID ¶
func ToolSessionKey ¶
func ToolSessionScope ¶
func ToolSessionScope(ctx context.Context) *session.SessionScope
func WebSearchProviderReady ¶ added in v0.2.8
func WebSearchProviderReady(opts WebSearchToolOptions, name string) bool
func WithToolContext ¶
func WithToolInboundContext ¶
func WithToolSessionContext ¶
Types ¶
type APIKeyIterator ¶
type APIKeyIterator struct {
// contains filtered or unexported fields
}
func (*APIKeyIterator) Next ¶
func (it *APIKeyIterator) Next() (string, bool)
type APIKeyPool ¶
type APIKeyPool struct {
// contains filtered or unexported fields
}
func NewAPIKeyPool ¶
func NewAPIKeyPool(keys []string) *APIKeyPool
func (*APIKeyPool) NewIterator ¶
func (p *APIKeyPool) NewIterator() *APIKeyIterator
type AsyncCallback ¶
type AsyncCallback = toolshared.AsyncCallback
type BaiduSearchProvider ¶
type BaiduSearchProvider struct {
// contains filtered or unexported fields
}
type BraveSearchProvider ¶
type BraveSearchProvider struct {
// contains filtered or unexported fields
}
type DuckDuckGoSearchProvider ¶
type DuckDuckGoSearchProvider struct {
// contains filtered or unexported fields
}
type FindSkillsTool ¶
type FindSkillsTool struct {
// contains filtered or unexported fields
}
FindSkillsTool allows the LLM agent to search for installable skills from registries.
func NewFindSkillsTool ¶
func NewFindSkillsTool(registryMgr *skills.RegistryManager, cache *skills.SearchCache) *FindSkillsTool
NewFindSkillsTool creates a new FindSkillsTool. registryMgr is the shared registry manager (built from config in createToolRegistry). cache is the search cache for deduplicating similar queries.
func (*FindSkillsTool) Description ¶
func (t *FindSkillsTool) Description() string
func (*FindSkillsTool) Execute ¶
func (t *FindSkillsTool) Execute(ctx context.Context, args map[string]any) *ToolResult
func (*FindSkillsTool) Name ¶
func (t *FindSkillsTool) Name() string
func (*FindSkillsTool) Parameters ¶
func (t *FindSkillsTool) Parameters() map[string]any
type GLMSearchProvider ¶
type GLMSearchProvider struct {
// contains filtered or unexported fields
}
type InstallSkillTool ¶
type InstallSkillTool struct {
// contains filtered or unexported fields
}
InstallSkillTool allows the LLM agent to install skills from registries. It shares the same RegistryManager that FindSkillsTool uses, so all registries configured in config are available for installation.
func NewInstallSkillTool ¶
func NewInstallSkillTool(registryMgr *skills.RegistryManager, workspace string) *InstallSkillTool
NewInstallSkillTool creates a new InstallSkillTool. registryMgr is the shared registry manager (same instance as FindSkillsTool). workspace is the root workspace directory; skills install to {workspace}/skills/{slug}/.
func (*InstallSkillTool) Description ¶
func (t *InstallSkillTool) Description() string
func (*InstallSkillTool) Execute ¶
func (t *InstallSkillTool) Execute(ctx context.Context, args map[string]any) *ToolResult
func (*InstallSkillTool) Name ¶
func (t *InstallSkillTool) Name() string
func (*InstallSkillTool) Parameters ¶
func (t *InstallSkillTool) Parameters() map[string]any
type MCPManager ¶
type MCPManager interface {
CallTool(
ctx context.Context,
serverName, toolName string,
arguments map[string]any,
) (*mcp.CallToolResult, error)
}
MCPManager defines the interface for MCP manager operations This allows for easier testing with mock implementations
type MCPTool ¶
type MCPTool struct {
// contains filtered or unexported fields
}
MCPTool wraps an MCP tool to implement the Tool interface
func NewMCPTool ¶
func NewMCPTool(manager MCPManager, serverName string, tool *mcp.Tool) *MCPTool
NewMCPTool creates a new MCP tool wrapper
func (*MCPTool) Description ¶
Description returns the tool description
func (*MCPTool) Name ¶
Name returns the tool name, prefixed with the server name. The total length is capped at 64 characters (OpenAI-compatible API limit). A short hash of the original (unsanitized) server and tool names is appended whenever sanitization is lossy or the name is truncated, ensuring that two names which differ only in disallowed characters remain distinct after sanitization.
func (*MCPTool) Parameters ¶
Parameters returns the tool parameters schema
func (*MCPTool) PromptMetadata ¶ added in v0.2.8
func (t *MCPTool) PromptMetadata() toolshared.PromptMetadata
func (*MCPTool) SetMaxInlineTextRunes ¶
func (*MCPTool) SetMediaStore ¶
func (t *MCPTool) SetMediaStore(store media.MediaStore)
func (*MCPTool) SetWorkspace ¶
type MessageTool ¶
type MessageTool struct {
// contains filtered or unexported fields
}
func NewMessageTool ¶
func NewMessageTool() *MessageTool
func (*MessageTool) Description ¶
func (t *MessageTool) Description() string
func (*MessageTool) Execute ¶
func (t *MessageTool) Execute(ctx context.Context, args map[string]any) *ToolResult
func (*MessageTool) HasSentInRound ¶
func (t *MessageTool) HasSentInRound(sessionKey string) bool
HasSentInRound returns true if the message tool sent a message during the current round.
func (*MessageTool) HasSentTo ¶
func (t *MessageTool) HasSentTo(sessionKey, channel, chatID string) bool
HasSentTo returns true if the message tool sent to the specific channel+chatID during the current round. Used by PublishResponseIfNeeded to avoid suppressing the final response when the message tool only sent to a different conversation.
func (*MessageTool) Name ¶
func (t *MessageTool) Name() string
func (*MessageTool) Parameters ¶
func (t *MessageTool) Parameters() map[string]any
func (*MessageTool) ResetSentInRound ¶
func (t *MessageTool) ResetSentInRound(sessionKey string)
ResetSentInRound resets the per-round send tracker for the given session key. Called by the agent loop at the start of each inbound message processing round.
func (*MessageTool) SetSendCallback ¶
func (t *MessageTool) SetSendCallback(callback SendCallbackWithContext)
type PerplexitySearchProvider ¶
type PerplexitySearchProvider struct {
// contains filtered or unexported fields
}
type ReactionCallback ¶
type ReactionTool ¶
type ReactionTool struct {
// contains filtered or unexported fields
}
func NewReactionTool ¶
func NewReactionTool() *ReactionTool
func (*ReactionTool) Description ¶
func (t *ReactionTool) Description() string
func (*ReactionTool) Execute ¶
func (t *ReactionTool) Execute(ctx context.Context, args map[string]any) *ToolResult
func (*ReactionTool) Name ¶
func (t *ReactionTool) Name() string
func (*ReactionTool) Parameters ¶
func (t *ReactionTool) Parameters() map[string]any
func (*ReactionTool) SetReactionCallback ¶
func (t *ReactionTool) SetReactionCallback(callback ReactionCallback)
type SearXNGSearchProvider ¶
type SearXNGSearchProvider struct {
// contains filtered or unexported fields
}
type SearchProvider ¶
type SearchResultItem ¶
type SendCallbackWithContext ¶
type SendTTSTool ¶
type SendTTSTool struct {
// contains filtered or unexported fields
}
func NewSendTTSTool ¶
func NewSendTTSTool(provider tts.TTSProvider, store media.MediaStore) *SendTTSTool
func (*SendTTSTool) Description ¶
func (t *SendTTSTool) Description() string
func (*SendTTSTool) Execute ¶
func (t *SendTTSTool) Execute(ctx context.Context, args map[string]any) *ToolResult
func (*SendTTSTool) Name ¶
func (t *SendTTSTool) Name() string
func (*SendTTSTool) Parameters ¶
func (t *SendTTSTool) Parameters() map[string]any
func (*SendTTSTool) SetMediaStore ¶
func (t *SendTTSTool) SetMediaStore(store media.MediaStore)
type SogouSearchProvider ¶
type SogouSearchProvider struct {
// contains filtered or unexported fields
}
type TavilySearchProvider ¶
type TavilySearchProvider struct {
// contains filtered or unexported fields
}
type Tool ¶
type Tool = toolshared.Tool
type ToolResult ¶
type ToolResult = toolshared.ToolResult
func ErrorResult ¶
func ErrorResult(message string) *ToolResult
func MediaResult ¶
func MediaResult(forLLM string, mediaRefs []string) *ToolResult
func NewToolResult ¶
func NewToolResult(forLLM string) *ToolResult
func SilentResult ¶
func SilentResult(forLLM string) *ToolResult
func UserResult ¶
func UserResult(content string) *ToolResult
type WebFetchTool ¶
type WebFetchTool struct {
// contains filtered or unexported fields
}
func NewWebFetchTool ¶
func NewWebFetchTool(maxChars int, format string, fetchLimitBytes int64) (*WebFetchTool, error)
func (*WebFetchTool) Description ¶
func (t *WebFetchTool) Description() string
func (*WebFetchTool) Execute ¶
func (t *WebFetchTool) Execute(ctx context.Context, args map[string]any) *ToolResult
func (*WebFetchTool) Name ¶
func (t *WebFetchTool) Name() string
func (*WebFetchTool) Parameters ¶
func (t *WebFetchTool) Parameters() map[string]any
type WebSearchTool ¶
type WebSearchTool struct {
// contains filtered or unexported fields
}
func NewWebSearchTool ¶
func NewWebSearchTool(opts WebSearchToolOptions) (*WebSearchTool, error)
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(ctx context.Context, args map[string]any) *ToolResult
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
func (*WebSearchTool) Parameters ¶
func (t *WebSearchTool) Parameters() map[string]any
type WebSearchToolOptions ¶
type WebSearchToolOptions struct {
Provider string
BraveAPIKeys []string
BraveMaxResults int
BraveEnabled bool
TavilyAPIKeys []string
TavilyBaseURL string
TavilyMaxResults int
TavilyEnabled bool
SogouMaxResults int
SogouEnabled bool
DuckDuckGoMaxResults int
DuckDuckGoEnabled bool
PerplexityAPIKeys []string
PerplexityMaxResults int
PerplexityEnabled bool
SearXNGBaseURL string
SearXNGMaxResults int
SearXNGEnabled bool
GLMSearchAPIKey string
GLMSearchBaseURL string
GLMSearchEngine string
GLMSearchMaxResults int
GLMSearchEnabled bool
BaiduSearchAPIKey string
BaiduSearchBaseURL string
BaiduSearchMaxResults int
BaiduSearchEnabled bool
Proxy string
}
func WebSearchToolOptionsFromConfig ¶ added in v0.2.8
func WebSearchToolOptionsFromConfig(cfg *config.Config) WebSearchToolOptions