Spectre.Router.IndexProfile (Spectre v0.3.0)

Copy Markdown View Source

Versioned identity for a rebuildable routing cache or index.

Profiles describe how a Routing projection may be indexed. They contain no embeddings or provider clients; derived rows remain disposable cache data.

Summary

Functions

Returns the deterministic built-in exact-routing profile.

Returns the canonical profile digest used in cache keys.

Restores an index profile from portable data.

Builds and validates an index profile.

Builds an index profile or raises with its stable validation reason.

Returns the current index-profile schema version.

Returns the portable profile representation.

Types

t()

@type t() :: %Spectre.Router.IndexProfile{
  dimensions: pos_integer() | nil,
  id: String.t(),
  max_entries: pos_integer(),
  metadata: map(),
  metric: :none | :cosine | :dot | :euclidean,
  model_profile_ref: String.t() | nil,
  schema_version: pos_integer(),
  strategy: :exact | :lexical | :embedding,
  version: pos_integer()
}

Functions

default()

@spec default() :: t()

Returns the deterministic built-in exact-routing profile.

digest(profile)

@spec digest(t()) :: String.t()

Returns the canonical profile digest used in cache keys.

from_data(data)

@spec from_data(map()) :: {:ok, t()} | {:error, term()}

Restores an index profile from portable data.

new(profile)

@spec new(t() | map() | keyword()) :: {:ok, t()} | {:error, term()}

Builds and validates an index profile.

new!(attrs)

@spec new!(t() | map() | keyword()) :: t()

Builds an index profile or raises with its stable validation reason.

schema_version()

@spec schema_version() :: pos_integer()

Returns the current index-profile schema version.

to_data(profile)

@spec to_data(t()) :: map()

Returns the portable profile representation.