Ollama thinking included in response with 1.123.5 and ollama 0.13.2

Describe the problem/error/question

After the update to N8N 1.123.5 and ollama 0.13.2, I start to get the model thinking in the output. I can’t find a reliable way of stripping the model thinking. A tcpdump shows that ollama is sending thinking and output is different JSON tags, but as far as I can tell, N8N are combining them without any separator.

What is the error message (if any)?

Please share your workflow

Chat node, AI agent, ollama chat with gpt-oss:20b

Input


[
  
{
  
  
"sessionId": 
"6bfd4816280f4594a47014df63543099",
  
  
"action": 
"sendMessage",
  
  
"chatInput": 
"What is the weather today?"
  
}
]

Share the output returned by the last node

[{“output”: “The user asks: "What is the weather today?" The assistant doesn’t have real-time weather knowledge. We should ask clarifying question: location, maybe use a weather API? There’s no weather tool. We could use external services? There’s no weather function. So we need to ask for location.I’m not able to fetch real‑time data directly. Could you let me know which city or region you’d like the weather for? Once I have that, I can look up the current forecast for you.”}]
Information on your n8n setup
  • n8n version: 1.123.5
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux

Over the wire, the streaming looks like this

{"model":"gpt-oss:20b","created_at":"2025-12-10T22:37:12.234735277Z","message":{"role":"assistant","content":"","thinking":"?"},"done":false}   {"model":"gpt-oss:20b","created_at":"2025-12-10T22:37:12.922828952Z","message":{"role":"assistant","content":"sen"},"done":false}  

Digging a bit in the code, it’s N8N node → Language chain → ollama. Still tryng to find out where the thinkingand contenttags are concatenated.

But around here somewhere

It’s here at line 763

Over the wire, the streaming looks like this

{"model":"gpt-oss:20b","created_at":"2025-12-10T22:37:12.234735277Z","message":{"role":"assistant","content":"","thinking":"?"},"done":false}   {"model":"gpt-oss:20b","created_at":"2025-12-10T22:37:12.922828952Z","message":{"role":"assistant","content":"sen"},"done":false}  

Digging a bit in the code, it’s N8N node → Language chain → ollama. Still tryng to find out where the thinkingand contenttags are concatenated.

But around here somewhere

languagechain.js - libs/providers/langchain-ollama/src/chat_models.ts@763

Or can be here at line 96. It dependes whether language chain should have an option to hide thinking or if N8N should have an option to pick textor message.content

master/packages/%40n8n/nodes-langchain/nodes/llms/N8nLlmTracing.ts@96

Upgrade to @langchain/[email protected] solves the issue. Created pull request #23098

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.