fix(oci): forward V1 chat tool_calls and preserve V1 non-float embedding types - #801
Open
shoemoney wants to merge 1 commit into
Open
fix(oci): forward V1 chat tool_calls and preserve V1 non-float embedding types#801shoemoney wants to merge 1 commit into
shoemoney wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#758 fixed the V2 response paths in
transform_oci_response_to_coherebut missed the V1 branches both times.Chat V1: the request side forwards
tools, andNonStreamedChatResponsehas atool_callsfield, but the V1 response branch dropped OCI'stoolCalls. Command R tool use on the V1 client silently returnedtool_calls=None. The OCI COHERE-format entries ({name, parameters}) match the V1ToolCallshape, so they are now forwarded directly.Embed V1: embeddings were hardcoded to the
floatkey withresponse_type: embeddings_floats, soembed(embedding_types=['int8'])silently returned empty embeddings. When the response carriesembeddingsByTypeor any non-float type, the branch now returnsembeddings_by_typewith the by-type dict, which the generated V1EmbedResponseunion 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.