Louis_Frolio
Databricks Employee
Databricks Employee

Hey @trickywhitecat ,

You're right that when thinking.type is enabled for Gemini 2.5 Flash on a Databricks serving endpoint, the content field comes back as a list of dictionaries instead of a plain string. That breaks the expected OpenAI ChatCompletion schema (content: Optional[str]), and anything relying on strict type checking, including MLflow, will trip over it.

A few things worth calling out:

  1. This is specific to reasoning/thinking mode. With thinking disabled, content comes back as a string as expected.

  2. The thinking parameter config for Gemini models is underdocumented. Right now you have to reverse-engineer the payload structure from the Claude example. There should be a dedicated Gemini 2.5 example showing both the extra_body configuration and the actual response structure.

  3. Your core point stands: an "OpenAI-compatible" endpoint should return OpenAI-compatible responses regardless of model config. If the content field shape changes based on a toggle, that either needs to be normalized server-side or documented explicitly.

For anyone working around this today, here's a simple adapter:

msg = response.choices[0].message

if isinstance(msg.content, list):
    text_blocks = [
        block.get("text", "")
        for block in msg.content
        if block.get("type") == "text"
    ]
    answer = "".join(text_blocks)
else:
    answer = msg.content or ""

That gives you a plain string you can pass into any tooling that expects the standard schema.

The documentation gaps your post highlights are concrete and actionable:

  • A Gemini 2.5-specific example in the reasoning models doc showing the exact extra_body payload and the response content structure when thinking is enabled.
  • An explicit callout in the OpenAI-compatible sections that reasoning models may return List[Block] instead of str, with a normalization snippet like the one above.

I'd also encourage you to file this through Databricks Support if you haven't already. Community posts surface visibility, but a support ticket gets it into the product team's tracking.

Cheers, Lou