Skip to content

VLM fails silently when external API calls are content filtered. #2988

@chrismoseley

Description

@chrismoseley

Bug

When using PictureDescriptionApiOptions with an external API that returns finish_reason: "content_filter" (e.g., Azure OpenAI with content safety filters enabled), the picture description is silently dropped. No warning is logged about the content filtering, and an empty string is stored as the description text.

api_image_request() in docling/utils/api_image_request.py only logs VlmStopReason.LENGTH and VlmStopReason.END_OF_SEQUENCE. Suggest adding VlmStopReason.FILTERED.

Steps to reproduce

Happens even with entirely innocent images. Attached example. Prompt: "
Describe the image in no more than three concise sentences. For graphs, mention the ranges of each axis. If the image is decorative, like a natural landscape or abstract patterns, just say 'decorative image'. "If there are people in the image, describe them and include their demographics like age and gender where possible. Do not invent text or data."

Docling version

2.73

Python version

3.12

Image

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