Commit c66a1d9
authored
Add 0091 Cohere /v2/embed wire mapping (#216)
* Add 0091 Cohere /v2/embed wire mapping
Add the retrieval-provider 0091 Cohere /v2/embed wire mapping (section
8.4) as a new CohereEmbeddingProvider. input_type is mandatory on the
Cohere wire: query maps to search_query, document to search_document, an
absent input_type to search_document (the bulk-indexing default), and an
unrecognized value is rejected pre-send. embeddings.float parses in input
order, output_dimension maps from dimensions, and truncate NONE is
fail-loud. embedding_types requests float, merging a caller's other
precisions rather than clobbering them. Over the 96-input Cohere cap the
call chunk-and-stitches: one request per chunk, vectors concatenated in
input order with each chunk's count validated, input_tokens summed, and
response_id from the first chunk.
Un-defer conformance fixtures 032-037, add a cohere embed branch to the
harness, and flip conformance.toml. Env-gated live tests cover embed and
output_dimension.
* Validate embedding_types elements before preserving them
The embedding_types merge only checked list-ness and non-emptiness, so a
caller extra containing non-string elements (e.g. [{"x": 1}]) was
preserved and would be sent as an invalid Cohere wire payload,
contradicting the "malformed falls back to [float]" comment. Require a
non-empty list of non-empty strings before preserving it; anything else
falls back to ["float"].
* List all bundled providers in the retrieval docstring
The module docstring named only the OpenAI, Cohere-rerank, and TEI
providers, omitting the Jina providers and the new CohereEmbeddingProvider.
List the full bundled set (OpenAI embed, TEI embed + rerank, Jina and
Cohere embed + rerank) to match what the module exports.
* Correct the Cohere input_type extras-escape-hatch wording
The error message, docstring, and comment claimed Cohere's other input_type
values (classification / clustering / image) ride the extras pass-through
bag. That is unachievable: input_type is a declared config field (so a
caller cannot route it through model_extra), and an unrecognized value is
rejected pre-send. Reword to the achievable behavior -- those values are
outside OA's {query, document} value space and not reachable through this
mapping; the precision escape hatch (embedding_types) is unaffected. The
§8.4 wording it was copied from is flagged to spec separately.
* Correct the 0091 note input_type extras wording
The conformance.toml 0091 note repeated the unachievable claim that
Cohere's classification / clustering / image input_type values ride the
extras pass-through bag. Reword to match the code: those values are
outside OA's {query, document} value space and not reachable through this
mapping (input_type is a declared field; widening it is deferred).1 parent 75c452e commit c66a1d9
7 files changed
Lines changed: 884 additions & 56 deletions
File tree
- src/openarmature/retrieval
- providers
- tests
- conformance
- integration
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
878 | | - | |
879 | | - | |
| 878 | + | |
880 | 879 | | |
881 | | - | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
882 | 883 | | |
883 | 884 | | |
884 | 885 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
0 commit comments