Documentation
¶
Index ¶
- Constants
- func SetTitleConfigDir(dir string)
- type BlockContent
- type ChatResponsedeprecated
- type Config
- type ConversationPromptData
- type EmbeddingConfig
- type EmbeddingService
- type FunctionCalldeprecated
- type IntentClassifierConfig
- type LLMCallStatsdeprecated
- type LLMConfig
- type LLMServicedeprecated
- type MemoPromptData
- type Messagedeprecated
- type RerankResultdeprecated
- type RerankerConfig
- type RerankerServicedeprecated
- type TitleGenerator
- type TitleGeneratorConfigdeprecated
- type TitlePromptConfig
- type ToolCalldeprecated
- type ToolDescriptordeprecated
- type UniversalParrotConfig
Constants ¶
const ( SimpleTaskMaxTokens = 1024 // Simple tasks don't need many tokens SimpleTaskTemperature = 0.3 // Lower temperature for deterministic output SimpleTaskTimeout = 30 // Shorter timeout for simple tasks (seconds) )
Configuration defaults for simple LLM tasks.
Variables ¶
This section is empty.
Functions ¶
func SetTitleConfigDir ¶ added in v0.100.0
func SetTitleConfigDir(dir string)
SetTitleConfigDir overrides the default config directory.
Types ¶
type BlockContent ¶ added in v0.94.0
BlockContent represents a simplified block for title generation.
type ChatResponse
deprecated
type ChatResponse = llm.ChatResponse
ChatResponse represents the LLM response including potential tool calls.
Deprecated: Use llm.ChatResponse directly.
type Config ¶
type Config struct {
Embedding EmbeddingConfig
Reranker RerankerConfig
IntentClassifier IntentClassifierConfig
LLM LLMConfig
UniversalParrot UniversalParrotConfig // Phase 2: Configuration-driven parrots
Enabled bool
}
Config represents AI configuration.
func NewConfigFromProfile ¶
NewConfigFromProfile creates AI config from profile.
type ConversationPromptData ¶ added in v0.100.0
ConversationPromptData holds data for conversation title template.
type EmbeddingConfig ¶
type EmbeddingConfig struct {
Provider string
Model string
APIKey string
BaseURL string
Dimensions int
}
EmbeddingConfig represents vector embedding configuration.
type EmbeddingService ¶
type EmbeddingService interface {
// Embed generates vector for a single text.
Embed(ctx context.Context, text string) ([]float32, error)
// EmbedBatch generates vectors for multiple texts.
EmbedBatch(ctx context.Context, texts []string) ([][]float32, error)
// Dimensions returns the vector dimension.
Dimensions() int
}
EmbeddingService is the vector embedding service interface.
func NewEmbeddingService ¶
func NewEmbeddingService(cfg *EmbeddingConfig) (EmbeddingService, error)
NewEmbeddingService creates a new EmbeddingService.
Phase 1 Note: This is a bridge compatibility layer that maintains the original API. The actual embedding functionality has been moved to ai/core/embedding/provider.go. Future refactoring will deprecate this file in favor of the core package.
type FunctionCall
deprecated
type FunctionCall = llm.FunctionCall
FunctionCall represents the function details.
Deprecated: Use llm.FunctionCall directly.
type IntentClassifierConfig ¶
type IntentClassifierConfig struct {
Provider string
Model string
APIKey string
BaseURL string
Enabled bool
}
IntentClassifierConfig represents intent classification LLM configuration. Uses a lightweight model for fast, cost-effective classification.
type LLMCallStats
deprecated
added in
v0.94.0
type LLMCallStats = llm.LLMCallStats
LLMCallStats represents statistics for a single LLM call.
Deprecated: Use llm.LLMCallStats directly.
type LLMConfig ¶
type LLMConfig struct {
Provider string // Provider identifier for logging/future extension: zai, deepseek, openai, ollama
Model string // Model name: glm-4.7, deepseek-chat, gpt-4o, etc.
APIKey string
BaseURL string
MaxTokens int // default: 2048
Temperature float32 // default: 0.7
Timeout int // Request timeout in seconds (default: 120)
}
LLMConfig represents LLM configuration.
type LLMService
deprecated
LLMService is the LLM service interface.
Deprecated: Use llm.Service directly.
func NewLLMService ¶
func NewLLMService(cfg *LLMConfig) (LLMService, error)
NewLLMService creates a new LLMService.
Phase 1 Note: This is a bridge compatibility layer that maintains the original API. The actual LLM functionality has been moved to ai/core/llm/service.go.
func NewSimpleTaskLLMService ¶ added in v0.100.1
func NewSimpleTaskLLMService(p *profile.Profile, mainLLM LLMService) LLMService
NewSimpleTaskLLMService creates an LLM service for simple tasks. It uses the Intent provider configuration with fallback to main LLM.
Priority: 1. If AIIntentAPIKey is configured, use Intent provider (siliconflow by default) 2. Otherwise, fallback to main LLM service
Returns nil if both Intent service creation fails and mainLLM is nil. Callers must check for nil return value.
type MemoPromptData ¶ added in v0.100.0
MemoPromptData holds data for memo title template.
type Message
deprecated
Message represents a chat message.
Deprecated: Use llm.Message directly.
func AssistantMessage
deprecated
func FormatMessages
deprecated
func SystemPrompt
deprecated
func UserMessage
deprecated
type RerankResult
deprecated
type RerankerConfig ¶
type RerankerConfig struct {
Provider string
Model string
APIKey string
BaseURL string
Enabled bool
}
RerankerConfig represents reranker configuration.
type RerankerService
deprecated
RerankerService is the reranking service interface.
Deprecated: Use reranker.Service directly.
func NewRerankerService ¶
func NewRerankerService(cfg *RerankerConfig) RerankerService
NewRerankerService creates a new RerankerService.
Phase 1 Note: This is a bridge compatibility layer that maintains the original API. The actual reranker functionality has been moved to ai/core/reranker/service.go.
type TitleGenerator ¶ added in v0.94.0
type TitleGenerator struct {
// contains filtered or unexported fields
}
TitleGenerator generates meaningful titles for AI conversations. Uses configuration from config/prompts/title.yaml.
func NewTitleGenerator
deprecated
added in
v0.94.0
func NewTitleGenerator(cfg TitleGeneratorConfig) *TitleGenerator
NewTitleGenerator creates a new title generator instance.
Deprecated: Use NewTitleGeneratorWithLLM(llm LLMService) instead. This constructor is kept for backward compatibility.
func NewTitleGeneratorWithLLM ¶ added in v0.100.0
func NewTitleGeneratorWithLLM(llmService LLMService) *TitleGenerator
NewTitleGeneratorWithLLM creates a new title generator with an existing LLMService. This is the preferred constructor for dependency injection. Panics if llmService is nil.
func (*TitleGenerator) Generate ¶ added in v0.94.0
func (tg *TitleGenerator) Generate(ctx context.Context, userMessage, aiResponse string) (string, error)
Generate generates a title based on the conversation content.
func (*TitleGenerator) GenerateTitleFromBlocks ¶ added in v0.94.0
func (tg *TitleGenerator) GenerateTitleFromBlocks(ctx context.Context, blocks []BlockContent) (string, error)
GenerateTitleFromBlocks generates a title from a slice of blocks.
type TitleGeneratorConfig
deprecated
added in
v0.94.0
type TitlePromptConfig ¶ added in v0.100.0
type TitlePromptConfig struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
SystemPrompt string `yaml:"system_prompt"`
ConversationTemplate string `yaml:"conversation_template"`
MemoTemplate string `yaml:"memo_template"`
Params struct {
MaxTokens int `yaml:"max_tokens"`
Temperature float64 `yaml:"temperature"`
TimeoutSeconds int `yaml:"timeout_seconds"`
InputTruncateChars int `yaml:"input_truncate_chars"`
MaxRunes int `yaml:"max_runes"`
} `yaml:"params"`
}
TitlePromptConfig holds the configuration for title generation.
func GetTitlePromptConfig ¶ added in v0.100.0
func GetTitlePromptConfig() *TitlePromptConfig
GetTitlePromptConfig returns the global title prompt config, loading if necessary. Falls back to defaults if config file fails to load.
func LoadTitlePromptConfig ¶ added in v0.100.0
func LoadTitlePromptConfig() (*TitlePromptConfig, error)
LoadTitlePromptConfig loads the title prompt configuration from YAML.
func (*TitlePromptConfig) BuildConversationPrompt ¶ added in v0.100.0
func (c *TitlePromptConfig) BuildConversationPrompt(data *ConversationPromptData) (string, error)
BuildConversationPrompt builds the user prompt for conversation title generation.
func (*TitlePromptConfig) BuildMemoPrompt ¶ added in v0.100.0
func (c *TitlePromptConfig) BuildMemoPrompt(data *MemoPromptData) (string, error)
BuildMemoPrompt builds the user prompt for memo title generation.
type ToolDescriptor
deprecated
type ToolDescriptor = llm.ToolDescriptor
ToolDescriptor represents a function/tool available to the LLM.
Deprecated: Use llm.ToolDescriptor directly.
type UniversalParrotConfig ¶ added in v0.94.0
type UniversalParrotConfig struct {
Enabled bool // Enable UniversalParrot for creating parrots from YAML configs
ConfigDir string // Path to parrot YAML configs (default: ./config/parrots)
FallbackMode string // "legacy" | "error" when config load fails (default: legacy)
BaseURL string // Frontend base URL for generating links in prompts
}
UniversalParrotConfig represents configuration for UniversalParrot (configuration-driven parrots).
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent provides conversation context management for multi-turn dialogues.
|
Package agent provides conversation context management for multi-turn dialogues. |
|
events
Package events provides event callback types for the agent system.
|
Package events provides event callback types for the agent system. |
|
orchestrator
Package orchestrator implements the Orchestrator-Workers pattern for multi-agent coordination.
|
Package orchestrator implements the Orchestrator-Workers pattern for multi-agent coordination. |
|
registry
Package registry provides metrics collection for UniversalParrot.
|
Package registry provides metrics collection for UniversalParrot. |
|
tools
Package tools provides tool-level result caching for AI agents.
|
Package tools provides tool-level result caching for AI agents. |
|
tools/schedule
Package schedule provides thin tool adapters for schedule operations.
|
Package schedule provides thin tool adapters for schedule operations. |
|
universal
Package universal provides configuration loading for UniversalParrot.
|
Package universal provides configuration loading for UniversalParrot. |
|
Package aitime provides the time parsing service interface for AI agents.
|
Package aitime provides the time parsing service interface for AI agents. |
|
Package cache provides the cache service interface for AI agents.
|
Package cache provides the cache service interface for AI agents. |
|
Package context provides context building for LLM prompts.
|
Package context provides context building for LLM prompts. |
|
core
|
|
|
Package duplicate provides memo duplicate detection for P2-C002.
|
Package duplicate provides memo duplicate detection for P2-C002. |
|
Package format provides the formatter interface for AI text formatting.
|
Package format provides the formatter interface for AI text formatting. |
|
Package graph - builder implementation for P3-C001.
|
Package graph - builder implementation for P3-C001. |
|
internal
|
|
|
strutil
Package strutil provides string utility functions for the ai package.
|
Package strutil provides string utility functions for the ai package. |
|
Package memory provides the memory extension point for AI agents.
|
Package memory provides the memory extension point for AI agents. |
|
simple
Package simple provides a basic memory generator implementation.
|
Package simple provides a basic memory generator implementation. |
|
observability
|
|
|
logging
Package logging provides structured logging utilities for AI modules.
|
Package logging provides structured logging utilities for AI modules. |
|
metrics
Package metrics provides the evaluation metrics service interface for AI agents.
|
Package metrics provides the evaluation metrics service interface for AI agents. |
|
tracing
Package tracing provides distributed tracing instrumentation for AI modules.
|
Package tracing provides distributed tracing instrumentation for AI modules. |
|
Package review provides intelligent memo review system based on spaced repetition.
|
Package review provides intelligent memo review system based on spaced repetition. |
|
Package routing provides routing result caching for performance optimization.
|
Package routing provides routing result caching for performance optimization. |
|
services
|
|
|
session
Package session provides the session persistence service interface for AI agents.
|
Package session provides the session persistence service interface for AI agents. |
|
stats
Package stats provides cost alerting for agent sessions.
|
Package stats provides cost alerting for agent sessions. |
|
Package tags provides intelligent tag suggestion for memos.
|
Package tags provides intelligent tag suggestion for memos. |
|
Package timeout defines centralized timeout constants for AI operations.
|
Package timeout defines centralized timeout constants for AI operations. |