Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Claude 3.7 Sonnet Support #662

Closed
mwolson opened this issue Feb 24, 2025 · 7 comments
Closed

Claude 3.7 Sonnet Support #662

mwolson opened this issue Feb 24, 2025 · 7 comments
Labels
enhancement New feature or request

Comments

@mwolson
Copy link

mwolson commented Feb 24, 2025

Claude 3.7 Sonnet just launched: https://www.anthropic.com/news/claude-3-7-sonnet

I wrote this code snippet to start using it early:

    (require 'gptel-anthropic)
    (unless (alist-get 'claude-3-7-sonnet-20250219 gptel--anthropic-models)
      (add-to-list 'gptel--anthropic-models
                   '(claude-3-7-sonnet-20250219
                     :description "Highest level of intelligence and capability" :capabilities
                     (media tool-use cache)
                     :mime-types
                     ("image/jpeg" "image/png" "image/gif" "image/webp" "application/pdf")
                     :context-window 200 :input-cost 3 :output-cost 15 :cutoff-date "2024-11")))

The knowledge cutoff date is taken from: https://support.anthropic.com/en/articles/8114494-how-up-to-date-is-claude-s-training-data

@mwolson mwolson added the enhancement New feature or request label Feb 24, 2025
@lispy-ai
Copy link

And also support for Thinking Mode: #663

@endgame
Copy link

endgame commented Feb 25, 2025

Already done? 2bb081e

@wlauppe
Copy link

wlauppe commented Feb 25, 2025

Already done? 2bb081e

Indeed, this is already implemented. Kudos karthik! What a speed!
I upgraded, to the latest commit:
Claude 3.7 works flawlessly. Great 👍

What we should think about is how the new features can be expossed. Claude 3.7 has "extended thinking" available
there are two parameters:

extended_thinking_enabled: True/False
extended_thinking_budged_tokens: Integer

the budget_tokens should be the tokens used for thinking and always set less than the max_tokens.
in the api the vars are called slightly different, but i think it might sense to rename them if you expose them in emacs. The above is my suggestion. The final curl should look like this.

 "model": "claude-3-7-sonnet-20250219",
    "max_tokens": 20000,
    "thinking": {
        "type": "enabled",
        "budget_tokens": 16000
    },

Here are the complete docs.
https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking

Karthik, can you make this two parameters in the gptel-menu and general gptel api availabe. That would be great!

@endgame
Copy link

endgame commented Feb 25, 2025

I would follow #663, which seems to be the discussion for "thinking mode".

karthink added a commit that referenced this issue Feb 25, 2025
* README.org: Mention interim support for Claude 3.7
Sonnet. (#662, #663)
@karthink
Copy link
Owner

I've added some instructions for using thinking mode to the README. As mentioned in #663, I'll add proper support to the UI and backend parsers along with the other APIs that provide reasoning models, but it will take a few weeks.

@karthink
Copy link
Owner

karthink commented Mar 8, 2025

I've added support for including claude-3-7-sonnet-20250219's thinking/reasoning content with the response, or redirecting it elsewhere.

The user option is gptel-include-reasoning, and it should work for all backends/models that include reasoning blocks. As with most options you can set it from the transient menu with whatever scope you need.

Please let me know if it works as expected.

@karthink
Copy link
Owner

karthink commented Mar 9, 2025

Closing as there are no additional actions planned for claude-3-7 right now.

@karthink karthink closed this as completed Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants