Documentation ¶
Index ¶
- Constants
- func ConvertMessagesToOpenAIMessages(messages []*Message) ([]openai.ChatCompletionMessage, error)
- type Manager
- func (c *Manager) AddMessages(messages ...*Message)
- func (c *Manager) GetMessages() []*Message
- func (c *Manager) GetMessagesWithSystemPrompt() []*Message
- func (c *Manager) GetSinglePrompt() string
- func (c *Manager) GetSystemPrompt() string
- func (c *Manager) SetMessages(messages []*Message)
- func (c *Manager) SetSystemPrompt(systemPrompt string)
- type ManagerOption
- type Message
Constants ¶
View Source
const RoleAssistant = "assistant"
View Source
const RoleSystem = "system"
View Source
const RoleUser = "user"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Manager ¶
func NewManager ¶
func NewManager(options ...ManagerOption) *Manager
func (*Manager) AddMessages ¶
func (*Manager) GetMessages ¶
func (*Manager) GetMessagesWithSystemPrompt ¶
GetMessagesWithSystemPrompt returns all messages with the system prompt prepended
func (*Manager) GetSinglePrompt ¶
GetSinglePrompt is a helper to use the context manager with a completion api. It just concatenates all the messages together with a prompt in front (if there are more than one message).
func (*Manager) GetSystemPrompt ¶
func (*Manager) SetMessages ¶
func (*Manager) SetSystemPrompt ¶
type ManagerOption ¶
type ManagerOption func(*Manager)
func WithMessages ¶
func WithMessages(messages []*Message) ManagerOption
func WithSystemPrompt ¶
func WithSystemPrompt(systemPrompt string) ManagerOption
Click to show internal directories.
Click to hide internal directories.