vectorstores

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SearchResult

type SearchResult struct {
	ID       string         `json:"id"`
	Score    float32        `json:"score"`
	Metadata map[string]any `json:"metadata"`
}

SearchResult represents a single search result from the vector store.

type VectorStore

type VectorStore interface {
	// EnsureCollection creates the collection/index if it doesn't exist.
	// dimension is the vector dimension (e.g., 768 for nomic-embed-text, 1536 for OpenAI ada-002).
	EnsureCollection(ctx context.Context, collectionName string, dimension int) error

	// UpsertVectors inserts or updates vectors in the collection.
	// ids, embeddings, and metadata must have the same length.
	UpsertVectors(ctx context.Context, collectionName string, ids []string, embeddings [][]float64, metadata []map[string]any) error

	// Search performs a vector similarity search and returns the top results.
	Search(ctx context.Context, collectionName string, queryVector []float64, limit int, filter map[string]any) ([]SearchResult, error)

	// DeleteCollection removes the entire collection.
	DeleteCollection(ctx context.Context, collectionName string) error

	// DeleteVectors removes specific vectors by ID from the collection.
	DeleteVectors(ctx context.Context, collectionName string, ids []string) error

	// Close closes the connection to the vector store.
	Close() error
}

VectorStore defines the interface for vector database operations. Implementations can use Qdrant, Pinecone, Weaviate, pgvector, etc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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