Documentation
¶
Index ¶
- Constants
- func StringMsgToOpenAiMsg(msg string) openai.ChatCompletionMessage
- type BaseAgent
- type GenericAgent
- func (g *GenericAgent) Chat(msg string, session string) string
- func (g *GenericAgent) GetLogger() ILogger
- func (b *GenericAgent) GetName() string
- func (b *GenericAgent) GetSystemPrompt() string
- func (b *GenericAgent) GetTools() []ITool
- func (g *GenericAgent) Start()
- func (g *GenericAgent) WithBrain(b IBrain) *GenericAgent
- func (g *GenericAgent) WithLogger(logger ILogger) *GenericAgent
- func (g *GenericAgent) WithMemory(memory IMemory) *GenericAgent
- func (g *GenericAgent) WithName(name string) *GenericAgent
- func (b *GenericAgent) WithPromptFunc(pf func() string) *GenericAgent
- func (b *GenericAgent) WithSystemPrompt(prompt string) *GenericAgent
- func (g *GenericAgent) WithTools(tools []ITool) *GenericAgent
- type IAgent
- type IBrain
- type ILogger
- type IMemory
- type ITool
- type OpenAiBrain
Constants ¶
View Source
const RetryPromptPrefix = "The previous response format was incorrect. Please try again and follow the format below."
Variables ¶
This section is empty.
Functions ¶
func StringMsgToOpenAiMsg ¶
func StringMsgToOpenAiMsg(msg string) openai.ChatCompletionMessage
Types ¶
type GenericAgent ¶
func NewGenericAgent ¶
func NewGenericAgent() *GenericAgent
func (*GenericAgent) GetLogger ¶
func (g *GenericAgent) GetLogger() ILogger
func (*GenericAgent) GetName ¶
func (b *GenericAgent) GetName() string
func (*GenericAgent) GetSystemPrompt ¶
func (b *GenericAgent) GetSystemPrompt() string
func (*GenericAgent) GetTools ¶
func (b *GenericAgent) GetTools() []ITool
func (*GenericAgent) Start ¶
func (g *GenericAgent) Start()
func (*GenericAgent) WithBrain ¶
func (g *GenericAgent) WithBrain(b IBrain) *GenericAgent
func (*GenericAgent) WithLogger ¶
func (g *GenericAgent) WithLogger(logger ILogger) *GenericAgent
func (*GenericAgent) WithMemory ¶
func (g *GenericAgent) WithMemory(memory IMemory) *GenericAgent
func (*GenericAgent) WithName ¶
func (g *GenericAgent) WithName(name string) *GenericAgent
func (*GenericAgent) WithPromptFunc ¶ added in v0.0.3
func (b *GenericAgent) WithPromptFunc(pf func() string) *GenericAgent
func (*GenericAgent) WithSystemPrompt ¶
func (b *GenericAgent) WithSystemPrompt(prompt string) *GenericAgent
func (*GenericAgent) WithTools ¶
func (g *GenericAgent) WithTools(tools []ITool) *GenericAgent
type IBrain ¶
type IBrain interface {
ChatCompletion(msgs []openai.ChatCompletionMessage) (msg openai.ChatCompletionMessage, err error)
}
func NewOpenAiBrain ¶
func NewOpenAiBrain() IBrain
type IMemory ¶
type IMemory interface {
GetWithNewMsg(msg openai.ChatCompletionMessage, sessionId string) []openai.ChatCompletionMessage
Add(msg openai.ChatCompletionMessage, sessionId string)
SetSystem(msg string)
}
type OpenAiBrain ¶
type OpenAiBrain struct {
// contains filtered or unexported fields
}
func (*OpenAiBrain) ChatCompletion ¶
func (oab *OpenAiBrain) ChatCompletion(msgs []openai.ChatCompletionMessage) (msg openai.ChatCompletionMessage, err error)
Click to show internal directories.
Click to hide internal directories.