Skip to content

fix: OCI vision requests fail — image_url not converted to camelCase #760

@fede-kamel

Description

@fede-kamel

Bug

OciClientV2.chat() with image content returns 400 from OCI Generative AI when using Command A Vision:

status_code: 400, body: {'message': 'Please pass in correct format of request.'}

Root Cause

OCI Generative AI expects camelCase field names. The SDK transforms message roles and content types but passes image_url through as-is instead of converting it to imageUrl.

SDK sends:

{"type": "IMAGE_URL", "image_url": {"url": "data:image/png;base64,..."}}

OCI expects:

{"type": "IMAGE_URL", "imageUrl": {"url": "data:image/png;base64,..."}}

Impact

All vision requests via OciClientV2 with inline images are broken.

Reproduction

response = client.chat(
    model="command-a-vision",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What color is this image?"},
            {"type": "image_url", "image_url": {"url": "data:image/png;base64,..."}},
        ],
    }],
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions