Skip to content

API_OPENAI VLM engine is not Azure OpenAI GPT-5 compatible due to hardcoded generation params #3112

@janosbabik

Description

@janosbabik

Bug

When using Docling picture description through the OpenAI-compatible API VLM engine against Azure OpenAI GPT-5 chat deployments, Docling sends request parameters that Azure rejects.

Observed issues:

  • max_tokens is sent, but Azure requires max_completion_tokens for this model
  • temperature=0.0 is sent, but this deployment only accepts the default temperature value

This makes picture description fail unless downstream users monkeypatch Docling internals.

Relevant areas appear to be:

  • docling/models/inference_engines/vlm/api_openai_compatible_engine.py
  • docling/models/stages/picture_description/picture_description_vlm_engine_model.py

The failure path appears to be:

  • picture description input is created with temperature=0.0 and max_new_tokens=200
  • OpenAI-compatible API engine maps max_new_tokens to max_tokens
  • Azure rejects the request

Typical Azure errors:

  • Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.
  • Unsupported value: 'temperature' does not support 0.0 with this model. Only the default (1) value is supported.

Steps to reproduce

  1. Configure Docling picture description with PictureDescriptionVlmEngineOptions.from_preset(...)
  2. Use ApiVlmEngineOptions(engine_type=VlmEngineType.API_OPENAI, ...)
  3. Point the URL to an Azure OpenAI chat completions endpoint, for example:
    https://<resource>.openai.azure.com/openai/deployments/<deployment>/chat/completions?api-version=<version>
  4. Use a GPT-5 chat deployment that supports image input
  5. Run document conversion with picture description enabled
  6. Observe request failure from Azure OpenAI because of unsupported generation parameters

Docling version

2.78.0

Python version

3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions