LanguageValues and typesStandard typesMaths and data
Embedding
On this page
A list of numbers with the AI model that made it.
Use it to store model output, since vectors from different models can't be compared. For the numbers alone, use Vector.
Shape
Example
Embedding { model: ModelId { provider: "openai" name: "text-embedding-3-small" } vector: [0.5, -0.25, 1.0]}
Good to know
==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"model":"openai/text-embedding-3-small","vector":[0.5,-0.25,1]}{"model":"ollama/nomic-embed-text","vector":[0.0123]}
Details
Text form, storage, how it is shown, and operations
Embedding is in the group Maths and data, and has been in Jadpo since 0.1.0.
Text form
It has no single text form, so text.from and text.parse don't take it.
How it is stored
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 |
How it is 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 also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-embedding.md.Built from Jadpo main at aee2e8f.