Documentation ¶
Index ¶
- Constants
- func ConvertMessagesToOpenAIMessages(messages []*Message) ([]openai.ChatCompletionMessage, error)
- func RunIntoWriter(ctx context2.Context, c GeppettoRunnable, manager *Manager, w io.Writer) error
- func RunToString(ctx context2.Context, c GeppettoRunnable, manager *Manager) (string, error)
- type GeppettoRunnable
- 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) PrependMessages(messages ...*Message)
- func (c *Manager) SaveToFile(s string) error
- 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 RoleTool = "tool"
View Source
const RoleUser = "user"
Variables ¶
This section is empty.
Functions ¶
func RunIntoWriter ¶ added in v0.2.24
func RunToString ¶ added in v0.2.24
Types ¶
type GeppettoRunnable ¶ added in v0.2.24
type Manager ¶
func CreateManager ¶ added in v0.2.24
func NewManager ¶
func NewManager(options ...ManagerOption) *Manager
func RunToContextManager ¶ added in v0.2.24
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) PrependMessages ¶ added in v0.2.24
func (*Manager) SaveToFile ¶ added in v0.2.24
func (*Manager) SetMessages ¶
func (*Manager) SetSystemPrompt ¶
type ManagerOption ¶
type ManagerOption func(*Manager)
func WithAddMessages ¶ added in v0.2.24
func WithAddMessages(messages ...*Message) ManagerOption
func WithMessages ¶
func WithMessages(messages []*Message) ManagerOption
func WithSystemPrompt ¶
func WithSystemPrompt(systemPrompt string) ManagerOption
type Message ¶
type Message struct { Text string `json:"text" yaml:"text"` Time time.Time `json:"time" yaml:"time"` Role string `json:"role" yaml:"role"` // additional metadata for the message Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"` }
func LoadFromFile ¶
LoadFromFile loads messages from a json file or yaml file
Click to show internal directories.
Click to hide internal directories.