providers

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGlobalTransport added in v1.4.7

func GetGlobalTransport() *http.Transport

func GetPooledHTTPClient added in v1.4.7

func GetPooledHTTPClient() *http.Client

func SetGlobalConnectionPoolConfig added in v1.6.1

func SetGlobalConnectionPoolConfig(config ConnectionPoolConfig)

Types

type ConnectionPoolConfig added in v1.4.7

type ConnectionPoolConfig struct {
	MaxSize     int
	IdleTimeout time.Duration
	DialTimeout time.Duration
	KeepAlive   time.Duration
}

func DefaultConnectionPoolConfig added in v1.4.7

func DefaultConnectionPoolConfig() ConnectionPoolConfig

type LangChainLLMProvider

type LangChainLLMProvider struct {
	// contains filtered or unexported fields
}

LangChainLLMProvider LangChain LLM provider

func NewLangChainLLMProvider

func NewLangChainLLMProvider(model llms.Model, modelName string) *LangChainLLMProvider

NewLangChainLLMProvider creates a new LangChain LLM provider

func (*LangChainLLMProvider) Chat

func (p *LangChainLLMProvider) Chat(messages []types.Message) (types.Message, error)

Chat basic chat functionality

func (*LangChainLLMProvider) ChatStream

func (p *LangChainLLMProvider) ChatStream(messages []types.Message) (<-chan types.StreamMessage, error)

ChatStream streaming chat functionality

func (*LangChainLLMProvider) ChatWithTools

func (p *LangChainLLMProvider) ChatWithTools(messages []types.Message, tools []types.Tool) (types.Message, error)

ChatWithTools chat with tools functionality

func (*LangChainLLMProvider) ChatWithToolsStream

func (p *LangChainLLMProvider) ChatWithToolsStream(messages []types.Message, tools []types.Tool) (<-chan types.StreamMessage, error)

ChatWithToolsStream streaming chat with tools functionality

func (*LangChainLLMProvider) GetModelMetadata

func (p *LangChainLLMProvider) GetModelMetadata() types.ModelMetadata

GetModelMetadata gets the model metadata

func (*LangChainLLMProvider) GetModelName

func (p *LangChainLLMProvider) GetModelName() string

GetModelName gets the model name

func (*LangChainLLMProvider) SetMaxRetries added in v1.4.2

func (p *LangChainLLMProvider) SetMaxRetries(maxRetries int)

SetMaxRetries sets maximum retry attempts

func (*LangChainLLMProvider) SetRetryDelay added in v1.4.2

func (p *LangChainLLMProvider) SetRetryDelay(delay time.Duration)

SetRetryDelay sets retry delay duration

type MessageDocument added in v1.1.0

type MessageDocument struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	SessionID string             `bson:"session_id"`
	Role      string             `bson:"role"`
	Content   string             `bson:"content"`
	Name      string             `bson:"name,omitempty"`
	CreatedAt time.Time          `bson:"created_at"`
}

type MongoDBMemoryProvider added in v1.1.0

type MongoDBMemoryProvider struct {
	// contains filtered or unexported fields
}

func NewMongoDBMemoryProvider added in v1.1.0

func NewMongoDBMemoryProvider(client *mongodb.Client, sessionID string) *MongoDBMemoryProvider

func NewMongoDBMemoryProviderWithLimit added in v1.1.0

func NewMongoDBMemoryProviderWithLimit(client *mongodb.Client, sessionID string, maxHistoryMessages int) *MongoDBMemoryProvider

func (*MongoDBMemoryProvider) AddMessage added in v1.1.0

func (p *MongoDBMemoryProvider) AddMessage(ctx context.Context, message types.Message) error

func (*MongoDBMemoryProvider) Clear added in v1.1.0

func (p *MongoDBMemoryProvider) Clear() error

func (*MongoDBMemoryProvider) CompressMemory added in v1.4.3

func (p *MongoDBMemoryProvider) CompressMemory(llm types.LLMProvider, maxMessages int) error

CompressMemory compresses old messages into a summary (implements MemoryProvider interface)

func (*MongoDBMemoryProvider) GetChatHistory added in v1.1.0

