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
- func PointID(id string) string
- type Backend
- func (b *Backend) Get(ctx context.Context, collection string, ids []string) ([]recall.StoredVector, error)
- func (b *Backend) List(ctx context.Context, collection string, filter map[string]any, limit int) ([]recall.StoredVector, int, error)
- func (b *Backend) Put(ctx context.Context, collection, id string, values []float32, ...) error
- func (b *Backend) Search(ctx context.Context, collection string, values []float32, k int, ...) ([]recall.Hit, error)
- type Config
- type StatusError
Constants ¶
const IDField = "_recall_id"
IDField is the payload key that holds a point's Recall event ID.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a reusable Qdrant client, safe for concurrent calls.
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 ¶
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".