|
Hi folks, I'm building an agent that is embedded in a chatbot. The agents uses several tools. The challenge i'm facing is that the agent outputs the LLM thinking (within tags) which includes its tool-plan. How can i exclude the "thinking" and output only the final content? |
Replies: 3 comments
|
Actually, I was about to open a discussion for the opposite haha. When using the Ollama client, it stopped outputting the thinking process after this update. Would be good to have this as an option. Seeing the thinking processes while developing helps a lot with the prompt engineering. But I agree, it should be optional. |
|
Im facing the same issue as some of the model like claude model , it does not output thinking tag , directly show the thinking step as the output, which make my final output include tool use thinking step. If the thinking can be consistent across all model, it would be better for developer to render the thinking process to frontend |
|
Hi @hshabbirh, apologies for taking this long to circle back, this one deserved an answer months ago. There are two different "thinkings" here. Native reasoning (e.g. Bedrock with thinking enabled, Gemini thinking models) is kept separate by the SDK: in The @williamgurzoni for your opposite case: since that Ollama change, capable models think by default but the reasoning moves out of @yyhao0422 the consistency you're after exists for models that emit structured reasoning: the SDK normalizes all of those into the same Hope this helps all three of you! |
Hi @hshabbirh, apologies for taking this long to circle back, this one deserved an answer months ago.
There are two different "thinkings" here. Native reasoning (e.g. Bedrock with thinking enabled, Gemini thinking models) is kept separate by the SDK: in
agent.stream_async()those deltas arrive as events with areasoningTextkey, while normal answer text arrives underdata. So in a chatbot you just renderevent["data"]and drop the rest. Note the defaultAgentalso prints everything to stdout, so passcallback_handler=Noneif you're consuming the stream yourself. Docs: https://strandsagents.com/docs/user-guide/concepts/streaming/The
<thinking>tags you're seeing are the second kind: the m…