Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedProvider ¶ added in v0.4.26
type CachedProvider struct {
// contains filtered or unexported fields
}
CachedProvider wraps an embedding provider with LRU caching capabilities
func NewCachedProvider ¶ added in v0.4.26
func NewCachedProvider(provider Provider, maxSize int) *CachedProvider
NewCachedProvider creates a new cached wrapper around an embedding provider maxSize determines how many embeddings to keep in cache (default 1000)
func (*CachedProvider) ClearCache ¶ added in v0.4.26
func (c *CachedProvider) ClearCache()
ClearCache removes all cached embeddings
func (*CachedProvider) GenerateEmbedding ¶ added in v0.4.26
GenerateEmbedding returns cached embeddings if available, otherwise generates new ones
func (*CachedProvider) GetModel ¶ added in v0.4.26
func (c *CachedProvider) GetModel() EmbeddingModel
GetModel delegates to the underlying provider
func (*CachedProvider) MaxSize ¶ added in v0.4.26
func (c *CachedProvider) MaxSize() int
MaxSize returns the maximum number of embeddings that can be cached
func (*CachedProvider) Size ¶ added in v0.4.26
func (c *CachedProvider) Size() int
Size returns the current number of cached embeddings
type EmbeddingModel ¶
EmbeddingModel contains metadata about the embedding model
type OllamaProvider ¶
type OllamaProvider struct {
// contains filtered or unexported fields
}
func NewOllamaProvider ¶
func NewOllamaProvider(baseURL string, model string, dimensions int) *OllamaProvider
func (*OllamaProvider) GenerateEmbedding ¶
func (*OllamaProvider) GetModel ¶
func (p *OllamaProvider) GetModel() EmbeddingModel
type OpenAIProvider ¶
type OpenAIProvider struct {
// contains filtered or unexported fields
}
func NewOpenAIProvider ¶
func NewOpenAIProvider(apiKey string, model openai.EmbeddingModel, dimensions int) *OpenAIProvider
func (*OpenAIProvider) GenerateEmbedding ¶
func (*OpenAIProvider) GetModel ¶
func (p *OpenAIProvider) GetModel() EmbeddingModel
type Provider ¶
type Provider interface { // GenerateEmbedding creates an embedding vector for the given text GenerateEmbedding(ctx context.Context, text string) ([]float32, error) // GetModel returns information about the embedding model being used GetModel() EmbeddingModel }
Provider defines the interface for generating embeddings
type SettingsFactory ¶
type SettingsFactory struct {
// contains filtered or unexported fields
}
SettingsFactory creates embedding providers based on chat settings
func NewSettingsFactory ¶
func NewSettingsFactory(stepSettings *settings.StepSettings) *SettingsFactory
NewSettingsFactory creates a new factory that uses step settings
func (*SettingsFactory) NewCachedProvider ¶ added in v0.4.26
func (f *SettingsFactory) NewCachedProvider(maxSize int) (Provider, error)
NewCachedProvider creates a new cached embedding provider based on the step settings maxSize determines how many embeddings to keep in cache (default 1000)
func (*SettingsFactory) NewProvider ¶
func (f *SettingsFactory) NewProvider() (Provider, error)
NewProvider creates a new embedding provider based on the step settings