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 Option ¶
type Option func(*Options)
func WithEmbedder ¶
func WithEmbedder(embedder embeddings.Embedder) Option
func WithFilter ¶
func WithFilters ¶
func WithNameSpace ¶
func WithScoreThreshold ¶
type Options ¶
type Options struct {
Embedder embeddings.Embedder
NameSpace string
ScoreThreshold float32
Filters map[string]any
}
func ParseOptions ¶
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
}
Click to show internal directories.
Click to hide internal directories.