qdrant

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 14 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

Overview

Package qdrant implements Recall's context-aware Backend over the Qdrant REST API. Each Recall collection is one Qdrant collection, created on the first write with the dimension of the first vector written to it.

Qdrant point IDs must be unsigned integers or UUIDs, and Recall's event IDs are neither, so each event is stored under a UUIDv5 derived from its ID, and the ID itself rides in the payload under IDField. Listings come back in point ID order, which is stable, so a longer listing extends a shorter one while the data is unchanged, as Recall requires.

Qdrant has no lease or revision API, so this backend implements neither recall.LeaseBackend (the agent resume tools need it) nor the watermark that enables Recall's materialized reads. Lexical search is not offered either; Recall ranks with vector search alone.

Index

Constants

View Source
const IDField = "_recall_id"

IDField is the payload key that holds a point's Recall event ID.

Variables

This section is empty.

Functions

func PointID

func PointID(id string) string

PointID is the UUIDv5 a Recall event ID is stored under. The namespace is the RFC 4122 URL namespace, so the mapping is reproducible outside Recall.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is a reusable Qdrant client, safe for concurrent calls.

func New

func New(cfg Config) (*Backend, error)

New validates the endpoint and creates a backend without making requests.

func (*Backend) Get

func (b *Backend) Get(ctx context.Context, collection string, ids []string) ([]recall.StoredVector, error)

Get reads events by id in request order; unknown ids are omitted. It lets Recall follow a belief's EvidenceID.

func (*Backend) List

func (b *Backend) List(ctx context.Context, collection string, filter map[string]any, limit int) ([]recall.StoredVector, int, error)

List returns up to limit exact matches and the exact total, paging internally. The total is counted before and after the pages are read, and a change between the two is reported as an error rather than a partial history.

func (*Backend) Put

func (b *Backend) Put(ctx context.Context, collection, id string, values []float32, metadata map[string]any) error

Put upserts one immutable event ID, creating the collection on first use. It waits for the write to be applied, so a following read sees it.

func (*Backend) Search

func (b *Backend) Search(ctx context.Context, collection string, values []float32, k int, filter map[string]any) ([]recall.Hit, error)

Search retrieves semantic candidates using the supplied query vector. Score is Qdrant's similarity; Distance is 1 - Score for the Cosine and Dot metrics and the score itself for Euclid and Manhattan, whose scores are distances.

type Config

type Config struct {
	// BaseURL is the REST endpoint, such as http://localhost:6333.
	BaseURL string
	// APIKey is sent as the api-key header when set.
	APIKey     string
	HTTPClient *http.Client
	// Distance is the metric a collection is created with: Cosine (the
	// default), Dot, Euclid, or Manhattan. Existing collections keep theirs.
	Distance string
	// MaxResponseBytes bounds each response; zero defaults to 64 MiB.
	MaxResponseBytes int64
}

Config selects a Qdrant endpoint and credential. The default HTTP client has a 30-second timeout and does not follow redirects. A supplied HTTPClient keeps its own timeout/redirect policy and must be safe for concurrent use.

type StatusError

type StatusError struct {
	StatusCode int
	Message    string
}

StatusError reports an HTTP error without losing its machine-readable status.

func (*StatusError) Error

func (e *StatusError) Error() string

func (*StatusError) NotFound

func (e *StatusError) NotFound() bool

NotFound reports a 404, which Recall reads as "nothing written here yet".

Jump to

Keyboard shortcuts

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