Skip to content

Commit bb9d3a4

Browse files
committed
fix(oci): add response_type to embed response for SDK discriminated union
The SDK's EmbedResponse is a discriminated union on response_type (embeddings_floats vs embeddings_by_type). The OCI embed response transformation was missing this field, causing pydantic to return None instead of an EmbedResponse object. This broke V1 embed when the SDK's merge_embed_responses tried to access .meta on None. V1 (flat float arrays) now returns response_type="embeddings_floats", V2 (typed dict) returns response_type="embeddings_by_type".
1 parent 0654585 commit bb9d3a4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/cohere/oci_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,10 @@ def transform_oci_response_to_cohere(
878878
if "billed_units" in usage:
879879
meta["billed_units"] = usage["billed_units"]
880880

881+
response_type = "embeddings_by_type" if is_v2 else "embeddings_floats"
882+
881883
return {
884+
"response_type": response_type,
882885
"id": oci_response.get("id", str(uuid.uuid4())),
883886
"embeddings": embeddings,
884887
"texts": [],

0 commit comments

Comments
 (0)