Skip to content

fix(oci): forward V1 chat tool_calls and preserve V1 non-float embedding types - #801

Open
shoemoney wants to merge 1 commit into
cohere-ai:mainfrom
shoemoney:fix/oci-v1-toolcalls-embed-types
Open

fix(oci): forward V1 chat tool_calls and preserve V1 non-float embedding types#801
shoemoney wants to merge 1 commit into
cohere-ai:mainfrom
shoemoney:fix/oci-v1-toolcalls-embed-types

Conversation

@shoemoney

@shoemoney shoemoney commented Aug 24, 2026

Copy link
Copy Markdown

#758 fixed the V2 response paths in transform_oci_response_to_cohere but missed the V1 branches both times.

Chat V1: the request side forwards tools, and NonStreamedChatResponse has a tool_calls field, but the V1 response branch dropped OCI's toolCalls. Command R tool use on the V1 client silently returned tool_calls=None. The OCI COHERE-format entries ({name, parameters}) match the V1 ToolCall shape, so they are now forwarded directly.

Embed V1: embeddings were hardcoded to the float key with response_type: embeddings_floats, so embed(embedding_types=['int8']) silently returned empty embeddings. When the response carries embeddingsByType or any non-float type, the branch now returns embeddings_by_type with the by-type dict, which the generated V1 EmbedResponse union parses. Float-only responses are unchanged.

Both files (src/cohere/oci_client.py, tests/) are covered by .fernignore, so the fix persists across Fern regeneration. Adds V1 mirrors of the existing V2 tests; full suite passes (40 passed vs 38 baseline) and both new tests fail on the pristine source.

…ing types

PR cohere-ai#758 fixed the V2 response paths in transform_oci_response_to_cohere
but the V1 branches were missed both times:

- chat V1: OCI toolCalls were dropped, so Command R tool use on the V1
  client silently returned tool_calls=None. The OCI COHERE-format
  entries ({name, parameters}) match the V1 ToolCall shape, so forward
  them directly.
- embed V1: embeddings were hardcoded to the float key with
  response_type embeddings_floats, so embed(embedding_types=['int8'])
  silently returned empty embeddings. When the response carries
  embeddingsByType or any non-float type, return response_type
  embeddings_by_type with the by-type dict; the float-only paths are
  unchanged.

Adds V1 mirrors of the existing V2 tests for both cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant