vector

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StoreSQLite     = internalvector.StoreSQLite
	StorePgVector   = internalvector.StorePgVector
	StoreQdrant     = internalvector.StoreQdrant
	StoreOpenSearch = internalvector.StoreOpenSearch
	StoreChroma     = internalvector.StoreChroma
	StoreMemory     = internalvector.StoreMemory
	StoreHNSW       = internalvector.StoreHNSW

	// Deprecated: use Store* constants.
	BackendSQLite     = StoreSQLite
	BackendPgVector   = StorePgVector
	BackendQdrant     = StoreQdrant
	BackendOpenSearch = StoreOpenSearch
	BackendChroma     = StoreChroma
	BackendMemory     = StoreMemory
	BackendHNSW       = StoreHNSW
)

Variables

This section is empty.

Functions

func NewMemoryStore

func NewMemoryStore() *internalvector.MemoryStore

NewMemoryStore creates a vector store held in memory: nothing survives the process.

Types

type Backend deprecated

type Backend = StoreKind

Deprecated: use StoreKind.

type Config

type Config struct {
	StoreKind StoreKind
	DB        *DBHandle

	// Deprecated: use StoreKind.
	Backend StoreKind

	Dim                          int
	PgVectorCreateExtension      *bool
	PgVectorIndexMethod          string
	PgVectorHNSWM                int
	PgVectorHNSWEfConstruction   int
	PgVectorIVFFlatLists         int
	QdrantHost                   string
	QdrantPort                   int
	QdrantAPIKey                 string
	QdrantPrefix                 string
	OpenSearchAddresses          []string
	OpenSearchUsername           string
	OpenSearchPassword           string
	OpenSearchAPIKey             string
	OpenSearchIndexPrefix        string
	OpenSearchCreateIndex        *bool
	OpenSearchKNN                bool
	OpenSearchInsecureSkipVerify bool
	OpenSearchBulkSize           int
	ChromaURL                    string
	ChromaAPIKey                 string
	ChromaTenant                 string
	ChromaDatabase               string
	// HNSWDir is the directory for HNSW index files (StoreHNSW only).
	// Defaults to <runtime_root>/data/hnsw via pkg/config helpers.
	HNSWDir string
}

Config selects and tunes a vector store: its kind, the database for the SQL-backed kinds, the dimension of the embeddings, and the settings specific to pgvector, Qdrant, OpenSearch, Chroma and HNSW.

type DBHandle

type DBHandle struct {
	DriverName    string
	DSN           string
	BusyTimeoutMS int
}

DBHandle is the public vector-facing database descriptor. It intentionally avoids leaking the engine's internal DB type while keeping enough information to reopen a compatible low-level handle when needed.

func NewDBHandle

func NewDBHandle(driverName, dsn string) *DBHandle

NewDBHandle describes a database for a vector store by its driver name and DSN, with a busy timeout of 5 seconds for SQLite.

type Query

type Query = internalvector.Query

Query describes a vector similarity search. Filter applies optional metadata predicates server-side (where supported) or client-side (SQLite / in-memory backends).

Simple equality: {"source_file": "doc.txt"} IN operator: {"source_file": {"$in": ["a.txt", "b.txt"]}}

type Record

type Record = internalvector.Record

Record is one vectorized chunk stored in a vector store.

type SearchResult

type SearchResult = internalvector.SearchResult

SearchResult is one ranked vector search hit.

type Store

type Store = internalvector.Store

Store abstracts the vector storage/search engine used by RAG. Concrete implementations target SQLite, pgvector, Qdrant, Chroma, or any future provider — the rag.Service and knowledge.Service call only this interface.

func NewStore

func NewStore(ctx context.Context, cfg Config) (Store, error)

NewStore opens the vector store that cfg describes. It returns an error when the database handle has no driver or DSN, or the store cannot be opened.

type StoreKind

type StoreKind = internalvector.StoreKind

StoreKind identifies which vector store implementation to use.

Jump to

Keyboard shortcuts

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