Skip to content

Python: [Bug]: Content.from_uri regression - Service failed to complete the prompt: Error code: 400 #5120

@savvasp-123

Description

@savvasp-123

Description

Using the new FoundryChatClient with agent framework version 1.0.0, sending image data via base64 no longer works.

Code sample:

# Note: "agent" is made using FoundryClient.as_agent and some default options for structured outputs
 
with open("my_image.jpg", "rb") as f:
    image_bytes = f.read()    
    image_b64 = base64.b64encode(image_bytes).decode("utf-8")
    c = [Content.from_uri(uri=f"data:image/jpeg;base64,{image_b64}")]
    m = Message(role="user", contents=c)
    result = await agent.run(m)

Error:
{'error': {'code': 'invalid_payload', 'message': 'The provided data does not match the expected schema', 'param': '/', 'type': 'invalid_request_error', 'details': [], 'additionalInfo': {'request_id': '5e748b2875102c59bd87bc285f8d6b4a'}}}

Package Versions

agent-framework-core:1.0.0

Python Version

3.13

Additional Context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions