Row and label vocabulary for the built-in learned semantic cache.
Normalizes row shapes and text, deduplicates merged row sets with a stable
source ranking, validates embeddings, and resolves route labels against the
agent's cacheable rules. Intended to be imported by the Learned cache
modules.
Summary
Functions
Returns true for nil or empty strings.
Requires the label's route to allow semantic caching.
Returns true when the label's route allows semantic caching.
Returns the rules that allow semantic caching.
Splits dataset text into trimmed, non-comment lines.
Deduplicates merged rows by normalized text with a stable source rank.
Validates and coerces an embedding to a list of finite floats.
Fills defaults and normalizes text fields of a row.
Normalizes lookup text to its trimmed, lowercase key.
Builds a unique online row id.
Puts one metadata key on a row.
Resolves a label against declared route rules, or nil.
Resolves a label against the agent routes, tagging unknown labels.
Coerces a rule struct or map to a plain map.
Compares a source label with a rule label case-insensitively.
Builds a short stable hash for deterministic static row ids.
Fixed timestamp used for immutable static rows.
Requires non-blank text.
Functions
Returns true for nil or empty strings.
Requires the label's route to allow semantic caching.
Returns true when the label's route allows semantic caching.
@spec cacheable_rules(keyword()) :: [Spectre.Rule.t()]
Returns the rules that allow semantic caching.
Splits dataset text into trimmed, non-comment lines.
@spec dedupe([Spectre.Router.SemanticCache.Learned.row()]) :: [ Spectre.Router.SemanticCache.Learned.row() ]
Deduplicates merged rows by normalized text with a stable source rank.
Validates and coerces an embedding to a list of finite floats.
@spec normalize_row(map()) :: Spectre.Router.SemanticCache.Learned.row()
Fills defaults and normalizes text fields of a row.
Normalizes lookup text to its trimmed, lowercase key.
@spec online_id() :: String.t()
Builds a unique online row id.
@spec put_metadata(Spectre.Router.SemanticCache.Learned.row(), atom(), term()) :: Spectre.Router.SemanticCache.Learned.row()
Puts one metadata key on a row.
@spec route_label(term(), [Spectre.Rule.t() | map()]) :: atom() | nil
Resolves a label against declared route rules, or nil.
Resolves a label against the agent routes, tagging unknown labels.
@spec rule_to_map(Spectre.Rule.t() | map()) :: map()
Coerces a rule struct or map to a plain map.
Compares a source label with a rule label case-insensitively.
Builds a short stable hash for deterministic static row ids.
@spec static_timestamp() :: DateTime.t()
Fixed timestamp used for immutable static rows.
Requires non-blank text.