Documentation
¶
Index ¶
- type AgentOption
- type ChatAgent
- func (ca *ChatAgent) Chat(message string, opts ...*ChatOptions) (*ChatResponse, error)
- func (ca *ChatAgent) ClearMemory() error
- func (ca *ChatAgent) Forget(key string) error
- func (ca *ChatAgent) GetMemory() map[string]string
- func (ca *ChatAgent) Recall(key string) (string, bool)
- func (ca *ChatAgent) RegisterTool(tool types.Tool) error
- func (ca *ChatAgent) Remember(key, value string) error
- func (ca *ChatAgent) Reset(clearMemory bool) error
- type ChatOptions
- type ChatResponse
- type MemoryMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentOption ¶
AgentOption configures the ChatAgent
func WithMemoryContext ¶
func WithMemoryContext() AgentOption
WithMemoryContext enables automatic memory inclusion in system prompts
func WithMemoryPersistence ¶
func WithMemoryPersistence(filepath string) AgentOption
WithMemoryPersistence enables automatic memory saving/loading
func WithMemoryTools ¶
func WithMemoryTools() AgentOption
WithMemoryTools enables memory tools (remember_fact, recall_fact)
type ChatAgent ¶
type ChatAgent struct {
// contains filtered or unexported fields
}
ChatAgent maintains conversation state and handles tool execution
func New ¶
func New(apiKey string, opts ...AgentOption) (*ChatAgent, error)
New creates a new ChatAgent with optional configuration
func (*ChatAgent) Chat ¶
func (ca *ChatAgent) Chat(message string, opts ...*ChatOptions) (*ChatResponse, error)
Chat sends a message and handles tool execution automatically
func (*ChatAgent) ClearMemory ¶
ClearMemory removes all keys from persistent memory
func (*ChatAgent) RegisterTool ¶
RegisterTool adds a tool that GPT can use
type ChatOptions ¶
type ChatOptions struct {
Schema string // JSON schema for structured output
SystemPrompt string // System prompt for this specific message
Temperature float64 // Temperature for response randomness (0.0-1.0, -1 = use default)
MaxTokens int // Maximum tokens in response (0 = omit from request)
Files []types.FileUploadResponse // File attachments to include in the message
}
ChatOptions provides optional parameters for chat requests
type ChatResponse ¶
type ChatResponse struct {
Text string // Extracted text response
Raw *types.Response // Full API response
}
ChatResponse contains both extracted text and full raw response
type MemoryMode ¶
type MemoryMode int
MemoryMode controls memory behavior using bitwise flags
const ( MemoryDisabled MemoryMode = 0 MemoryContext MemoryMode = 1 << 0 // Auto-include in system prompts MemoryTools MemoryMode = 1 << 1 // Expose remember/recall as tools MemoryPersistence MemoryMode = 1 << 2 // Auto-save to disk )