Documentation
¶
Index ¶
- Constants
- Variables
- type DB
- type ProvidersService
- func (p *ProvidersService) AddProvider(ctx context.Context, name string, md map[string]any) (*v1.Provider, error)
- func (p *ProvidersService) ComputeProviderProjections(ctx context.Context, uid string, prj v1.Projection) error
- func (p *ProvidersService) DropProviderEmbeddings(ctx context.Context, uid string) error
- func (p *ProvidersService) GetProviderByUID(ctx context.Context, uid string) (*v1.Provider, error)
- func (p *ProvidersService) GetProviderEmbeddings(ctx context.Context, uid string, filter v1.ProviderFilter) ([]v1.Embedding, v1.Page, error)
- func (p *ProvidersService) GetProviderProjections(ctx context.Context, uid string, filter v1.ProviderFilter) (map[v1.Dim][]v1.Embedding, v1.Page, error)
- func (p *ProvidersService) GetProviders(ctx context.Context, filter v1.ProviderFilter) ([]*v1.Provider, v1.Page, error)
- func (p *ProvidersService) UpdateProviderEmbeddings(ctx context.Context, uid string, embeds []v1.Embedding, prj v1.Projection) ([]v1.Embedding, error)
Constants ¶
const (
// DSN is the in-memory data source name.
DSN = ":memory:"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { // DSN string. DSN string // Closed flag for DB operations. Closed bool *sync.RWMutex // contains filtered or unexported fields }
DB is an in-memory DB store.
type ProvidersService ¶
type ProvidersService struct {
// contains filtered or unexported fields
}
ProvidersService is an in-memory store for embeddings providers.
func NewProvidersService ¶
func NewProvidersService(db *DB) (*ProvidersService, error)
NewProvidersService creates an instance of ProvidersService and returns it.
func (*ProvidersService) AddProvider ¶
func (p *ProvidersService) AddProvider(ctx context.Context, name string, md map[string]any) (*v1.Provider, error)
AddProvider adds a new embeddings provider. nolint:revive
func (*ProvidersService) ComputeProviderProjections ¶
func (p *ProvidersService) ComputeProviderProjections(ctx context.Context, uid string, prj v1.Projection) error
ComputeProviderProjections recomputes all projections from scratch for the provider with the given UID. nolint:revive
func (*ProvidersService) DropProviderEmbeddings ¶
func (p *ProvidersService) DropProviderEmbeddings(ctx context.Context, uid string) error
DropProviderEmbeddings drops all embeddings for the provider with the given uid. NOTE: this obviously also drops the projections, as keeping them would make no sense since there would be no embeddings to associate them with. nolint:revive
func (*ProvidersService) GetProviderByUID ¶
GetProviderByid fetches a specific provider by uid. nolint:revive
func (*ProvidersService) GetProviderEmbeddings ¶
func (p *ProvidersService) GetProviderEmbeddings(ctx context.Context, uid string, filter v1.ProviderFilter) ([]v1.Embedding, v1.Page, error)
GetProviderEmbeddings fetches a specific provider embeddings. nolint:revive
func (*ProvidersService) GetProviderProjections ¶
func (p *ProvidersService) GetProviderProjections(ctx context.Context, uid string, filter v1.ProviderFilter) (map[v1.Dim][]v1.Embedding, v1.Page, error)
GetProviderProjections fetches a specific provider embeddings projection. nolint:revive
func (*ProvidersService) GetProviders ¶
func (p *ProvidersService) GetProviders(ctx context.Context, filter v1.ProviderFilter) ([]*v1.Provider, v1.Page, error)
GetProviders fetches all available providers. nolint:revive
func (*ProvidersService) UpdateProviderEmbeddings ¶
func (p *ProvidersService) UpdateProviderEmbeddings(ctx context.Context, uid string, embeds []v1.Embedding, prj v1.Projection) ([]v1.Embedding, error)
UpdateProviderEmbeddings updates embeddings of a specific provider. nolint:revive