func (p *MongoDBMemoryProvider) GetChatHistory() ([]types.Message, error)

func (*MongoDBMemoryProvider) GetMessages added in v1.1.0

func (p *MongoDBMemoryProvider) GetMessages(ctx context.Context, limit int) ([]types.Message, error)

func (*MongoDBMemoryProvider) LoadMemoryVariables added in v1.1.0

func (p *MongoDBMemoryProvider) LoadMemoryVariables() (map[string]interface{}, error)

func (*MongoDBMemoryProvider) SaveContext added in v1.1.0

func (p *MongoDBMemoryProvider) SaveContext(input, output map[string]interface{}) error

func (*MongoDBMemoryProvider) SetCollectionName added in v1.1.0

func (p *MongoDBMemoryProvider) SetCollectionName(name string)

func (*MongoDBMemoryProvider) SetMaxHistoryMessages added in v1.1.0

func (p *MongoDBMemoryProvider) SetMaxHistoryMessages(limit int)

type MySQLMemoryProvider added in v1.5.0

type MySQLMemoryProvider struct {
	// contains filtered or unexported fields
}

func NewMySQLMemoryProvider added in v1.5.0

func NewMySQLMemoryProvider(client *mysql.Client, sessionID string) *MySQLMemoryProvider

func NewMySQLMemoryProviderWithLimit added in v1.5.0

func NewMySQLMemoryProviderWithLimit(client *mysql.Client, sessionID string, maxHistoryMessages int) *MySQLMemoryProvider

func (*MySQLMemoryProvider) AddMessage added in v1.5.0

func (p *MySQLMemoryProvider) AddMessage(ctx context.Context, message types.Message) error

func (*MySQLMemoryProvider) Clear added in v1.5.0

func (p *MySQLMemoryProvider) Clear() error

func (*MySQLMemoryProvider) CompressMemory added in v1.5.0

func (p *MySQLMemoryProvider) CompressMemory(llm types.LLMProvider, maxMessages int) error

func (*MySQLMemoryProvider) GetChatHistory added in v1.5.0

func (p *MySQLMemoryProvider) GetChatHistory() ([]types.Message, error)

func (*MySQLMemoryProvider) GetMessages added in v1.5.0

func (p *MySQLMemoryProvider) GetMessages(ctx context.Context, limit int) ([]types.Message, error)

func (*MySQLMemoryProvider) LoadMemoryVariables added in v1.5.0

func (p *MySQLMemoryProvider) LoadMemoryVariables() (map[string]interface{}, error)

func (*MySQLMemoryProvider) SaveContext added in v1.5.0

func (p *MySQLMemoryProvider) SaveContext(input, output map[string]interface{}) error

func (*MySQLMemoryProvider) SetMaxHistoryMessages added in v1.5.0

func (p *MySQLMemoryProvider) SetMaxHistoryMessages(limit int)

func (*MySQLMemoryProvider) SetTableName added in v1.5.0

func (p *MySQLMemoryProvider) SetTableName(name string)

type MySQLMessageDocument added in v1.5.0

type MySQLMessageDocument struct {
	ID        uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	SessionID string    `gorm:"type:varchar(255);index;not null" json:"session_id"`
	Role      string    `gorm:"type:varchar(50);not null" json:"role"`
	Content   string    `gorm:"type:text" json:"content"`
	Name      string    `gorm:"type:varchar(255)" json:"name,omitempty"`
	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
}

func (MySQLMessageDocument) TableName added in v1.5.0

func (MySQLMessageDocument) TableName() string

type MySQLSummaryDocument added in v1.6.1

type MySQLSummaryDocument struct {
	ID                      uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	SessionID               string    `gorm:"type:varchar(255);uniqueIndex;not null" json:"session_id"`
	Content                 string    `gorm:"type:text" json:"content"`
	LastSummarizedMessageID uint      `gorm:"index" json:"last_summarized_message_id"`
	CreatedAt               time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt               time.Time `gorm:"index;not null" json:"updated_at"`
}

func (MySQLSummaryDocument) TableName added in v1.6.1

func (MySQLSummaryDocument) TableName() string

type RedisMemoryProvider added in v1.1.0

