Documentation ¶
Index ¶
- Constants
- type BotConversation
- func (b *BotConversation) AddUserPost(post *model.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 BuiltInToolsFunc
- type ConversationContext
- type ImageGenerator
- type LLMConfig
- type LanguageModel
- type LanguageModelOption
- type Post
- type PostRole
- type Prompts
- type ServiceConfig
- type TextStreamResult
- type Tool
- type ToolArgumentGetter
- type ToolStore
- 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" )
Conviance 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 ¶
This section is empty.
Types ¶
type BotConversation ¶
type BotConversation struct { Posts []Post Tools ToolStore Context ConversationContext }
func ThreadToBotConversation ¶
func ThreadToBotConversation(botID string, posts []*model.Post) BotConversation
func (*BotConversation) AddUserPost ¶
func (b *BotConversation) AddUserPost(post *model.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 BuiltInToolsFunc ¶ added in v0.6.0
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 }
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 NewPrompts ¶
func NewPrompts(input fs.FS, getBuiltInTools BuiltInToolsFunc) (*Prompts, error)
func (*Prompts) ChatCompletion ¶
func (p *Prompts) ChatCompletion(templateName string, context ConversationContext) (BotConversation, error)
type ServiceConfig ¶ added in v0.5.0
type ServiceConfig struct { Name string `json:"name"` ServiceName string `json:"serviceName"` APIKey string `json:"apiKey"` OrgID string `json:"orgId"` DefaultModel string `json:"defaultModel"` URL string `json:"url"` 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 NewToolStore ¶ added in v0.3.0
func NewToolStore() ToolStore
func (*ToolStore) ResolveTool ¶ added in v0.3.0
func (s *ToolStore) ResolveTool(name string, argsGetter ToolArgumentGetter, context ConversationContext) (string, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.