vectorstores

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCollectionNotFound = errors.New("collection not found")
)

Functions

func ToRetriever

func ToRetriever(vectorStore VectorStore, numDocs int, options ...Option) schema.Retriever

ToRetriever creates a retriever from a vector store.

Types

type DocumentWithScore

type DocumentWithScore struct {
	Document schema.Document
	Score    float32
}

type Option

type Option func(*Options)

func WithCollectionName added in v0.7.1

func WithCollectionName(name string) Option

WithCollectionName sets the collection name for the Qdrant store.

func WithEmbedder

func WithEmbedder(embedder embeddings.Embedder) Option

func WithFilter

func WithFilter(key string, value any) Option

func WithFilters

func WithFilters(filters map[string]any) Option

func WithNameSpace

func WithNameSpace(namespace string) Option

func WithScoreThreshold

func WithScoreThreshold(threshold float32) Option

type Options

type Options struct {
	Embedder       embeddings.Embedder
	NameSpace      string
	CollectionName string
	ScoreThreshold float32
	Filters        map[string]any
}

func ParseOptions

func ParseOptions(options ...Option) Options

type Retriever

type Retriever interface {
	GetRelevantDocuments(ctx context.Context, query string) ([]schema.Document, error)
}

Retriever is the interface for fetching relevant documents for a query.

type VectorStore

type VectorStore interface {
	AddDocuments(ctx context.Context, docs []schema.Document, options ...Option) ([]string, error)
	SimilaritySearch(ctx context.Context, query string, numDocuments int, options ...Option) ([]schema.Document, error)
	SimilaritySearchBatch(ctx context.Context, queries []string, numDocuments int, options ...Option) ([][]schema.Document, error)
	SimilaritySearchWithScores(ctx context.Context, query string, numDocuments int, options ...Option) ([]DocumentWithScore, error)
	ListCollections(ctx context.Context) ([]string, error)
	DeleteCollection(ctx context.Context, collectionName string) error
	DeleteDocumentsByFilter(ctx context.Context, filters map[string]any, options ...Option) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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