polign

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 13 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 polign implements Recall's context-aware Backend over the Polign HTTP API. It uses typed metadata and exact, internally paginated vector listings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend is a reusable Polign 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) 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. Limits up to MaxHistoryEvents+1 support every bounded Recall read, including its overflow probe. Changing totals, duplicate/reordered IDs, or incomplete pages return errors without exposing 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. It does not automatically retry writes.

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.

func (*Backend) Watermark

func (b *Backend) Watermark(ctx context.Context, collection string) (string, error)

Watermark returns the serving node's opaque visible-log revision. Older servers fall back to uncached Recall reads.

type Config

type Config struct {
	BaseURL    string
	APIKey     string
	HTTPClient *http.Client
	// MaxResponseBytes bounds each response; zero defaults to 64 MiB. Large
	// vector dimensions may require a larger bound even for metadata-only uses.
	MaxResponseBytes int64
}

Config selects a Polign 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

Jump to

Keyboard shortcuts

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