Dsxir. DemoStrategy. KNN. EmbedText
(dsxir v0.3.0)
Copy Markdown
Deterministic input-map rendering for KNN embedding.
Used at both compile (embedding trainset examples) and inference (embedding the live query) so the two representations land in the same vector space.
Rules
embed_fields: :all— every key ininputs, sorted alphabetically.embed_fields: [:a, :b]— only those keys, in the declared order.
Each field renders as "<name>: <value>\n". Values render via:
to_string/1for strings, atoms (including booleans), numbers.Jason.encode!/1for lists and maps.- Raise
Dsxir.Errors.Invalid.Configuration{reason: :unembeddable_input}for opaque structs that aren't enumerable.
Missing fields render as "<name>: nil\n". The renderer never raises on
missing keys — that is by design.
Summary
Functions
Render inputs to the deterministic embed-text string used at both compile
time and inference time. See the module doc for the field-selection rules
and value-rendering policy.
Types
@type fields() :: :all | [atom()]