Skip to content

[BUG] reasoning_content is dropped in conversation history when using LiteLLM with reasoning models #891

Description

@daewoongoh

Problem (one or two sentences)

When using a model that supports reasoning (e.g., DeepSeek R1) through the LiteLLM proxy, the reasoning_content of previous assistant messages is dropped from the conversation history sent to the API, causing the model to lose its train of thought in subsequent turns.

Context (who is affected and when)

This affects any user connecting to reasoning-capable models (like DeepSeek Reasoner) via the LiteLLM provider. It happens during multi-turn conversations where the assistant utilizes tool calls followed by a user message.

Reproduction steps

  1. Start Zoo Code and select "LiteLLM" as the API Provider.
  2. Connect to a reasoning-supported model (e.g., deepseek-reasoner) via LiteLLM.
  3. Ask the model to perform a task that requires a tool call (e.g., "Read this file and then explain it").
  4. After the tool is executed and the result is returned, check the payload of the next API request.
  5. Observe that the previous turn's reasoning block is missing.

Expected result

The reasoning_content generated by the model should be preserved in the conversation history and merged properly with tool results so that the API does not drop it in subsequent requests.

Actual result

The conversation history falls back to standard OpenAI formatting, which fails to merge tool results with text properly, causing the upstream API (like DeepSeek) to drop all previously recorded reasoning_content.

Variations tried (optional)

No response

App Version

v3.68.0

API Provider (optional)

LiteLLM

Model Used (optional)

No response

Zoo Code Task Links (optional)

No response

Relevant logs or errors (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions