Skip to main content

Module embedding

Module embedding 

Source
Expand description

One vocabulary and one set of checks for both sides of an embedding exchange.

Structs§

Embed
Error
Failed
Input
Limits
Model
Ready
Start
Vectors
Window
EMB-E2: one window of a text: its bytes [start, end), on char and token boundaries, and their vector.
Windows
EMB-E2: how a text longer than the model reads is embedded whole.

Enums§

Distance
FailedCode
ItemCode
Kind
Message
Outcome
Tag

Constants§

FAILED_MESSAGE_CHARS
MEMORY_LIMIT_EXIT
MINIMUM_FRAME_BYTES
PROTOCOL
PROTOCOL_WINDOWS
EMB-E2: the protocol a Start names when it asks for windows. A worker answers Ready with the protocol its Start named.

Functions§

check_embed
Check a batch has a bounded item count and distinct valid identifiers.
check_model_limits
Check that token and frame limits fit the model and its largest answer.
check_model_limits_windowed
check_model_limits, and with windows (EMB-E2) a frame that carries the largest windowed answer and an overlap below the model’s content tokens, so every window moves forward through its text.
check_ready
Ready names protocol 1 or, for a Start that asked for windows, 2; the service checks it names the protocol its Start did.
check_start
Validate the protocol, model path and positive exchange limits.
check_vectors
Check answer count, order, vectors and refusal outcomes against the request.
check_vectors_windowed
check_vectors for a worker started with windows (EMB-E2): an item of a document Embed may also answer its windows, or windows_over_cap; a question is never windowed.
decode_message
Decode a tagged JSON object and validate its exchange envelope.
decode_vector
Decode lowercase little-endian hexadecimal into finite float members.
encode_vector
Encode finite float members as lowercase little-endian hexadecimal.
input_refusal
read_message
Read and decode one bounded frame; clean EOF returns no message.
read_start
Read the first exchange with its fixed bound before allocating the payload.
vectors_message_size
Upper bound for tag plus compact JSON, not the usual message size. Includes maximally escaped ids and the widest whole-number token counts.
windows_message_size
EMB-E2: vectors_message_size when each item may answer up to max_windows windows, each its bounds, its vector and its token count.
write_message
Validate an envelope and write its tagged JSON in one flushed frame.