Skip to content

Commit 645d3d1

Browse files
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.
1 parent 7166a53 commit 645d3d1

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • src/openarmature/retrieval/providers

src/openarmature/retrieval/providers/cohere.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ def _request_params_from_config(config: RerankRuntimeConfig | None) -> dict[str,
144144
_COHERE_EMBED_MAX_INPUTS = 96
145145

146146
# §8.4 *input_type (mandatory wire field)*: the closed set the mapping
147-
# recognizes, translated into Cohere's mandatory input_type wire value. Cohere's
148-
# other input_type values (classification / clustering / image) ride the extras
149-
# pass-through bag, not OA's input_type (widening input_type's normative value
150-
# space is a §2 / 0077 protocol-level change, deferred until a consumer needs it).
147+
# recognizes, translated into Cohere's mandatory input_type wire value. OA's
148+
# input_type is {query, document}; Cohere's other input_type values
149+
# (classification / clustering / image) are OUTSIDE that value space and are NOT
150+
# reachable through this mapping -- input_type is a declared config field (so it
151+
# cannot ride the extras bag) and an unrecognized value is rejected pre-send.
152+
# Widening input_type's normative value space is a deferred §2 / 0077 change.
151153
_INPUT_TYPE_TO_COHERE: dict[str, str] = {
152154
"query": "search_query",
153155
"document": "search_document",
@@ -174,8 +176,7 @@ def _cohere_input_type(input_type: str | None) -> str:
174176
resolved = _INPUT_TYPE_TO_COHERE.get(input_type)
175177
if resolved is None:
176178
raise ProviderInvalidRequest(
177-
f"Cohere input_type must be one of {sorted(_INPUT_TYPE_TO_COHERE)} (got {input_type!r}); "
178-
"other Cohere input_type values ride the extras pass-through bag"
179+
f"Cohere input_type must be one of {sorted(_INPUT_TYPE_TO_COHERE)} (got {input_type!r})"
179180
)
180181
return resolved
181182

@@ -480,8 +481,9 @@ class CohereEmbeddingProvider:
480481
``truncate: "NONE"`` is sent explicitly (an over-length input errors rather
481482
than being silently truncated); ``dimensions`` maps to Cohere's
482483
``output_dimension`` when set. Other precisions (``int8`` / ``base64`` /
483-
...) and ``input_type`` values (``classification`` / ...) ride the extras
484-
pass-through bag.
484+
...) ride the extras pass-through bag; Cohere's other ``input_type`` values
485+
(``classification`` / ...) are outside OA's ``input_type`` value space and
486+
are not reachable through this mapping.
485487
486488
``ready()`` verifies the bound model with a minimal one-input ``/v2/embed``
487489
probe. The Cohere ``/v2/embed`` wire exposes no model-catalog probe, so

0 commit comments

Comments
 (0)