type RedisMemoryProvider struct {
	// contains filtered or unexported fields
}

func NewRedisMemoryProvider added in v1.1.0

func NewRedisMemoryProvider(client *credis.Client, sessionID string) *RedisMemoryProvider

func NewRedisMemoryProviderWithLimit added in v1.1.0

func NewRedisMemoryProviderWithLimit(client *credis.Client, sessionID string, maxHistoryMessages int) *RedisMemoryProvider

func (*RedisMemoryProvider) AddMessage added in v1.1.0

func (p *RedisMemoryProvider) AddMessage(ctx context.Context, message types.Message) error

func (*RedisMemoryProvider) Clear added in v1.1.0

func (p *RedisMemoryProvider) Clear() error

func (*RedisMemoryProvider) CompressMemory added in v1.4.3

func (p *RedisMemoryProvider) CompressMemory(llm types.LLMProvider, maxMessages int) error

CompressMemory compresses old messages into a summary (implements MemoryProvider interface)

func (*RedisMemoryProvider) GetChatHistory added in v1.1.0

func (p *RedisMemoryProvider) GetChatHistory() ([]types.Message, error)

func (*RedisMemoryProvider) GetMessages added in v1.1.0

func (p *RedisMemoryProvider) GetMessages(ctx context.Context, limit int) ([]types.Message, error)

func (*RedisMemoryProvider) LoadMemoryVariables added in v1.1.0

func (p *RedisMemoryProvider) LoadMemoryVariables() (map[string]interface{}, error)

func (*RedisMemoryProvider) SaveContext added in v1.1.0

func (p *RedisMemoryProvider) SaveContext(input, output map[string]interface{}) error

func (*RedisMemoryProvider) SetKeyPrefix added in v1.1.0

func (p *RedisMemoryProvider) SetKeyPrefix(prefix string)

func (*RedisMemoryProvider) SetMaxHistoryMessages added in v1.1.0

func (p *RedisMemoryProvider) SetMaxHistoryMessages(limit int)

type SQLiteMemoryProvider added in v1.5.0

type SQLiteMemoryProvider struct {
	// contains filtered or unexported fields
}

func NewSQLiteMemoryProvider added in v1.5.0

func NewSQLiteMemoryProvider(client *sqlite.Client, sessionID string) *SQLiteMemoryProvider

func NewSQLiteMemoryProviderWithLimit added in v1.5.0

func NewSQLiteMemoryProviderWithLimit(client *sqlite.Client, sessionID string, maxHistoryMessages int) *SQLiteMemoryProvider

func (*SQLiteMemoryProvider) AddMessage added in v1.5.0

func (p *SQLiteMemoryProvider) AddMessage(ctx context.Context, message types.Message) error

func (*SQLiteMemoryProvider) Clear added in v1.5.0

func (p *SQLiteMemoryProvider) Clear() error

func (*SQLiteMemoryProvider) CompressMemory added in v1.5.0

func (p *SQLiteMemoryProvider) CompressMemory(llm types.LLMProvider, maxMessages int) error

func (*SQLiteMemoryProvider) GetChatHistory added in v1.5.0

func (p *SQLiteMemoryProvider) GetChatHistory() ([]types.Message, error)

func (*SQLiteMemoryProvider) GetMessages added in v1.5.0

func (p *SQLiteMemoryProvider) GetMessages(ctx context.Context, limit int) ([]types.Message, error)

func (*SQLiteMemoryProvider) LoadMemoryVariables added in v1.5.0

func (p *SQLiteMemoryProvider) LoadMemoryVariables() (map[string]interface{}, error)

func (*SQLiteMemoryProvider) SaveContext added in v1.5.0

func (p *SQLiteMemoryProvider) SaveContext(input, output map[string]interface{}) error

func (*SQLiteMemoryProvider) SetMaxHistoryMessages added in v1.5.0

func (p *SQLiteMemoryProvider) SetMaxHistoryMessages(limit int)

func (*SQLiteMemoryProvider) SetTableName added in v1.5.0

func (p *SQLiteMemoryProvider) SetTableName(name string)

type SQLiteMessageDocument added in v1.5.0

