Documentation ¶
Overview ¶
Package vectorstore provides functionality for storing and managing vector embeddings.
Index ¶
- func ToRetriever(vectorStore schema.VectorStore, ...) schema.Retriever
- type InMemory
- type InMemoryItem
- type InMemoryOptions
- type Pinecone
- type PineconeOptions
- type Weaviate
- func (vs *Weaviate) AddDocuments(ctx context.Context, docs []schema.Document) error
- func (vs *Weaviate) CreateClassIfNotExist(ctx context.Context) error
- func (vs *Weaviate) Delete(ctx context.Context, uuid string) error
- func (vs *Weaviate) SimilaritySearch(ctx context.Context, query string) ([]schema.Document, error)
- type WeaviateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToRetriever ¶
func ToRetriever(vectorStore schema.VectorStore, optFns ...func(o *retriever.VectorStoreOptions)) schema.Retriever
ToRetriever takes a vector store and returns a retriever
Types ¶
type InMemory ¶ added in v0.0.102
type InMemory struct {
// contains filtered or unexported fields
}
InMemory represents an in-memory vector store. Note: This implementation is intended for testing and demonstration purposes, not for production use.
func NewInMemory ¶ added in v0.0.102
func NewInMemory(embedder schema.Embedder, optFns ...func(*InMemoryOptions)) *InMemory
NewInMemory creates a new instance of the in-memory vector store.
func (*InMemory) AddDocuments ¶ added in v0.0.102
AddDocuments adds a batch of documents to the InMemory vector store.
func (*InMemory) AddItem ¶ added in v0.0.102
func (vs *InMemory) AddItem(item InMemoryItem)
AddItem adds a single item to the InMemory vector store.
func (*InMemory) Data ¶ added in v0.0.102
func (vs *InMemory) Data() []InMemoryItem
Data returns the underlying data stored in the InMemory vector store.
type InMemoryItem ¶ added in v0.0.102
type InMemoryItem struct { Content string `json:"content"` Vector []float32 `json:"vector"` Metadata map[string]any `json:"metadata"` }
InMemoryItem represents an item stored in memory with its content, vector, and metadata.
type InMemoryOptions ¶ added in v0.0.102
type InMemoryOptions struct {
TopK int
}
InMemoryOptions represents options for the in-memory vector store.
type Pinecone ¶ added in v0.0.12
type Pinecone struct {
// contains filtered or unexported fields
}
func NewPinecone ¶ added in v0.0.12
func (*Pinecone) AddDocuments ¶ added in v0.0.12
type PineconeOptions ¶ added in v0.0.12
type Weaviate ¶ added in v0.0.40
type Weaviate struct {
// contains filtered or unexported fields
}
Weaviate represents a Weaviate vector store.
func NewWeaviate ¶ added in v0.0.40
func NewWeaviate(client *weaviate.Client, embedder schema.Embedder, optFns ...func(*WeaviateOptions)) *Weaviate
NewWeaviate creates a new Weaviate vector store with the given Weaviate client, embedder, and optional configuration options.
func (*Weaviate) AddDocuments ¶ added in v0.0.40
AddDocuments adds a batch of documents to the Weaviate vector store.
func (*Weaviate) CreateClassIfNotExist ¶ added in v0.0.41
CreateClassIfNotExist checks if the Weaviate class for the vector store exists, and creates it if it doesn't.
type WeaviateOptions ¶ added in v0.0.40
type WeaviateOptions struct { // TextKey is the name of the property in the Weaviate objects where the text content is stored. TextKey string // TopK is the number of documents to retrieve in similarity search. TopK int // IndexName is the name of the index to store the vectors. IndexName string // AdditionalFields is a list of additional fields to retrieve during similarity search. AdditionalFields []string }
WeaviateOptions contains options for configuring the Weaviate vector store.