feat(anthropic): add model metadata for Claude Opus 4.1#9347
feat(anthropic): add model metadata for Claude Opus 4.1#9347jordanrfrazier merged 2 commits intolangflow-ai:mainfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdded a new Anthropic tool-calling model entry (claude-opus-4-1-20250805) to ANTHROPIC_MODELS_DETAILED in anthropic_constants.py. This inclusion updates the derived model lists that reference ANTHROPIC_MODELS_DETAILED; no other logic or error handling was modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/backend/base/langflow/base/models/anthropic_constants.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{src/backend/**/*.py,tests/**/*.py,Makefile}
📄 CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc)
{src/backend/**/*.py,tests/**/*.py,Makefile}: Run make format_backend to format Python code before linting or committing changes
Run make lint to perform linting checks on backend Python code
Files:
src/backend/base/langflow/base/models/anthropic_constants.py
🧬 Code Graph Analysis (1)
src/backend/base/langflow/base/models/anthropic_constants.py (1)
src/backend/base/langflow/base/models/model_metadata.py (1)
create_model_metadata(18-41)
🔇 Additional comments (1)
src/backend/base/langflow/base/models/anthropic_constants.py (1)
5-5: Claude Opus 4.1 metadata addition looks consistentProvider/name/icon/flag follow existing conventions for tool-calling Anthropic models.
| @@ -2,6 +2,7 @@ | |||
|
|
|||
| ANTHROPIC_MODELS_DETAILED = [ | |||
| # Tool calling supported models | |||
| create_model_metadata(provider="Anthropic", name="claude-opus-4-1-20250805", icon="Anthropic", tool_calling=True), | |||
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify provider model ID and be mindful of ordering side-effects
- Double-check the official Anthropic model ID string; ensure "claude-opus-4-1-20250805" is correct.
- Placing this at the top changes the order in ANTHROPIC_MODELS and TOOL_CALLING_SUPPORTED_ANTHROPIC_MODELS; if any UI defaults select the first entry, confirm this won’t inadvertently change defaults.
- Optional: keep the “Tool calling supported models” section sorted by family and recency for readability.
Run this script from repo root to check for duplicates and confirm the new entry’s flags and ordering impact.
Also, please run:
- make format_backend
- make lint
To confirm the official model ID via public docs:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE='src/backend/base/langflow/base/models/anthropic_constants.py'
python - <<'PY'
import re, json, collections
path='src/backend/base/langflow/base/models/anthropic_constants.py'
txt=open(path, 'r', encoding='utf-8').read()
entries=[]
for m in re.finditer(r'create_model_metadata\((.*?)\)', txt, re.S):
args=m.group(1)
def flag(name):
m2=re.search(rf'\b{name}\s*=\s*(True|False)', args)
return m2.group(1)=="True" if m2 else False
def strval(name):
m2=re.search(rf'\b{name}\s*=\s*"([^"]+)"', args)
return m2.group(1) if m2 else None
entries.append({
"provider": strval("provider"),
"name": strval("name"),
"tool_calling": flag("tool_calling"),
"deprecated": flag("deprecated"),
})
names=[e["name"] for e in entries if e["name"]]
dupes=[n for n,c in collections.Counter(names).items() if c>1]
print("Total entries:", len(entries))
print("Duplicates:", dupes)
target="claude-opus-4-1-20250805"
target_entry=next((e for e in entries if e["name"]==target), None)
print("Target entry:", json.dumps(target_entry, indent=2, sort_keys=True))
tool_supported=[e['name'] for e in entries if e.get('tool_calling', False)]
non_depr_supported=[e['name'] for e in entries if e.get('tool_calling', False) and not e.get('deprecated', False)]
print("Tool-calling supported total:", len(tool_supported))
print("Non-deprecated supported total (ANTHROPIC_MODELS):", len(non_depr_supported))
print("First 5 non-deprecated tool-calling names (order-sensitive):", non_depr_supported[:5])
PYLength of output: 546
🌐 Web query:
What is the official model ID string for Anthropic "Claude Opus 4.1" (tool-use capable) released around 2025-08-05? Is it "claude-opus-4-1-20250805"?
💡 Result:
Yes — Anthropic’s official API model ID for Claude Opus 4.1 is "claude-opus-4-1-20250805". The alias "claude-opus-4-1" points to that snapshot. (docs.anthropic.com)
Citations:
Confirm UI Default Selection After Adding New Anthropic Model
- Model ID “claude-opus-4-1-20250805” is correct per Anthropic’s official docs.
- In src/backend/base/langflow/base/models/anthropic_constants.py, this entry now appears first in both the tool-calling supported list (12 entries) and the non-deprecated list (8 entries). If the UI falls back to selecting the first model by default, this will change the default from the previous model.
- Recommended actions:
• Explicitly set the default Anthropic model in the UI logic instead of relying on list order, or
• Reorder/sort theTOOL_CALLING_SUPPORTED_ANTHROPIC_MODELSandANTHROPIC_MODELSarrays by family and release date so recency is clear and defaults remain predictable.
🤖 Prompt for AI Agents
In src/backend/base/langflow/base/models/anthropic_constants.py around line 5,
the new model entry "claude-opus-4-1-20250805" has been placed first in both
TOOL_CALLING_SUPPORTED_ANTHROPIC_MODELS and ANTHROPIC_MODELS which can
unintentionally change the UI default if the frontend selects the first item;
fix this by either (A) making the UI select an explicit default Anthropic model
by key/name rather than relying on array order (update the frontend default
selection logic to read a configured default model id), or (B) reorder/sort the
TOOL_CALLING_SUPPORTED_ANTHROPIC_MODELS and ANTHROPIC_MODELS arrays by model
family and release date (or add a stable “is_default” flag to the model metadata
and ensure the arrays are sorted to put that default first) so the apparent
default remains predictable.
|
4cd6d29 to
1fdc070
Compare
|



Summary by CodeRabbit