Documentation ¶
Overview ¶
Package vectorstores contains the implementation of VectorStore, an interface for saving and querying documents as vector embeddings.
The main components of this package are:
- VectorStore interface: a common interface for saving and querying vector embeddings of documents. - Options: a set of options for similarity search and document addition. - Retriever: a retriever for vector stores that implements the schema.Retriever interface.
The package provides a flexible way to handle different types of vector stores by using the VectorStore interface as an abstraction. It supports customization of the search and storage operation via the Options mechanism.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
Option is a function that configures an Options.
func WithEmbedder ¶
func WithEmbedder(embedder embeddings.Embedder) Option
WithEmbedder returns an Option for setting the embedder that could be used when adding documents or doing similarity search (instead the embedder from the Store context) this is useful when we are using multiple LLMs with single vectorstore.
func WithFilters ¶
Vector searches can be limited bsaed on metadata filters. Searches with metadata filters retrieve exactly the number of nearest-neighbors results that match the filters. In most cases the search latency will be lower than unfiltered searches See https://docs.pinecone.io/docs/metadata-filtering
func WithNameSpace ¶
WithNameSpace returns an Option for setting the name space.
func WithScoreThreshold ¶
type Options ¶
type Options struct { NameSpace string ScoreThreshold float64 Filters any Embedder embeddings.Embedder }
Options is a set of options for similarity search and add documents.
type Retriever ¶
type Retriever struct { CallbacksHandler callbacks.Handler // contains filtered or unexported fields }
Retriever is a retriever for vector stores.
func ToRetriever ¶
func ToRetriever(vectorStore VectorStore, numDocuments int, options ...Option) Retriever
ToRetriever takes a vector store and returns a retriever using the vector store to retrieve documents.
type VectorStore ¶
type VectorStore interface { AddDocuments(context.Context, []schema.Document, ...Option) error SimilaritySearch(ctx context.Context, query string, numDocuments int, options ...Option) ([]schema.Document, error) //nolint:lll }
VectorStore is the interface for saving and querying documents in the form of vector embeddings.
Directories ¶
Path | Synopsis |
---|---|
Package pinecone contains an implementation of the vectorStore interface using pinecone.
|
Package pinecone contains an implementation of the vectorStore interface using pinecone. |
Package weaviate contains an implementation of the vectorStore interface using weaviate.
|
Package weaviate contains an implementation of the vectorStore interface using weaviate. |