Spectre.Router.SemanticCache.Learned.Sources (Spectre v0.3.0)

Copy Markdown View Source

Static row sources for the learned semantic cache.

Materializes immutable rows from labeled offline classifier datasets (JSON/JSONL files resolved from options and application config) and from route examples declared on cacheable rules. Static rows are read-only and carry deterministic ids so merged row sets stay stable.

Summary

Functions

Returns offline dataset rows when static rows and mirroring are enabled.

Returns static route-example rows when static rows are enabled.

Collects rows from every configured offline dataset source.

Builds rows from route examples declared on cacheable rules.

Functions

maybe_offline_dataset_rows(opts)

@spec maybe_offline_dataset_rows(keyword()) ::
  {:ok, [Spectre.Router.SemanticCache.Learned.row()]} | {:error, term()}

Returns offline dataset rows when static rows and mirroring are enabled.

maybe_static_route_rows(opts)

@spec maybe_static_route_rows(keyword()) :: [
  Spectre.Router.SemanticCache.Learned.row()
]

Returns static route-example rows when static rows are enabled.

offline_dataset_rows(opts)

@spec offline_dataset_rows(keyword()) ::
  {:ok, [Spectre.Router.SemanticCache.Learned.row()]} | {:error, term()}

Collects rows from every configured offline dataset source.

static_route_rows(opts)

@spec static_route_rows(keyword()) :: [Spectre.Router.SemanticCache.Learned.row()]

Builds rows from route examples declared on cacheable rules.