Documentation
¶
Index ¶
- type ChatAgent
- func (agent *ChatAgent) AddSystemMessage(context string) error
- func (agent *ChatAgent) Ask(question string) (agents.ChatResponse, error)
- func (agent *ChatAgent) AskStream(question string, callback func(agents.ChatResponse) error) (agents.ChatResponse, error)
- func (agent *ChatAgent) AskStreamWithMemory(question string, callback func(agents.ChatResponse) error) (agents.ChatResponse, error)
- func (agent *ChatAgent) AskWithMemory(question string) (agents.ChatResponse, error)
- func (agent *ChatAgent) GetChatFlowWithMemory() *core.Flow[*agents.ChatRequest, *agents.ChatResponse, struct{}]
- func (agent *ChatAgent) GetChatStreamFlowWithMemory() *core.Flow[*agents.ChatRequest, *agents.ChatResponse, agents.ChatResponse]
- func (agent *ChatAgent) GetCurrentContextSize() int
- func (agent *ChatAgent) GetInfo() (agents.AgentInfo, error)
- func (agent *ChatAgent) GetMessages() []*ai.Message
- func (agent *ChatAgent) GetName() string
- func (agent *ChatAgent) GetStreamCancel() context.CancelFunc
- func (agent *ChatAgent) Kind() agents.AgentKind
- func (agent *ChatAgent) ReplaceMessagesWith(messages []*ai.Message) error
- func (agent *ChatAgent) ReplaceMessagesWithSystemMessages(systemMessages []string) error
- type ChatAgentOption
- func EnableChatFlow() ChatAgentOption
- func EnableChatFlowWithMemory() ChatAgentOption
- func EnableChatStreamFlow() ChatAgentOption
- func EnableChatStreamFlowWithMemory() ChatAgentOption
- func WithLogLevel(level logger.LogLevel) ChatAgentOption
- func WithLogger(log logger.Logger) ChatAgentOption
- func WithVerbose(verbose bool) ChatAgentOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatAgent ¶
type ChatAgent struct {
Name string
SystemInstructions string
ModelID string
Messages []*ai.Message
Config models.ModelConfig
// contains filtered or unexported fields
}
func NewChatAgent ¶
func NewChatAgent( ctx context.Context, agentConfig agents.AgentConfig, modelConfig models.ModelConfig, opts ...ChatAgentOption) (*ChatAgent, error)
func (*ChatAgent) AddSystemMessage ¶
func (*ChatAgent) Ask ¶
func (agent *ChatAgent) Ask(question string) (agents.ChatResponse, error)
IMPORTANT: this function uses the chat flow WITHOUT memory
func (*ChatAgent) AskStream ¶
func (agent *ChatAgent) AskStream(question string, callback func(agents.ChatResponse) error) (agents.ChatResponse, error)
IMPORTANT: this function uses the chat stream flow WITHOUT memory
func (*ChatAgent) AskStreamWithMemory ¶
func (agent *ChatAgent) AskStreamWithMemory(question string, callback func(agents.ChatResponse) error) (agents.ChatResponse, error)
IMPORTANT: this function uses the chat stream flow with memory
func (*ChatAgent) AskWithMemory ¶
func (agent *ChatAgent) AskWithMemory(question string) (agents.ChatResponse, error)
IMPORTANT: this function uses the chat flow with memory
func (*ChatAgent) GetChatFlowWithMemory ¶
func (agent *ChatAgent) GetChatFlowWithMemory() *core.Flow[*agents.ChatRequest, *agents.ChatResponse, struct{}]
func (*ChatAgent) GetChatStreamFlowWithMemory ¶
func (agent *ChatAgent) GetChatStreamFlowWithMemory() *core.Flow[*agents.ChatRequest, *agents.ChatResponse, agents.ChatResponse]
func (*ChatAgent) GetCurrentContextSize ¶
func (*ChatAgent) GetMessages ¶
func (*ChatAgent) GetStreamCancel ¶
func (agent *ChatAgent) GetStreamCancel() context.CancelFunc
func (*ChatAgent) ReplaceMessagesWith ¶
func (*ChatAgent) ReplaceMessagesWithSystemMessages ¶
type ChatAgentOption ¶
type ChatAgentOption func(*ChatAgent)
AgentServerOption defines a functional option for configuring the agent
func EnableChatFlow ¶
func EnableChatFlow() ChatAgentOption
EnableChatFlowWithMemory initializes the chat flow for the agent
func EnableChatFlowWithMemory ¶
func EnableChatFlowWithMemory() ChatAgentOption
EnableChatFlowWithMemory initializes the chat flow for the agent
func EnableChatStreamFlow ¶
func EnableChatStreamFlow() ChatAgentOption
EnableChatStreamFlowWithMemory initializes the chat stream flow for the agent
func EnableChatStreamFlowWithMemory ¶
func EnableChatStreamFlowWithMemory() ChatAgentOption
EnableChatStreamFlowWithMemory initializes the chat stream flow for the agent with conversational memory support.
func WithLogLevel ¶
func WithLogLevel(level logger.LogLevel) ChatAgentOption
WithLogLevel sets the log level for the agent
func WithLogger ¶
func WithLogger(log logger.Logger) ChatAgentOption
WithLogger sets a custom logger for the agent
func WithVerbose ¶
func WithVerbose(verbose bool) ChatAgentOption
WithVerbose enables verbose logging (INFO level) with agent name prefix