data_session

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VECTOR_PINECONE = "pinecone"
	VECTOR_CHROMA   = "chroma"
	VECTOR_PGVECTOR = "pgvector"
	VECTOR_REDIS    = "redis"
	VECTOR_QDRANT   = "qdrant"
	VECTOR_WEAVIATE = "weaviate"
)
View Source
const ChromaSupported = true

ChromaSupported reports whether this build can use Chroma, which needs cgo.

Variables

View Source
var AVAILABLE_VECTOR_STORES = availableVectorStores()

AVAILABLE_VECTOR_STORES lists the vector stores this build can use. Chroma needs cgo (see chroma.go), so a CGO_ENABLED=0 build leaves it out.

Functions

This section is empty.

Types

type DataSession

type DataSession struct {
	Sources map[uint]*models.Datasource
}

func NewDataSession

func NewDataSession(sources map[uint]*models.Datasource) *DataSession

func (*DataSession) CreateEmbedding

func (ds *DataSession) CreateEmbedding(dsID uint, texts []string) ([][]float32, error)

func (*DataSession) DeleteDocumentsByMetadata

func (ds *DataSession) DeleteDocumentsByMetadata(dsID uint, metadataFilter map[string]string, filterMode string, dryRun bool) (int, error)

DeleteDocumentsByMetadata deletes documents matching metadata filter from vector store filterMode can be "AND" or "OR" to combine multiple metadata conditions If dryRun is true, returns count without actually deleting

func (*DataSession) DeleteNamespace

func (ds *DataSession) DeleteNamespace(dsID uint, namespace string) error

DeleteNamespace deletes an entire namespace/collection from the vector store

func (*DataSession) ListNamespaces

func (ds *DataSession) ListNamespaces(dsID uint) ([]NamespaceInfo, error)

ListNamespaces lists all namespaces/collections in the vector store

func (*DataSession) ProcessRAGForDatasource

func (ds *DataSession) ProcessRAGForDatasource(withDSID uint, db *gorm.DB) error

func (*DataSession) QueryByMetadataOnly

func (ds *DataSession) QueryByMetadataOnly(dsID uint, metadataFilter map[string]string, filterMode string, limit, offset int) ([]schema.Document, int, error)

QueryByMetadataOnly queries documents using only metadata filters (no vector similarity) Supports pagination with limit and offset parameters

func (*DataSession) Search

func (ds *DataSession) Search(query string, n int) ([]schema.Document, error)

Search queries every datasource in the session and returns the combined results. A datasource that fails (an unreachable store, a missing embedder, Chroma in a build without cgo) is logged and skipped so the others still answer; Search errors only when every datasource fails.

func (*DataSession) SearchByVector

func (ds *DataSession) SearchByVector(dsID uint, vector []float32, n int) ([]schema.Document, error)

SearchByVector performs similarity search using a pre-computed embedding vector This allows querying with custom embeddings without re-embedding the query

func (*DataSession) StoreDocumentsWithVectors

func (ds *DataSession) StoreDocumentsWithVectors(dsID uint, contents []string, vectors [][]float32, metadatas []map[string]any) error

StoreDocumentsWithVectors stores documents with pre-computed embedding vectors This bypasses the embedder and uses vendor-specific APIs to store vectors directly

func (*DataSession) StoreEmbedding

func (ds *DataSession) StoreEmbedding(dsID uint, docs []schema.Document) error

type NamespaceInfo

type NamespaceInfo struct {
	Name          string
	DocumentCount int // -1 if not supported by vector store
}

NamespaceInfo represents a namespace/collection in a vector store

type VectorStoreVendor

type VectorStoreVendor string

Jump to

Keyboard shortcuts

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