Skip to content

Disable document input for AlibabaProvider (Chat Completions API)#5727

Open
dsfaccini wants to merge 5 commits into
pydantic:mainfrom
dsfaccini:alibaba-document-input
Open

Disable document input for AlibabaProvider (Chat Completions API)#5727
dsfaccini wants to merge 5 commits into
pydantic:mainfrom
dsfaccini:alibaba-document-input

Conversation

@dsfaccini
Copy link
Copy Markdown
Collaborator

@dsfaccini dsfaccini commented May 29, 2026

What

Sending a document (BinaryContent(media_type='application/pdf') or DocumentUrl) to AlibabaProvider + OpenAIChatModel failed with an opaque HTTP 400, because Pydantic AI emits an OpenAI type:file content part that Alibaba's compatible-mode Chat Completions endpoint rejects.

This sets openai_chat_supports_document_input=False on the Alibaba OpenAIModelProfile, so document input now raises a clear UserError client-side — mirroring the existing AzureProvider treatment (#4048).

Verification

The limitation is confirmed by the API's own 400 in #5724 (enumerates the supported content-part types — file is not among them):

ModelHTTPError: status_code: 400, model_name: qwen-long, body: {'message':
"Invalid value: file. Supported values are: 'text','image_url','video_url' and 'video'.",
'type': 'invalid_request_error', 'param': "'messages.[0].content[1].type'", 'code': 'invalid_value'}

Checklist

  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • No breaking changes in accordance with the version policy.
  • PR title is fit for the release changelog.

Alibaba's compatible-mode endpoint rejects OpenAI `type:file` parts, so document input now raises a clear UserError client-side, mirroring the Azure provider.
@github-actions github-actions Bot added size: S Small PR (≤100 weighted lines) bug Report that something isn't working, or PR implementing a fix labels May 29, 2026
Comment thread tests/providers/test_alibaba_provider.py
Comment thread tests/providers/test_alibaba_provider.py Outdated
@dsfaccini
Copy link
Copy Markdown
Collaborator Author

hey @InfernalAzazel ! could you try this PR's branch's pydantic-ai installation to check whether it solves your issue(s)? I don't have an alibaba cloud setup to test with.

dsfaccini added 3 commits June 1, 2026 14:05
Mirror the Azure `DocumentUrl` unsupported note in `docs/input.md` and add a note to the Alibaba section in `docs/models/openai.md`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alibaba bug Report that something isn't working, or PR implementing a fix size: S Small PR (≤100 weighted lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input PDF Data into qwen3.6-plus

1 participant