qdrant

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package qdrant contains an implementation of the VectorStore interface using Qdrant.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidOptions = errors.New("invalid options")

ErrInvalidOptions is returned when the options given are invalid.

Functions

func DoRequest

func DoRequest(ctx context.Context,
	url url.URL,
	apiKey,
	method string,
	payload interface{},
) (io.ReadCloser, int, error)

doRequest performs an HTTP request to the Qdrant API.

Types

type Option

type Option func(p *Store)

Option is a function that configures an Options.

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey returns an Option for setting the API key to authenticate the connection. Optional.

func WithCollectionName

func WithCollectionName(name string) Option

WithCollectionName returns an Option for setting the collection name. Required.

func WithContentKey

func WithContentKey(contentKey string) Option

WithContent returns an Option for setting field name of the document content in the Qdrant payload. Optional. Defaults to "content".

func WithEmbedder

func WithEmbedder(embedder embeddings.Embedder) Option

WithEmbedder returns an Option for setting the embedder to be used when adding documents or doing similarity search. Required.

func WithURL

func WithURL(qdrantURL url.URL) Option

WithURL returns an Option for setting the Qdrant instance URL. Example: 'http://localhost:63333'. Required.

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (Store, error)

func (Store) AddDocuments

func (s Store) AddDocuments(ctx context.Context,
	docs []schema.Document,
	_ ...vectorstores.Option,
) ([]string, error)

func (Store) SimilaritySearch

func (s Store) SimilaritySearch(ctx context.Context,
	query string, numDocuments int,
	options ...vectorstores.Option,
) ([]schema.Document, error)

Jump to

Keyboard shortcuts

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