type SQLiteMessageDocument struct {
	ID        uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	SessionID string    `gorm:"type:varchar(255);index;not null" json:"session_id"`
	Role      string    `gorm:"type:varchar(50);not null" json:"role"`
	Content   string    `gorm:"type:text" json:"content"`
	Name      string    `gorm:"type:varchar(255)" json:"name,omitempty"`
	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
}

func (SQLiteMessageDocument) TableName added in v1.5.0

func (SQLiteMessageDocument) TableName() string

type SQLiteSummaryDocument added in v1.6.1

type SQLiteSummaryDocument struct {
	ID                      uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	SessionID               string    `gorm:"type:varchar(255);uniqueIndex;not null" json:"session_id"`
	Content                 string    `gorm:"type:text" json:"content"`
	LastSummarizedMessageID uint      `gorm:"index" json:"last_summarized_message_id"`
	CreatedAt               time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt               time.Time `gorm:"index;not null" json:"updated_at"`
}

func (SQLiteSummaryDocument) TableName added in v1.6.1

func (SQLiteSummaryDocument) TableName() string

type SimpleMemoryProvider

type SimpleMemoryProvider struct {
	// contains filtered or unexported fields
}

SimpleMemoryProvider simple memory provider implementation

func NewSimpleMemoryProvider

func NewSimpleMemoryProvider() *SimpleMemoryProvider

NewSimpleMemoryProvider creates a new simple memory provider

func NewSimpleMemoryProviderWithLimit added in v1.1.0

func NewSimpleMemoryProviderWithLimit(maxHistoryMessages int) *SimpleMemoryProvider

NewSimpleMemoryProviderWithLimit creates a new simple memory provider with max history limit

func (*SimpleMemoryProvider) AddMessage

func (p *SimpleMemoryProvider) AddMessage(ctx context.Context, message types.Message) error

AddMessage adds a message

func (*SimpleMemoryProvider) Clear

func (p *SimpleMemoryProvider) Clear() error

Clear clears memory (implements MemoryProvider interface)

func (*SimpleMemoryProvider) ClearWithContext added in v1.1.0

func (p *SimpleMemoryProvider) ClearWithContext(ctx context.Context) error

ClearWithContext clears memory with context (for backward compatibility)

func (*SimpleMemoryProvider) CompressMemory added in v1.4.3

func (p *SimpleMemoryProvider) CompressMemory(llm types.LLMProvider, maxMessages int) error

CompressMemory compresses old messages into a summary (implements MemoryProvider interface)

func (*SimpleMemoryProvider) GetChatHistory added in v1.1.0

func (p *SimpleMemoryProvider) GetChatHistory() ([]types.Message, error)

GetChatHistory gets chat history (implements MemoryProvider interface)

func (*SimpleMemoryProvider) GetMessages

func (p *SimpleMemoryProvider) GetMessages(ctx context.Context, limit int) ([]types.Message, error)

GetMessages gets messages

func (*SimpleMemoryProvider) LoadMemoryVariables added in v1.1.0

func (p *SimpleMemoryProvider) LoadMemoryVariables() (map[string]interface{}, error)

LoadMemoryVariables loads memory variables (implements MemoryProvider interface)

func (*SimpleMemoryProvider) SaveContext added in v1.1.0

func (p *SimpleMemoryProvider) SaveContext(input, output map[string]interface{}) error

SaveContext saves context (implements MemoryProvider interface)

func (*SimpleMemoryProvider) SetMaxHistoryMessages added in v1.1.0

func (p *SimpleMemoryProvider) SetMaxHistoryMessages(limit int)

SetMaxHistoryMessages sets the maximum history messages limit

type SummaryDocument added in v1.6.1

type SummaryDocument struct {
	ID                      primitive.ObjectID `bson:"_id,omitempty"`
	SessionID               string             `bson:"session_id"`
	Content                 string             `bson:"content"`
	LastSummarizedMessageID primitive.ObjectID `bson:"last_summarized_message_id"`
	CreatedAt               time.Time          `bson:"created_at"`
	UpdatedAt               time.Time          `bson:"updated_at"`
}

Jump to

Keyboard shortcuts

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