embed.v1
Status: v1. A published shape is frozen by spec.md section 20.1.
Capability key: embed
Route: POST /embed
Parts in
One row for each part kind that this capability accepts. A kind that is not in
this table is invalid_part.
| kind | role | required | meaning |
|---|---|---|---|
| text | any | yes, one or more | the text to embed. The role is not significant. |
Parameters
The plugin validates these. A parameter that is not in this table is ignored, not an error (R26).
| name | type | default | meaning |
|---|---|---|---|
dimensions | uint | catalogue | the length of every vector |
normalize | bool | true | scale every vector to unit length |
There is no encoding parameter. The payload is always application/cbor with
float32 values.
Channels out
One row for each channel that this capability can emit.
| channel | mime | payload |
|---|---|---|
| embedding | application/cbor | one array of vectors. One vector per text part, in input order. |
Terminal metadata
done.meta is vocabulary-defined. The core stores it and never reads it.
done without meta means {}.
| key | type | meaning |
|---|---|---|
model | string | the served name that ran the job |
dims | uint | the length of every vector in this job |
model and dims are present when outcome is completed. They are absent
when the outcome is cancelled or expired.
Request
POST /embed
{
"model": "<served-name>",
"input": [
{"kind": "text", "text": "A record of reserved bytes."},
{"kind": "text", "text": "A ledger is a map of devices."},
{"kind": "json", "role": "options", "json": {"intent": "lookup"}}
],
"params": {"dimensions": 4096, "normalize": true},
"stream": false
}
Response, no stream
{"job": "019...", "outcome": "completed",
"embedding": {"mime": "application/cbor", "inline": "<cbor array of vectors>"},
"usage": {"tokens_in": 2},
"meta": {"model": "<served-name>", "dims": 4096}}
Stream
embed is not a streamed capability. stream = true still gives one artifact
in one done frame. No event frame precedes it.
done outcome=completed
artifacts=[{"channel":"embedding","mime":"application/cbor","inline":"<cbor>"}]
meta={"model": "<served-name>", "dims": 4096}
Rules
- At least one
textpart is required. A request with notextpart isinvalid_part. - An
image,audio,video,tokens, orjsonpart isinvalid_part. - The
embeddingpayload is one array. Its length equals the number oftextparts. - Vector
iis the output oftextparti. The plugin never reorders the array. - Every vector is an array of float32 values. The length of every vector
equals
meta.dims. normalize = truescales every vector to unit length.normalize = falseleaves the vector as the model gave it.dimensionsis never larger than the catalogue value for the model. A larger value gives a refusal that namesdimensions.- One
embeddingpayload carries the whole array. The plugin never splits one job into two payloads. usage.tokens_inis the number of prompt tokens. It is absent when the plugin cannot count them.- No event follows a
cancel. The terminal frame isdonewithoutcome = cancelled. - The plugin emits CBOR bytes on the
embeddingchannel. It emits nothing else for this job.