Documentation
¶
Index ¶
- Constants
- func FormatPostBody(post *model.Post) string
- type BotConfig
- type BotConversation
- func (b *BotConversation) AddPost(post Post)
- func (b *BotConversation) AppendConversation(conversation BotConversation)
- func (b *BotConversation) ExtractSystemMessage() string
- func (b BotConversation) String() string
- func (b *BotConversation) Truncate(maxTokens int, countTokens func(string) int) bool
- type ConversationContext
- type File
- type ImageGenerator
- type LLMConfig
- type LanguageModel
- type LanguageModelOption
- type Post
- type PostRole
- type Prompts
- type ServiceConfig
- type TextStreamResult
- type Tool
- type ToolArgumentGetter
- type ToolStore
- func (s *ToolStore) AddTools(tools []Tool)
- func (s *ToolStore) GetTools() []Tool
- func (s *ToolStore) ResolveTool(name string, argsGetter ToolArgumentGetter, context ConversationContext) (string, error)
- func (s *ToolStore) TraceResolved(name string, argsGetter ToolArgumentGetter, result string)
- func (s *ToolStore) TraceUnknown(name string, argsGetter ToolArgumentGetter)
- type TraceLog
- type Transcriber
Constants ¶
View Source
const ( PromptSummarizeThread = "summarize_thread" PromptDirectMessageQuestion = "direct_message_question" PromptEmojiSelect = "emoji_select" PromptMeetingSummary = "meeting_summary" PromptMeetingSummaryOnly = "summary_only" PromptMeetingKeyPoints = "meeting_key_points" PromptSpellcheck = "spellcheck" PromptChangeTone = "change_tone" PromptSimplifyText = "simplify_text" PromptAIChangeText = "ai_change_text" PromptSummarizeChannelSince = "summarize_channel_since" PromptSummarizeChunk = "summarize_chunk" PromptExplainCode = "explain_code" PromptSuggestCodeImprovements = "suggest_code_improvements" PromptFindActionItemsSince = "find_action_items_since" PromptFindOpenQuestionsSince = "find_open_questions_since" )
Convenience vars for the filenames in ai/prompts/
View Source
const PromptExtension = "tmpl"
View Source
const SystemSubTemplateName = ".system"
View Source
const UserSubTemplateName = ".user"
Variables ¶
This section is empty.
Functions ¶
func FormatPostBody ¶ added in v0.7.0
Types ¶
type BotConfig ¶ added in v0.8.0
type BotConversation ¶
type BotConversation struct { Posts []Post Tools ToolStore Context ConversationContext }
func (*BotConversation) AddPost ¶ added in v0.9.0
func (b *BotConversation) AddPost(post Post)
func (*BotConversation) AppendConversation ¶
func (b *BotConversation) AppendConversation(conversation BotConversation)
func (*BotConversation) ExtractSystemMessage ¶ added in v0.2.0
func (b *BotConversation) ExtractSystemMessage() string
func (BotConversation) String ¶ added in v0.3.0
func (b BotConversation) String() string
type ConversationContext ¶ added in v0.3.0
type ConversationContext struct { BotID string Time string ServerName string CompanyName string RequestingUser *model.User Channel *model.Channel Team *model.Team Post *model.Post PromptParameters map[string]string CustomInstructions string }
func NewConversationContext ¶ added in v0.3.0
func NewConversationContextParametersOnly ¶ added in v0.3.0
func NewConversationContextParametersOnly(promptParameters map[string]string) ConversationContext
func (*ConversationContext) IsDMWithBot ¶ added in v0.6.0
func (c *ConversationContext) IsDMWithBot() bool
func (ConversationContext) String ¶ added in v0.4.0
func (c ConversationContext) String() string
type ImageGenerator ¶
type LanguageModel ¶
type LanguageModel interface { ChatCompletion(conversation BotConversation, opts ...LanguageModelOption) (*TextStreamResult, error) ChatCompletionNoStream(conversation BotConversation, opts ...LanguageModelOption) (string, error) CountTokens(text string) int TokenLimit() int }
type LanguageModelOption ¶
type LanguageModelOption func(*LLMConfig)
func WithMaxGeneratedTokens ¶ added in v0.6.1
func WithMaxGeneratedTokens(maxGeneratedTokens int) LanguageModelOption
func WithModel ¶
func WithModel(model string) LanguageModelOption
type Prompts ¶
type Prompts struct {
// contains filtered or unexported fields
}
func (*Prompts) ChatCompletion ¶
func (p *Prompts) ChatCompletion(templateName string, context ConversationContext, tools ToolStore) (BotConversation, error)
type ServiceConfig ¶ added in v0.5.0
type ServiceConfig struct { Name string `json:"name"` Type string `json:"type"` APIKey string `json:"apiKey"` OrgID string `json:"orgId"` DefaultModel string `json:"defaultModel"` APIURL string `json:"apiURL"` Username string `json:"username"` Password string `json:"password"` TokenLimit int `json:"tokenLimit"` StreamingTimeoutSeconds int `json:"streamingTimeoutSeconds"` }
type TextStreamResult ¶
func NewStreamFromString ¶
func NewStreamFromString(text string) *TextStreamResult
func (*TextStreamResult) ReadAll ¶
func (t *TextStreamResult) ReadAll() string
type Tool ¶ added in v0.3.0
type Tool struct { Name string Description string Schema any Resolver func(context ConversationContext, argsGetter ToolArgumentGetter) (string, error) }
type ToolArgumentGetter ¶ added in v0.3.0
type ToolStore ¶ added in v0.3.0
type ToolStore struct {
// contains filtered or unexported fields
}
func NewNoTools ¶ added in v0.9.0
func NewNoTools() ToolStore
func NewToolStore ¶ added in v0.3.0
func (*ToolStore) ResolveTool ¶ added in v0.3.0
func (s *ToolStore) ResolveTool(name string, argsGetter ToolArgumentGetter, context ConversationContext) (string, error)
func (*ToolStore) TraceResolved ¶ added in v0.9.0
func (s *ToolStore) TraceResolved(name string, argsGetter ToolArgumentGetter, result string)
func (*ToolStore) TraceUnknown ¶ added in v0.9.0
func (s *ToolStore) TraceUnknown(name string, argsGetter ToolArgumentGetter)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.