Embedding
A vector with the model that made it, since vectors from different models can't be compared.
Maths and data; not ordered; since Jadpo 0.1.0.
Make one
Build one from its fields, Embedding { model: ... vector: ... }.
Fields
Text, JSON and storage
It has no single text form, so text.from and text.parse don't take it. JSON sends an object of its parts.
| JSON |
|---|
{"model":"openai/text-embedding-3-small","vector":[0.5,-0.25,1]} |
{"model":"ollama/nomic-embed-text","vector":[0.0123]} |
It is stored in 3 columns, each named for the field, _ and its suffix. This is {"model":"ollama/nomic-embed-text","vector":[0.0123]}:
| Column | Type | Holds |
|---|---|---|
<field>_model_provider |
text |
'ollama' |
<field>_model_name |
text |
'nomic-embed-text' |
<field>_vector |
vector |
'[0.0123]'::vector |
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"model":"openai/text-embedding-3-small","vector":[0.5,-0.25,1]} |
openai/text-embedding-3-small [0.5; -0.25; 1] |
{"model":"ollama/nomic-embed-text","vector":[0.0123]} |
ollama/nomic-embed-text [0.0123] |
Operations
It has the contract's own operations: text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-embedding.md.Built from Jadpo main at e00e61f.