fix(oci): convert image_url to camelCase for OCI vision requests#761
Merged
daniel-cohere merged 2 commits intocohere-ai:mainfrom Apr 13, 2026
Merged
Conversation
…ests OCI Generative AI expects camelCase field names. The SDK transforms message roles and content types but passed image_url through as-is, causing 400 errors on Command A Vision with inline images. Added integration test that sends a 1x1 red PNG to Command A Vision and verifies the model correctly identifies the color. Fixes cohere-ai#760
daniel-cohere
approved these changes
Apr 13, 2026
Keep both the vision test (from this branch) and the tool use, type lowercasing, multi-turn, and safety_mode tests (from upstream).
Contributor
Author
|
@daniel-cohere Conflicts resolved and all 65 integration tests passing against live OCI GenAI (including the new vision test). Ready for merge whenever you are. |
daniel-cohere
approved these changes
Apr 13, 2026
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.
Summary
Fixes #760 —
OciClientV2.chat()with image content returns 400 on Command A Vision.Root Cause
OCI Generative AI expects camelCase field names. The SDK already transforms roles (
"user"→"USER"), content types ("text"→"TEXT"), and tool types ("function"→"FUNCTION"in #758), but passesimage_urlthrough as snake_case instead of converting toimageUrl.SDK sent:
{"type": "IMAGE_URL", "image_url": {"url": "data:image/png;base64,..."}}OCI expects:
{"type": "IMAGE_URL", "imageUrl": {"url": "data:image/png;base64,..."}}Fix
Convert
image_url→imageUrlin content items during request transformation.Verified
Integration test added
test_chat_vision_v2sends a 1x1 red PNG to Command A Vision and asserts:Test plan
test_chat_vision_v2passes against OCI us-chicago-1 with command-a-vision@daniel-cohere Vision was broken on OCI because
image_urlwasn't converted to camelCaseimageUrl. Same pattern as the tool type issue in #758.Note
Low Risk
Low risk, localized request-shaping change for
OciClientV2.chat()plus a new integration test; primary risk is limited to OCI vision payload compatibility/regression for message content transformation.Overview
Fixes
OciClientV2chat request transformation to convert vision content items from snake_caseimage_urlto OCI-required camelCaseimageUrl, preventing 400s on Command A Vision.Adds an integration test (
test_chat_vision_v2) that sends a tiny inline PNG viaimage_urlcontent and asserts the model returns a non-empty response that identifies the color.Reviewed by Cursor Bugbot for commit 537b1eb. Bugbot is set up for automated code reviews on this repo. Configure here.