Documentation ¶
Overview ¶
Package embedding provides the embedding provider management functionalities
Package embedding provides the embedding provider interface and its implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbeddingProviderMock ¶
func NewProvider ¶
func NewProvider(t interface { mock.TestingT Cleanup(func()) }) *EmbeddingProviderMock
func (*EmbeddingProviderMock) GetEmbedding ¶
func (_m *EmbeddingProviderMock) GetEmbedding(ctx context.Context, text string) ([]types.ContentPart, error)
func (*EmbeddingProviderMock) GetID ¶
func (_m *EmbeddingProviderMock) GetID() uuid.UUID
func (*EmbeddingProviderMock) HealthCheck ¶
func (_m *EmbeddingProviderMock) HealthCheck() error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the embedding provider manager
func NewEmbeddingManager ¶
NewEmbeddingManager creates a new embedding manager
func (*Manager) RegisterRoutes ¶
func (h *Manager) RegisterRoutes(r chi.Router)
RegisterRoutes registers the embedding provider routes
type NoOpEmbeddingProvider ¶
type NoOpEmbeddingProvider struct {
// contains filtered or unexported fields
}
Provider is an interface for an embedding provider
func (*NoOpEmbeddingProvider) GetEmbedding ¶
func (n *NoOpEmbeddingProvider) GetEmbedding(_ context.Context, _ string) ([]types.ContentPart, error)
GetEmbedding returns the embedding for the given text
func (*NoOpEmbeddingProvider) GetID ¶
func (n *NoOpEmbeddingProvider) GetID() uuid.UUID
GetID returns the ID of the embedding provider
func (*NoOpEmbeddingProvider) HealthCheck ¶
func (n *NoOpEmbeddingProvider) HealthCheck() error
HealthCheck checks the health of the embedding provider
type OpenAIProvider ¶
type OpenAIProvider struct {
// contains filtered or unexported fields
}
OpenAIProvider is an embedding provider that uses OpenAI to generate embeddings
func (*OpenAIProvider) GetEmbedding ¶
func (p *OpenAIProvider) GetEmbedding(ctx context.Context, text string) ([]types.ContentPart, error)
GetEmbedding returns the embedding for the given text
func (*OpenAIProvider) GetID ¶
func (p *OpenAIProvider) GetID() uuid.UUID
GetID returns the ID of the embedding provider
func (*OpenAIProvider) HealthCheck ¶
func (p *OpenAIProvider) HealthCheck() error
HealthCheck checks the health of the embedding provider
type OpenAIRequest ¶
OpenAIRequest is a request to the OpenAI API
type OpenAIResponse ¶
type OpenAIResponse struct { Object string `json:"object"` Data []struct { Object string `json:"object"` Index int `json:"index"` Embedding []float32 `json:"embedding"` } `json:"data"` Model string `json:"model"` Usage struct { PromptTokens int32 `json:"prompt_tokens"` TotalTokens int32 `json:"total_tokens"` } `json:"usage"` }
OpenAIResponse is a response from the OpenAI API
type Provider ¶
type Provider interface { GetEmbedding(ctx context.Context, text string) ([]types.ContentPart, error) Process(ctx context.Context, d *types.Document) error GetID() uuid.UUID HealthCheck() error }
Provider is an interface for an embedding provider
func InitializeEmbeddingProvider ¶
func InitializeEmbeddingProvider(ctx context.Context, st storage.Storage, logging *logrus.Logger) (Provider, error)
InitializeEmbeddingProvider initializes the embedding provider with the given storage and logger
func NewNoOpEmbeddingProvider ¶
func NewNoOpEmbeddingProvider(settings *types.NoOpSettings) Provider
NewNoOpEmbeddingProvider creates a new NoOpEmbeddingProvider with the given settings
func NewOpenAIProvider ¶
func NewOpenAIProvider(providerUUID uuid.UUID, settings *types.OpenAISettings, logging *logrus.Logger) Provider
NewOpenAIProvider creates a new OpenAIProvider with the given settings