Documentation ¶
Index ¶
- Constants
- Variables
- func Do(client *http.Client, req *http.Request) (*http.Response, error)
- func NewRequest(ctx context.Context, method, url string, body io.Reader, opts ...ReqOption) (*http.Request, error)
- type APIError
- type Action
- type Alias
- type AliasActionReq
- type AliasesResp
- type DB
- type HTTPClient
- type Option
- type Options
- 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, proj 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, proj v1.Projection) ([]v1.Embedding, error)
- type ReqOption
Constants ¶
const ( Scheme = "qdrant" SecureScheme = "qdrants" )
const (
DefaultBaseURL = "http://localhost:6333"
)
Variables ¶
Functions ¶
func NewRequest ¶
func NewRequest(ctx context.Context, method, url string, body io.Reader, opts ...ReqOption) (*http.Request, error)
NewRequest creates a new HTTP request from the provided parameters and returns it. If the passed in context is nil, it creates a new background context. If the provided body is nil, it gets initialized to bytes.Reader. By default the following headers are set: * Accept: application/json; charset=utf-8 If no Content-Type has been set via options it defaults to application/json.
Types ¶
type APIError ¶
type APIError struct { Time float64 `json:"time"` Status struct { Error string `json:"error"` } `json:"status"` Result struct { OperationID int `json:"operation_id"` Status string `json:"status"` } `json:"result"` }
APIError encodes qdrant API error.
type AliasActionReq ¶
type AliasActionReq struct { // Actions to take on alias. Actions []Action `json:"actions"` }
AliasActionReq is used to update collection aliases.
type AliasesResp ¶
type AliasesResp struct { Time float64 `json:"time"` Status string `json:"status"` Result struct { Aliases []Alias `json:"aliases"` } `json:"result"` }
AliasesResp
type DB ¶
type DB struct { // DSN string DSN string // contains filtered or unexported fields }
DB is qdrant DB store handle
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient is qdrant HTTP API client.
func NewHTTPClient ¶
func NewHTTPClient(opts ...Option) *HTTPClient
NewHTTPClient creates a new qdrant HTTP API client and returns it.
func (*HTTPClient) AliasList ¶
func (c *HTTPClient) AliasList(ctx context.Context, collName string) (*AliasesResp, error)
AliasList action.
func (*HTTPClient) UpdateAliases ¶
func (c *HTTPClient) UpdateAliases(ctx context.Context, actions []Action) error
UpdateAliases action (Create, Remove, Switch)
type Option ¶
type Option func(*Options)
Option is functional graph option.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client.
type ProvidersService ¶
type ProvidersService struct {
// contains filtered or unexported fields
}
ProvidersService allows to store data in qdrant vector store.
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 creates a new provider and returns it. It creates a new qdrant collection and raturns the new provider. The collection name is the same as the UUID of the provider.
func (*ProvidersService) ComputeProviderProjections ¶
func (p *ProvidersService) ComputeProviderProjections(ctx context.Context, uid string, proj v1.Projection) error
ComputeProviderProjections recomputes all projections from scratch for the provider with the given UID.
func (*ProvidersService) DropProviderEmbeddings ¶
func (p *ProvidersService) DropProviderEmbeddings(ctx context.Context, uid string) error
DropProviderEmbeddings drops all provider embeddings from the store
func (*ProvidersService) GetProviderByUID ¶
GetProviderByUID returns the provider with the given uid. NOTE: this does not populate metadata in v1.Provider because qdrant does not allow storing any metadata about the collections; only about the data stored in collections.
func (*ProvidersService) GetProviderEmbeddings ¶
func (p *ProvidersService) GetProviderEmbeddings(ctx context.Context, uid string, filter v1.ProviderFilter) ([]v1.Embedding, v1.Page, error)
GetProviderEmbeddings returns embeddings for the provider with the given uid.
func (*ProvidersService) GetProviderProjections ¶
func (p *ProvidersService) GetProviderProjections(ctx context.Context, uid string, filter v1.ProviderFilter) (map[v1.Dim][]v1.Embedding, v1.Page, error)
GetProviderProjections returns embeddings projections for the provider with the given uid.
func (*ProvidersService) GetProviders ¶
func (p *ProvidersService) GetProviders(ctx context.Context, filter v1.ProviderFilter) ([]*v1.Provider, v1.Page, error)
GetProviders returns a list of providers filtered by filter. NOTE: this does not populate metadata in v1.Provider because qdrant does not allow storing any metadata about the collections; only about the data stored in collections.
func (*ProvidersService) UpdateProviderEmbeddings ¶
func (p *ProvidersService) UpdateProviderEmbeddings(ctx context.Context, uid string, embeds []v1.Embedding, proj v1.Projection) ([]v1.Embedding, error)
UpdateProviderEmbeddings generates embeddings for the provider with the given uid.