Documentation
¶
Overview ¶
Package tools provides tool execution for the laplaced Telegram bot.
It handles all tool execution for the Laplace agent: - Memory tools: add, update, delete facts - People tools: create, update, delete, merge people - Search tools: search history and people - Model tools: custom LLM calls
The ToolExecutor dispatches tool calls to appropriate handlers and manages access to repositories and services.
Package tools provides tool execution for the laplaced bot. It handles fact management, people management, and search tools.
Index ¶
- func ParseFactID(v interface{}) (int64, error)
- func ParsePersonID(v interface{}) (int64, error)
- type MemoryOpParams
- type ToolExecutor
- func (e *ToolExecutor) ExecuteToolCall(ctx context.Context, userID int64, toolName string, arguments string) (string, error)
- func (e *ToolExecutor) SetAgentLogger(logger *agentlog.Logger)
- func (e *ToolExecutor) SetPeopleRepository(repo storage.PeopleRepository)
- func (e *ToolExecutor) SetRAGService(svc *rag.Service)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseFactID ¶
ParseFactID extracts fact ID from string "Fact:123" format or int. Prefers "Fact:123" format, falls back to numeric for backward compatibility.
func ParsePersonID ¶
ParsePersonID extracts person ID from string "Person:123" format or int. Prefers "Person:123" format, falls back to numeric for backward compatibility.
Types ¶
type MemoryOpParams ¶
type MemoryOpParams struct {
Action string
Content string
Category string
FactType string
Reason string
Importance int
FactID int64
}
MemoryOpParams holds parsed parameters for a memory operation.
func ParseMemoryOpParams ¶
func ParseMemoryOpParams(params map[string]interface{}) (MemoryOpParams, error)
ParseMemoryOpParams extracts operation parameters from a map. Returns error if fact_id is provided but invalid.
type ToolExecutor ¶
type ToolExecutor struct {
// contains filtered or unexported fields
}
ToolExecutor handles tool execution for the bot. It dispatches tool calls to appropriate handlers and manages access to repositories and services.
func NewToolExecutor ¶
func NewToolExecutor( orClient openrouter.Client, factRepo storage.FactRepository, factHistoryRepo storage.FactHistoryRepository, cfg *config.Config, logger *slog.Logger, ) *ToolExecutor
NewToolExecutor creates a new ToolExecutor with required dependencies.
func (*ToolExecutor) ExecuteToolCall ¶
func (e *ToolExecutor) ExecuteToolCall(ctx context.Context, userID int64, toolName string, arguments string) (string, error)
ExecuteToolCall dispatches tool execution by name.
func (*ToolExecutor) SetAgentLogger ¶
func (e *ToolExecutor) SetAgentLogger(logger *agentlog.Logger)
SetAgentLogger sets the optional agent logger for Scout logging.
func (*ToolExecutor) SetPeopleRepository ¶
func (e *ToolExecutor) SetPeopleRepository(repo storage.PeopleRepository)
SetPeopleRepository sets the optional people repository.
func (*ToolExecutor) SetRAGService ¶
func (e *ToolExecutor) SetRAGService(svc *rag.Service)
SetRAGService sets the optional RAG service for search tools.