vectorstore

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package vectorstore defines the interface for vector store backends. RagTune is vector-store agnostic by design. This interface enables pluggable backends (Qdrant, pgvector, Weaviate, etc.).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCollectionNotFound is returned when the requested collection doesn't exist.
	ErrCollectionNotFound = errors.New("collection not found")

	// ErrConnectionFailed is returned when unable to connect to the vector store.
	ErrConnectionFailed = errors.New("connection failed")

	// ErrDimensionMismatch is returned when vector dimensions don't match the collection.
	ErrDimensionMismatch = errors.New("vector dimension mismatch")
)

Sentinel errors for vector store operations.

Functions

This section is empty.

Types

type Point

type Point struct {
	ID      string
	Vector  []float32
	Payload map[string]interface{}
}

Point represents a vector with metadata to be stored.

type Result

type Result struct {
	ID      string
	Score   float32
	Payload map[string]interface{}
}

Result represents a search result with score.

type Store

type Store interface {
	// EnsureCollection creates a collection if it doesn't exist.
	// dim specifies the vector dimension.
	EnsureCollection(ctx context.Context, name string, dim int) error

	// Upsert inserts or updates points in a collection.
	Upsert(ctx context.Context, collection string, points []Point) error

	// Search performs similarity search and returns top-k results.
	Search(ctx context.Context, collection string, vector []float32, topK int) ([]Result, error)

	// Count returns the number of points in a collection (best-effort).
	Count(ctx context.Context, collection string) (int64, error)

	// DeleteCollection removes a collection and all its data.
	DeleteCollection(ctx context.Context, name string) error

	// Close releases any resources held by the store.
	Close() error
}

Store defines the minimal interface for vector store operations. Implementations should handle connection management internally.

Directories

Path Synopsis
Package chroma implements the vectorstore.Store interface for Chroma.
Package chroma implements the vectorstore.Store interface for Chroma.
Package mock provides a mock implementation of vectorstore.Store for testing.
Package mock provides a mock implementation of vectorstore.Store for testing.
Package pgvector implements the vectorstore.Store interface for PostgreSQL with pgvector.
Package pgvector implements the vectorstore.Store interface for PostgreSQL with pgvector.
Package pinecone implements the vectorstore.Store interface for Pinecone.
Package pinecone implements the vectorstore.Store interface for Pinecone.
Package qdrant implements the vectorstore.Store interface for Qdrant.
Package qdrant implements the vectorstore.Store interface for Qdrant.
Package weaviate implements the vectorstore.Store interface for Weaviate.
Package weaviate implements the vectorstore.Store interface for Weaviate.

Jump to

Keyboard shortcuts

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