Documentation
¶
Overview ¶
Package common holds shared configuration and agent options for the agent_with_memory examples.
Index ¶
- Constants
- func AgentOptions(cfg *excfg.Config, llmClient interfaces.LLMClient, log logger.Logger, ...) []agent.Option
- func MemoryConfig(store interfaces.Memory, settings *Settings, mode memory.StoreMode) memory.Config
- func OpenAIEmbedFunc(settings *Settings) (pgmem.EmbedFunc, error)
- func ParseStoreMode(raw string) (memory.StoreMode, error)
- func RunAgent(ctx context.Context, a *agent.Agent, userID, label, prompt string) *agent.AgentRunResult
- func RunFromArgs(ctx context.Context, a *agent.Agent, userID string, storeMode memory.StoreMode)
- func ScopedContext(ctx context.Context, userID string) context.Context
- func StoreModeHint(mode memory.StoreMode) string
- func ValidateEmbeddingConfig(settings *Settings) error
- type Settings
Constants ¶
const ( // DefaultStorePrompt is run 1 in the two-turn demo. DefaultStorePrompt = "Remember for all future runs: I prefer concise answers. Persist this preference to long-term memory before you reply." // DefaultRecallPrompt is run 2 in the two-turn demo. DefaultRecallPrompt = "What answer style do I prefer?" )
Variables ¶
This section is empty.
Functions ¶
func AgentOptions ¶
func AgentOptions( cfg *excfg.Config, llmClient interfaces.LLMClient, log logger.Logger, settings *Settings, memCfg memory.Config, backendLabel string, ) []agent.Option
AgentOptions builds shared agent options: runtime, LLM, memory, and system prompt.
func MemoryConfig ¶
MemoryConfig builds memory.Config from settings, backend, and store mode.
func OpenAIEmbedFunc ¶
OpenAIEmbedFunc returns a pgmem.EmbedFunc that calls an OpenAI-compatible embeddings API.
func ParseStoreMode ¶
ParseStoreMode reads MEMORY_STORE_MODE (always | ondemand). Empty defaults to ondemand.
func RunAgent ¶
func RunAgent(ctx context.Context, a *agent.Agent, userID, label, prompt string) *agent.AgentRunResult
RunAgent executes one prompt and prints the assistant reply plus optional footers.
func RunFromArgs ¶
RunFromArgs runs the two-turn store/recall demo when no CLI args are given; otherwise a single custom prompt.
func ScopedContext ¶
ScopedContext attaches the demo user id for memory scope resolution.
func StoreModeHint ¶
StoreModeHint returns a one-line demo hint for the configured store mode.
func ValidateEmbeddingConfig ¶
ValidateEmbeddingConfig ensures pgvector can call an OpenAI-compatible embeddings API.
Types ¶
type Settings ¶
type Settings struct {
UserID string
StoreMode memory.StoreMode
RecallEnabled bool
RecallLimit int
RecallMinScore float32
// Weaviate
WeaviateHost string
WeaviateScheme string
WeaviateClass string
WeaviateMemoryClass string
// PostgreSQL / pgvector
PGDSN string
PGMemoryTable string
PGEmbeddingCol string
EmbeddingModel string
EmbeddingBaseURL string
EmbeddingAPIKey string
}
Settings holds env-driven values shared by the weaviate and pgvector example entry points.
func LoadSettings ¶
LoadSettings reads memory example env vars. LLM and Temporal vars come from examples/config.LoadFromEnv.