Documentation
¶
Overview ¶
Package agents include BaseAgent
Index ¶
- type Agent
- func (a *Agent[I, O]) RegisterSystemPromptContextProvider(provider systemprompt.ContextProvider)
- func (a *Agent[I, O]) ResetMemory()
- func (a *Agent[I, O]) Run(ctx context.Context, userInput *I, output *O, apiResp *components.ApiResponse) error
- func (a *Agent[I, O]) SetClient(clt instructor.Instructor)
- func (a *Agent[I, O]) SetMaxTokens(maxTokens int)
- func (a *Agent[I, O]) SetMemory(m *components.Memory)
- func (a *Agent[I, O]) SetModel(model string)
- func (a *Agent[I, O]) SetSystemPromptGenerator(g *systemprompt.Generator)
- func (a *Agent[I, O]) SetTemperature(temperature float32)
- func (a *Agent[I, O]) SystemPrompt() string
- func (a *Agent[I, O]) SystemPromptContextProvider(title string) (systemprompt.ContextProvider, error)
- func (a *Agent[I, O]) UnregisterSystemPromptContextProvider(title string)
- type AgentSetter
- type Config
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
Agent class for chat agents. This class provides the core functionality for handling chat interactions, including managing memory, generating system prompts, and obtaining responses from a language model.
func (*Agent[I, O]) RegisterSystemPromptContextProvider ¶
func (a *Agent[I, O]) RegisterSystemPromptContextProvider(provider systemprompt.ContextProvider)
RegisterSystemPromptContextProvider registers a new context provider
func (*Agent[I, O]) ResetMemory ¶
func (a *Agent[I, O]) ResetMemory()
ResetMemory resets the memory to its initial state
func (*Agent[I, O]) Run ¶
func (a *Agent[I, O]) Run(ctx context.Context, userInput *I, output *O, apiResp *components.ApiResponse) error
Run runs the chat agent with the given user input synchronously.
func (*Agent[I, O]) SetClient ¶
func (a *Agent[I, O]) SetClient(clt instructor.Instructor)
func (*Agent[I, O]) SetMaxTokens ¶
func (*Agent[I, O]) SetMemory ¶
func (a *Agent[I, O]) SetMemory(m *components.Memory)
func (*Agent[I, O]) SetSystemPromptGenerator ¶
func (a *Agent[I, O]) SetSystemPromptGenerator(g *systemprompt.Generator)
func (*Agent[I, O]) SetTemperature ¶
func (*Agent[I, O]) SystemPrompt ¶
SystemPrompt returns the system prompt
func (*Agent[I, O]) SystemPromptContextProvider ¶
func (a *Agent[I, O]) SystemPromptContextProvider(title string) (systemprompt.ContextProvider, error)
SystemPromptContextProvider returns agent systemPromptGenerator's context provider
func (*Agent[I, O]) UnregisterSystemPromptContextProvider ¶
RegisterSystemPromptContextProvider Unregisters an existing context provider.
type AgentSetter ¶
type AgentSetter interface {
SetClient(clt instructor.Instructor)
SetMemory(m *components.Memory)
SetSystemPromptGenerator(g *systemprompt.Generator)
SetModel(model string)
SetTemperature(temperature float32)
SetMaxTokens(maxTokens int)
}
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents general agents configuration
type Option ¶
type Option func(a *Config)
func WithClient ¶
func WithClient(clt instructor.Instructor) Option
func WithMaxTokens ¶
func WithMemory ¶
func WithMemory(m *components.Memory) Option
func WithSystemPromptGenerator ¶
func WithSystemPromptGenerator(g *systemprompt.Generator) Option