@corbits/embedding turns texts into vectors over any OpenAI-compatible
/v1/embeddings endpoint, with @intx/inference retries and error
classification. It owns batching, reply integrity and the one-shot JSON
transport. It does not store or search vectors; that is @corbits/memory.
src/embed.ts:EmbedConfigSchema,embedTexts,probeEmbedDims, batch splitting and reply parsing (float and base64).src/request.ts:runJSONRequest(private transport),EmbeddingRequestError,Retry-Afterextraction.src/index.ts: the only module consumers import from.e2e/: harness-driven retry, wire and base64 suites, plus a live round trip gated onEMBEDDING_E2E_BASE_URL.
- Place vectors by the echoed
index, never by array position. Reject short, duplicate or out-of-range replies instead of mispairing. - Batches run sequentially; retry policy is per request.
- Throw
EmbeddingRequestErrorcarrying the classifiedInferenceErrorasreason; never throw theInferenceErroritself. - Read a 200 as text, then
JSON.parse, so a non-JSON body classifies as a protocol mismatch. - Omit
dimensionsandencoding_formatfrom the wire unless configured. - Backoff time comes from
deps.scheduler, not wall-clock globals. exactOptionalPropertyTypesis on: omit optional keys, never assignundefinedto them.
bun install
bun run check- Read
README.mdbefore changing public behavior. - Keep changes focused; update docs and tests alongside code changes.
- Run
bun run checkbefore declaring work complete.