feat: improving extractor for reasoning models
Feature Request
When using the rig extractor module with open-weight reasoning models like Qwen or Deepseek (running via Ollama), the extractor fails to deserialize the LLM responses due to reasoning traces present in the raw output (e.g.,
Motivation
I'm using rig with Ollama to build some cool stuff at @nudibranches-tech 🌊 and ran into this issue.
Proposal
We could add a few lines to strip reasoning traces from the raw response when using reasoning-style models. I'm happy to contribute a patch for this.
Great issue! Most reasoning models pass reasoning tokens thru an extra response parameter but I'm surprised that Ollama isn't setup like this 😅
I think I could provide the solution for this. Can you assign me to this issue ? I will open a PR.
Hey @mtnqln - if you're still interested in this I've assigned you the ticket. If you're not interested anymore (understandable as it's been a while since the issue was originally opened), let us know.
Hey, I'm still interested, but here's the thing: the initial solution I came up with was mostly based on using regex to strip out the reasoning part inside the think tags from the raw response. Now, I believe Ollama supports reasoning separation via its parameters, so my solution doesn't make much sense anymore. That said, I'm happy to help with adding reasoning support to the Ollama agent struct. I saw that you've already started working on it, and I'm willing to contribute to the reasoning part—just let me know if you need help. I might need a bit of time, though, since I'm not an expert on this crate.