Replies: 5 comments 12 replies
-
Let me add a small point, I hope gptel can support OpenRouter's "thinking" mode too. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the news and suggestions. I am going to be too busy until the second half of March to work on this. For now:
(gptel-make-anthropic "Claude-thinking"
:key "your-API-key"
:stream t
:models '(claude-3-7-sonnet-20250219)
:header (lambda () (when-let* ((key (gptel--get-api-key)))
`(("x-api-key" . ,key)
("anthropic-version" . "2023-06-01")
("anthropic-beta" . "pdfs-2024-09-25")
("anthropic-beta" . "output-128k-2025-02-19")
("anthropic-beta" . "prompt-caching-2024-07-31"))))
:request-params '(:thinking (:type "enabled" :budget_tokens 32000))) Select this backend to use Claude 3.7 Sonnet in "thinking" mode.
|
Beta Was this translation helpful? Give feedback.
-
So to be clear, if I don't want to use thinking mode, just swap out my model to `claude-3-7-sonnet-20250219` and use as usual?
Yes, there's no change to how gptel or the Anthropic API works out of the box.
|
Beta Was this translation helpful? Give feedback.
-
Including the thinking block with the response of claude-3-7-sonnet-20250219 is now implemented. The user option is Please update and test. |
Beta Was this translation helpful? Give feedback.
-
I've added support for handling reasoning blocks for Deepseek and OpenRouter as well. If you use any API that produces reasoning content that you can't see or handle in gptel, please let me know. |
Beta Was this translation helpful? Give feedback.
-
In light of @mwolson's helpful note today #662 I note also that Claude Sonnet 3.7 makes a critical addition to the anthropic API to enable thinking. It seems to be fully backward compatible.
I am not that knowledgeable of the GPTel code base yet, and I note the general preference to maintain the KISS principle and ensure minimal impact of new changes on existing functionality. With this in mind @karthink, I've started thinking (pun intended) about how one might integrate this new capability into GPTel without actually embarking on trying to do it yet.
Anthropic have done something new here by creating a model with a single API that allows individual calls to scale between a single step inference and a user managed multi-step reasoning response. It is anyone's guess at this point as to whether this idea will catch on to become more universal. On the assumption that it will, this suggestion captures my initial thoughts about how this capability could be integrated into GPTel. I'm interested in know if you think I'm on the right track. If so it might worth a PR.
This capability will likely require:
So perhaps something like:
three new model parameters are needed, perhaps
:thinking-capable
flag:max-thinking-tokens
limit:max-output-tokens
limitAnother approach is just the second two parameters where thinking capable is implicitly nil when the max thinking tokens is set to zero. That would be my personal preference. This is especially the case if other model vendors choose to implement this form of API to their models. In the contrary perhaps for other reasons it would be important that GPTel has a flag it can test to see whether a model is thinking capable or not.
The
gptel--request-data
method will need to be modified to add the thinking configuration (when it's enabled).Perhaps two new customization variables.
Again, perhaps we only need the second one, where a value zero, implies thinking mode is switched off or unavailable.
add some additions to the
gptel-menu
menuChanges to how the response is handled for thinking events. This speaks to some related issues and discussions such as Removing <think>....</think> blocks from Deepseek responses #579, Explicit Tool Turns #626, Add response color-coding & role setting for gptel buffer #343, and Include DeepSeek's reasoning_content when present #592. I do not express a strong opinion on this yet.
These changes would enable GPTel users to take advantage of Claude 3.7's extended thinking capabilities while maintaining the existing workflow and interface familiarity.
My goal here is to present a starting point for discussion rather than a complete solution, which I htink is appropriate given GPTel's development philosophy and the novelty of Anthropic's thinking mode approach.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions