llm

package
v0.0.0-...-a56952b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conversation

type Conversation interface {
	Chat(ctx context.Context, message string, inputs map[string]any) (string, error)
}

type ConversationMgr

type ConversationMgr interface {
	NewConversation(ctx context.Context, sessionID string) (Conversation, error)
}

func NewConversationMgr

func NewConversationMgr(
	llmmodel llms.Model, configFile string, mcpBaseUrls []string,
	opts ...ConversationMgrOption,
) (ConversationMgr, error)

type ConversationMgrOption

type ConversationMgrOption func(mgr *conversationMgr)

func WithConversationMemoryMongo

func WithConversationMemoryMongo(baseUrl, dbName, collectionName string) ConversationMgrOption

type ConversationPromptConfig

type ConversationPromptConfig struct {
	SystemPrompt *struct {
		Template string   `yaml:"template"`
		Inputs   []string `yaml:"input_variables"`
	} `yaml:"system_prompt"`
}

type LLMReply

type LLMReply interface {
	MessageTextReply(
		ctx context.Context, typ linebot.EventSourceType,
		groupID, userID, msg string, mysession sessions.Session,
	) ([]linebot.SendingMessage, error)
}

func NewLLMTextReply

func NewLLMTextReply(
	ctx context.Context, opts ...LLMReplyOption,
) (LLMReply, error)

type LLMReplyConfig

type LLMReplyConfig struct {
	Model           string
	APIKey          string
	ConfigFile      string
	MongoURI        string
	MongoDB         string
	MongoCollection string
	MCPBaseUrls     []string
	AllowMsgType    []linebot.EventSourceType
	AllowUser       bool
}

type LLMReplyOption

type LLMReplyOption func(cfg *LLMReplyConfig)

func WithAPIKey

func WithAPIKey(apiKey string) LLMReplyOption

func WithAllowMsgType

func WithAllowMsgType(allowMsgType []linebot.EventSourceType) LLMReplyOption

func WithAllowUser

func WithAllowUser(allowUser bool) LLMReplyOption

func WithConfigFile

func WithConfigFile(configFile string) LLMReplyOption

func WithMCPBaseUrls

func WithMCPBaseUrls(mcpBaseUrls []string) LLMReplyOption

func WithModel

func WithModel(model string) LLMReplyOption

func WithMongo

func WithMongo(mongoURI string, db, collection string) LLMReplyOption

type MemoryMongoCfg

type MemoryMongoCfg struct {
	ConnectionURL  string `yaml:"connection_url"`
	DatabaseName   string `yaml:"database_name"`
	CollectionName string `yaml:"collection_name"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL