Skip to content

Conversation

@bjoaquinc
Copy link
Contributor

@bjoaquinc bjoaquinc commented Jun 4, 2025

📝 Summary

Anthropic returns an error when extended thinking is enabled and the temperature isn’t 1. This change automatically sets the temperature to 1 for extended-thinking models and keeps the default at 0.2 for all others. It also tidies up default constants and clarifies comments.

Screenshot 2025-06-04 at 2 23 03 AM

🔍 Description of Changes

  • Added DEFAULT_EXTENDED_THINKING_TEMPERATURE and DEFAULT_EXTENDED_THINKING_BUDGET_TOKENS in AnthropicProvider based on the anthropic documentation
  • Added EXTENDED_THINKING_MODEL_PREFIXES based on the anthropic documentation
  • Created an is_extended_thinking_model method to check if the selected model starts with any of the EXTENDED_THINKING_MODEL_PREFIXES
  • Created a get_temperature which only sets temperature to DEFAULT_EXTENDED_THINKING_TEMPERATURE if is_extended_thinking_model otherwise it sets the temperature to 0.2.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

📜 Reviewers

@mscolnick

@vercel
Copy link

vercel bot commented Jun 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2025 5:46am

Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very clean fix! Thank you

@mscolnick mscolnick merged commit 006bfdf into marimo-team:main Jun 4, 2025
32 of 33 checks passed
@github-actions
Copy link

github-actions bot commented Jun 4, 2025

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.13.16-dev38

@bjoaquinc bjoaquinc deleted the anthropic-extended-thinking-bug branch June 4, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants