Skip to content

Pass reasoning_content for deepseek models #501

@vinaysb

Description

@vinaysb

Hello, I have been trying to make queries via your sdk to the deepseek-v4-pro and flash models but the official provider seems to be requiring the presence of "reasoning_content" after every tool call or the api call is rejected with a provider returned error message.

the current format seems to be,

{ role: "user", content: "What time is it in London? Call the get_time tool." },
{
  role: "assistant",
  content: msg1.content,
  tool_calls: msg1.tool_calls,
  reasoning: msg1.reasoning,
  reasoning_details: msg1.reasoning_details,
},
{
  role: "tool",
  tool_call_id: toolCall.id,
  content: "The current time in London is 21:45 UTC.",
}

but it needs to be as follows for deepseek-v4

{ role: "user", content: "What time is it in London? Call the get_time tool." },
{
  role: "assistant",
  content: msg1.content,
  tool_calls: msg1.tool_calls,
  reasoning_content: msg1.reasoning ?? "",
},
{
  role: "tool",
  tool_call_id: toolCall.id,
  content: "The current time in London is 21:45 UTC.",
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    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