providers

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChatHistory added in v1.3.0

func NewChatHistory() contracts.IChatHistory

func NewTokenManager added in v1.3.0

func NewTokenManager(maxTokens int) contracts.ITokenManagement

NewTokenManager creates a new token manager

func ProviderFactory

func ProviderFactory(config *AIProviderConfig) (contracts.IAIProvider, error)

ProviderFactory creates a Provider based on the given provider config.

Types

type AIProviderConfig

type AIProviderConfig struct {
	ProviderName        string  `mapstructure:"provider_name"`
	EmbeddingURL        string  `mapstructure:"embedding_url"`
	ChatCompletionURL   string  `mapstructure:"chat_completion_url"`
	EmbeddingModel      string  `mapstructure:"embedding_model"`
	ChatCompletionModel string  `mapstructure:"chat_completion_model"`
	Stream              bool    `mapstructure:"stream"`
	Temperature         float32 `mapstructure:"temperature"`
	EncodingFormat      string  `mapstructure:"encoding_format"`
	MaxTokens           int     `mapstructure:"max_tokens"`
	Threshold           float64 `mapstructure:"threshold"`
	ApiKey              string  `mapstructure:"api_key"`
	BufferingTheme      string  `mapstructure:"buffering_theme"`
}

type Tokenizer added in v1.3.0

type Tokenizer struct{}

Tokenizer is a custom tokenizer implementation

func (*Tokenizer) CountTokens added in v1.3.0

func (t *Tokenizer) CountTokens(text string) int

CountTokens returns the number of tokens in the input text.

func (*Tokenizer) Tokenize added in v1.3.0

func (t *Tokenizer) Tokenize(text string) []string

Tokenize splits input text into tokens based on spaces and punctuation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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