Skip to content

fix(anthropic): update deprecated default model and fix temperature/topP conflict#442

Open
guoyangzhen wants to merge 6 commits into2FastLabs:mainfrom
guoyangzhen:fix/anthropic-default-model-deprecated
Open

fix(anthropic): update deprecated default model and fix temperature/topP conflict#442
guoyangzhen wants to merge 6 commits into2FastLabs:mainfrom
guoyangzhen:fix/anthropic-default-model-deprecated

Conversation

@guoyangzhen
Copy link
Copy Markdown

Problem

Two issues (#392):

  1. Deprecated default model: claude-3-5-sonnet-20240620 was deprecated on Oct 28, 2025
  2. temperature + topP conflict: Default config passes both temperature and topP, but newer Anthropic models reject requests with both parameters set

Fix

Model update

  • Default → claude-sonnet-4-20250514 (Claude 4 Sonnet)
  • Added ANTHROPIC_MODEL_ID_CLAUDE_SONNET_4 constant (Python + TypeScript)
  • Old CLAUDE_3_5 constant kept for backward compatibility

temperature/topP conflict

  • Removed topP from default config
  • Made top_p conditional in all API calls — only passed when explicitly set by user
  • Users can still set topP: 0.9 via inferenceConfig if their model supports it

Files changed (6)

  • python/.../agents/anthropic_agent.py — default model + conditional topP
  • python/.../classifiers/anthropic_classifier.py — same
  • python/.../types/types.py — new constant
  • typescript/.../agents/anthropicAgent.ts — same (Python fixes mirrored)
  • typescript/.../classifiers/anthropicClassifier.ts — same
  • typescript/.../types/index.ts — new constant

Testing

# Before: fails with deprecated model or temperature+topP error
agent = AnthropicAgent(AnthropicAgentOptions(api_key="..."))

# After: works with Claude 4 Sonnet, temperature only
agent = AnthropicAgent(AnthropicAgentOptions(api_key="..."))

# Users who need topP can still set it:
agent = AnthropicAgent(AnthropicAgentOptions(
    api_key="...",
    inference_config={"topP": 0.9}  # omit temperature
))

Closes #392

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.

Bug: Anthropic default models deprecated and no longer accept both temperature and p val.

1 participant