Documentation
¶
Index ¶
- Constants
- func AgentEnabled(name string) bool
- func AgentModelName(name string) string
- func BaseTemplate() prompt.ChatTemplate
- func ChatModel(ctx context.Context, modelName string) (model.ToolCallingChatModel, error)
- func CountMessageTokens(messages []*schema.Message) (int, error)
- func CountToken(text string) int
- func DefaultMultiChatTemplate() prompt.ChatTemplate
- func DefaultTemplate() prompt.ChatTemplate
- func Generate(ctx context.Context, llm model.ToolCallingChatModel, in []*schema.Message) (*schema.Message, error)
- func GetModel(modelName string) config.Model
- func LLMGenerate(ctx context.Context, modelName, prompt string) (string, error)
- func ReactAgent(ctx context.Context, modelName string, tools []tool.BaseTool) (*react.Agent, error)
- func Stream(ctx context.Context, llm model.ToolCallingChatModel, in []*schema.Message) (*schema.StreamReader[*schema.Message], error)
Constants ¶
View Source
const ( AgentChat = "chat" AgentReact = "react" AgentRepoReviewComment = "repo-review-comment" AgentNewsSummary = "news-summary" AgentBillClassify = "bill-classify" AgentExtractTags = "extract-tags" AgentSimilarTags = "similar-tags" )
Agent type constants.
View Source
const ( ProviderOpenAI = "openai" ProviderOpenAICompatible = "openai-compatible" )
Model provider type constants.
Variables ¶
This section is empty.
Functions ¶
func AgentEnabled ¶ added in v0.31.1
AgentEnabled checks if the specified agent is enabled.
func AgentModelName ¶ added in v0.31.1
AgentModelName returns the model name for the specified agent.
func BaseTemplate ¶ added in v0.28.12
func BaseTemplate() prompt.ChatTemplate
BaseTemplate returns the base template (without chat history).
func CountMessageTokens ¶ added in v0.28.11
CountMessageTokens counts the total number of tokens in a message list.
func CountToken ¶ added in v0.28.11
CountToken counts the number of tokens in text.
func DefaultMultiChatTemplate ¶ added in v0.27.1
func DefaultMultiChatTemplate() prompt.ChatTemplate
DefaultMultiChatTemplate returns the default multi-turn conversation template.
func DefaultTemplate ¶
func DefaultTemplate() prompt.ChatTemplate
DefaultTemplate returns the default single-turn conversation template.
func Generate ¶
func Generate(ctx context.Context, llm model.ToolCallingChatModel, in []*schema.Message) (*schema.Message, error)
Generate generates an LLM response.
func LLMGenerate ¶ added in v0.28.1
LLMGenerate generates a text response using the specified model.
func ReactAgent ¶
ReactAgent creates a React agent instance.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.