refactor: Organize model lists to support metadata#8268
Conversation
CodSpeed Performance ReportMerging #8268 will degrade performances by 24.63%Comparing Summary
Benchmarks breakdown
|
|
""" WalkthroughThis update centralizes and standardizes model metadata across several backend modules by introducing detailed dictionaries that map model names or IDs to structured metadata objects. All model lists are now dynamically generated from these dictionaries, eliminating redundancy and improving maintainability. Starter project JSONs are updated to reflect new Anthropic model options and minor formatting changes. Changes
Sequence Diagram(s)sequenceDiagram
participant Code as Backend Code
participant ModelDict as Model Metadata Dictionary
participant Consumer as Model List Consumer
Code->>ModelDict: Define model metadata via create_model_metadata()
Consumer->>ModelDict: Query/filter for model lists (e.g., supported, deprecated)
ModelDict-->>Consumer: Return dynamically generated model lists
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms (17)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1)
840-841: Mirror model options in second node
The secondAnthropicModelnode was updated with the same new options. Ensure both lists are identical and driven by the centralized metadata.Also applies to: 846-846
🧹 Nitpick comments (3)
src/backend/base/langflow/base/models/model_metadata.py (1)
4-15: Consider making required fields explicit in the TypedDict definition.The
ModelMetadataclass usestotal=Falsemaking all fields optional, but the helper function clearly treatsprovider,name, andiconas required fields. This inconsistency could lead to confusion about the actual requirements.Consider using a more explicit approach:
-class ModelMetadata(TypedDict, total=False): +class ModelMetadata(TypedDict): """Simple model metadata structure.""" provider: str # Provider name (e.g., "anthropic", "groq", "openai") name: str # Model name/ID icon: str # Icon name for UI + +class ModelMetadataOptional(TypedDict, total=False): + """Optional model metadata fields.""" tool_calling: bool # Whether model supports tool calling (defaults to False) reasoning: bool # Reasoning models (defaults to False) search: bool # Search models (defaults to False) preview: bool # Whether model is in preview/beta (defaults to False) not_supported: bool # Whether model is not supported or deprecated (defaults to False) deprecated: bool # Whether model is deprecated (defaults to False) + +class CompleteModelMetadata(ModelMetadata, ModelMetadataOptional): + """Complete model metadata with required and optional fields.""" + passThen update the return type of
create_model_metadatato useCompleteModelMetadata.src/backend/base/langflow/base/models/aws_constants.py (1)
4-122: Reduce boilerplate by generating metadata entries dynamically
TheAWS_MODELS_DETAILEDdictionary repeatsprovider="Amazon Bedrock",icon="Amazon", andtool_calling=Truefor every entry. Consider DRYing this up with a small helper and a comprehension. For example:# at top of file _COMMON = dict(provider="Amazon Bedrock", icon="Amazon", tool_calling=True) _CATEGORIES = { # Amazon Titan Models "amazon.titan-text-express-v1", "amazon.titan-text-lite-v1", "amazon.titan-text-premier-v1:0", # Anthropic Models "anthropic.claude-v2", "anthropic.claude-v2:1", # …and so on for each category } AWS_MODELS_DETAILED = { name: create_model_metadata(name=name, **_COMMON) for name in _CATEGORIES }This approach reduces duplication, centralizes common parameters, and makes adding/removing models easier.
src/backend/base/langflow/base/models/groq_constants.py (1)
126-132: Review the complex TOOL_CALLING_UNSUPPORTED_GROQ_MODELS filtering.The filtering logic for tool calling unsupported models is correct but complex. It excludes not_supported and deprecated models while finding models without tool_calling support.
Consider adding a comment to clarify this logic:
TOOL_CALLING_UNSUPPORTED_GROQ_MODELS = [ + # Models that don't support tool calling, excluding deprecated and unsupported models model_name for model_name, metadata in GROQ_MODELS_DETAILED.items() if not metadata.get("tool_calling", False) and not metadata.get("not_supported", False) and not metadata.get("deprecated", False) ]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
src/backend/base/langflow/base/models/anthropic_constants.py(1 hunks)src/backend/base/langflow/base/models/aws_constants.py(1 hunks)src/backend/base/langflow/base/models/google_generative_ai_constants.py(1 hunks)src/backend/base/langflow/base/models/groq_constants.py(1 hunks)src/backend/base/langflow/base/models/model_metadata.py(1 hunks)src/backend/base/langflow/base/models/openai_constants.py(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json(64 hunks)src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json(1 hunks)
🔇 Additional comments (23)
src/backend/base/langflow/base/models/model_metadata.py (1)
18-41: LGTM! Well-designed helper function.The
create_model_metadatafunction provides a clean API with explicit defaults and proper keyword-only arguments for optional parameters. This ensures consistent model metadata creation across the codebase.src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1)
544-550:Details
✅ Verification successful
Verify the validity of the new Claude 4 model identifiers.
The newly added model names
claude-opus-4-20250514andclaude-sonnet-4-20250514contain future dates (May 14, 2025) and reference Claude 4 models that may not be officially available yet.Please verify these model identifiers are valid and available:
Additionally, please search for the latest information about Claude 4 availability:
🏁 Script executed:
#!/bin/bash # Description: Check if the new Claude 4 models are valid by querying Anthropic's API # Expected: Confirmation of model availability or error messages # Check if the models are available in Anthropic's model list curl -H "Authorization: Bearer $ANTHROPIC_API_KEY" \ -H "Content-Type: application/json" \ https://api.anthropic.com/v1/models 2>/dev/null | \ jq '.data[]? | select(.id | contains("claude-opus-4-20250514") or contains("claude-sonnet-4-20250514")) | .id' || \ echo "Models not found or API call failed" # Also search for any Claude 4 models curl -H "Authorization: Bearer $ANTHROPIC_API_KEY" \ -H "Content-Type: application/json" \ https://api.anthropic.com/v1/models 2>/dev/null | \ jq '.data[]? | select(.id | contains("claude") and contains("4")) | .id' || \ echo "No Claude 4 models found"Length of output: 401
🌐 Web query:
What are the latest available Claude 4 models from Anthropic as of 2025? Are claude-opus-4-20250514 and claude-sonnet-4-20250514 officially available?💡 Result:
Based on the latest information available, as of May 29, 2025, Anthropic has officially released two new Claude 4 models: Claude Opus 4 and Claude Sonnet 4. These models were announced on May 21, 2025, at Anthropic's first developer conference called "Code with Claude"[5][7].
Claude 4 Models
Claude Opus 4 is Anthropic's most powerful model to date, described as pushing the frontier in coding, agentic search, and creative writing[2]. Anthropic claims it's the world's best coding model, excelling at sustained performance on complex, long-running tasks and agent workflows[1][3].
Claude Sonnet 4 is designed as an upgrade to Claude Sonnet 3.7, delivering superior coding and reasoning capabilities while responding more precisely to instructions[1]. It's positioned as a midsize model for high-volume use cases, offering a balance of quality, cost-effectiveness, and responsiveness[3].
Model Availability
Yes, both claude-opus-4-20250514 and claude-sonnet-4-20250514 are officially available. These specific model IDs were confirmed in a live blog of the Claude 4 launch event[7].
The models are available through multiple platforms:
- Anthropic's own API
- Amazon Bedrock (released May 22, 2025)
- Google Cloud's Vertex AI[1][3][6]
For Amazon Bedrock specifically, the model IDs are:
- anthropic.claude-opus-4-20250514-v1:0 for Opus 4
- anthropic.claude-sonnet-4-20250514-v1:0 for Sonnet 4[9]
Access and Pricing
Claude Opus 4 is available for Pro, Max, Team, and Enterprise Claude users[2]. Pricing starts at $15 per million input tokens and $75 per million output tokens[1][2].
Claude Sonnet 4 is available to both paying customers and users of the free chatbot applications[8]. It's priced at $3 per million input tokens and $15 per million output tokens[1].
Both models feature a 200K context window for input, with Opus 4 supporting up to 32K output tokens[1][6].
Citations:
- 1: https://www.anthropic.com/news/claude-4
- 2: https://www.anthropic.com/claude/opus
- 3: https://aws.amazon.com/about-aws/whats-new/2025/05/anthropics-claude-4-foundation-models-amazon-bedrock
- 4: https://www.axios.com/2025/05/23/anthropic-ai-deception-risk
- 5: https://www.axios.com/2025/05/22/anthropic-claude-version-4-ai-model
- 6: https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude/opus-4
- 7: https://simonwillison.net/2025/May/22/code-with-claude-live-blog/
- 8: https://techcrunch.com/2025/05/22/anthropics-new-claude-4-ai-models-can-reason-over-many-steps/
- 9: https://aws.amazon.com/blogs/aws/claude-opus-4-anthropics-most-powerful-model-for-coding-is-now-in-amazon-bedrock/
- 10: https://www.zdnet.com/article/anthropic-releases-two-highly-anticipated-ai-models-claude-opus-4-and-claude-sonnet-4/
Verified Claude 4 model identifiers
I’ve confirmed that both claude-opus-4-20250514 and claude-sonnet-4-20250514 are official Claude 4 releases (announced May 21, 2025) and are available via Anthropic’s API, Amazon Bedrock, and Google Cloud Vertex AI. No further changes are required.
src/backend/base/langflow/base/models/google_generative_ai_constants.py (3)
1-2: Import ofcreate_model_metadatais correct
The relative import from.model_metadataaligns with the new metadata-driven approach and the helper is available in the same directory.
4-54: Centralized metadata dictionary is well-structured
TheGOOGLE_GENERATIVE_AI_MODELS_DETAILEDmapping consistently applies theprovider,icon, andtool_callingfields, withpreview=Trueflagged appropriately for preview models. This single source of truth eliminates redundancy and keeps the model list in sync.
56-56: Backwards-compatible model list regenerated from metadata keys
Usinglist(GOOGLE_GENERATIVE_AI_MODELS_DETAILED.keys())preserves insertion order and ensures existing consumers ofGOOGLE_GENERATIVE_AI_MODELSremain functional.src/backend/base/langflow/base/models/aws_constants.py (2)
1-2: Import ofcreate_model_metadataadded correctly
This import enables the construction of rich metadata entries for AWS models and is placed at the top of the file as expected.
124-125: Backwards-compatible AWS model ID list regenerated
AssigningAWS_MODEL_IDs = list(AWS_MODELS_DETAILED.keys())maintains the legacy constant for existing code paths while leveraging the new metadata mapping.src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (6)
12-204: Stylistic: Multi-line array expansions
The variousoutput_typesandinputTypesarrays in the edge definitions were reformatted from single-line to multi-line. These are purely formatting changes to improve readability and match other starter project JSONs.
502-503: Update Anthropic model options
You’ve added the new modelsclaude-opus-4-20250514andclaude-sonnet-4-20250514. Please verify that this list is kept in sync with theANTHROPIC_MODELSarray inlangflow/base/models/anthropic_constants.pyto avoid drift.Also applies to: 508-508
830-830: Increase defaultmax_tokensto 8192
The token cap was raised from 4096 to 8192. Confirm that downstream components can handle the larger default and that performance remains acceptable.
2235-2235: Hidepatterninput by default
For the Parser when inStringifymode,pattern.showis nowfalse. Double-check that yourupdate_build_configlogic correctly toggles this field’s visibility based on the selected mode.
2393-2395: Default Parsermodechanged toStringify
Themodedropdown now defaults toStringifyinstead ofParser. Please ensure this aligns with other starter templates and doesn’t break existing flows expecting the old default.Also applies to: 2404-2404
2486-2489: Formattedtagsas multi-line
Thetagsarray was expanded for readability; its contents ("chatbots","coding") remain unchanged. No functional impact.src/backend/base/langflow/base/models/anthropic_constants.py (3)
50-60: Excellent metadata-driven approach for list generation.The dynamic generation of categorized lists from the metadata dictionary is well-implemented and maintains backward compatibility while eliminating redundancy.
1-1:Details
✅ Verification successful
Verify the model_metadata module dependency.
The import statement references a relative import from
.model_metadata. Ensure this module exists and exports thecreate_model_metadatafunction.
🏁 Script executed:
#!/bin/bash # Description: Verify the model_metadata module exists and contains the required function # Expected: Find the module file and the create_model_metadata function # Check if model_metadata.py exists in the same directory fd -t f "model_metadata.py" src/backend/base/langflow/base/models/ # Search for the create_model_metadata function definition ast-grep --pattern 'def create_model_metadata($$$) { $$$ }'Length of output: 186
🏁 Script executed:
#!/bin/bash # Check for the create_model_metadata function definition using grep and ripgrep grep -R "def create_model_metadata" -n src/backend/base/langflow/base/models/model_metadata.py rg -n "def create_model_metadata" src/backend/base/langflow/base/models/model_metadata.pyLength of output: 248
Import validation –
create_model_metadatais presentVerified that
src/backend/base/langflow/base/models/model_metadata.pydefinescreate_model_metadata(line 18). No changes required.
5-10:Details
✅ Verification successful
Verify the new Claude 4 model names and availability.
The new Claude 4 models (
claude-opus-4-20250514andclaude-sonnet-4-20250514) represent significant additions. Please verify these model names are accurate and officially supported by Anthropic.
🌐 Web query:
What are the latest Claude 4 model names and release dates from Anthropic? Are claude-opus-4-20250514 and claude-sonnet-4-20250514 valid model identifiers?💡 Result:
Claude 4 Model Names and Release Dates
Anthropic's latest generation of AI models, Claude 4, consists of two main variants:
- Claude Opus 4
- Claude Sonnet 4
These models were officially announced and released on May 21–22, 2025[1][3][4][9]. The announcement was made at Anthropic's "Code with Claude" event, with both models immediately becoming available to users on the Anthropic API, Amazon Bedrock, and Google Cloud's Vertex AI[8][9].
Key Details
- Claude Opus 4 is described as Anthropic’s most capable and powerful model, excelling at complex reasoning, advanced coding, and agentic tasks[1][4][8][10].
- Claude Sonnet 4 is positioned for balanced performance—faster and more efficient than Opus 4, yet a clear improvement over previous Sonnet models (like 3.7) in both reasoning and coding capabilities[1][10].
Validity of Model Identifiers
The following model identifiers are explicitly documented as valid for the Claude 4 series:
claude-opus-4-20250514claude-sonnet-4-20250514Anthropic’s official migration guide for their API instructs users to shift to these exact model names when accessing Claude 4 models[7]. The identifier format aligns with their versioning convention (model-family-version-date), confirming they are legitimate and currently supported model names[7].
Summary Table
Model Name Release Date Valid Identifier Description Claude Opus 4 May 21–22, 2025 claude-opus-4-20250514 Most powerful, deep reasoning, advanced coding, complex tasks Claude Sonnet 4 May 21–22, 2025 claude-sonnet-4-20250514 Balanced performance, faster response, improved coding/reasoning Conclusion
- The latest Claude 4 models are Claude Opus 4 and Claude Sonnet 4, both released in May 2025[1][3][9].
- The model identifiers
claude-opus-4-20250514andclaude-sonnet-4-20250514are valid and officially recommended for use with the Anthropic API[7].Citations:
- 1: https://www.anthropic.com/news/claude-4
- 2: https://docs.anthropic.com/en/docs/about-claude/models/overview
- 3: https://blog.promptlayer.com/claude-4/
- 4: https://www.anthropic.com/claude/opus
- 5: https://www.metaculus.com/c/brown-tournament/35975/will-anthropic-release-claude-4/
- 6: https://opentools.ai/news/anthropics-claude-4-prepares-for-takeoff-what-we-know-so-far
- 7: https://docs.anthropic.com/en/docs/about-claude/models/migrating-to-claude-4
- 8: https://www.aboutamazon.com/news/aws/anthropic-claude-4-opus-sonnet-amazon-bedrock
- 9: https://simonwillison.net/2025/May/22/code-with-claude-live-blog/
- 10: https://opencv.org/blog/claude-4/
Confirmed: Claude 4 model identifiers are correct and supported
Both
claude-opus-4-20250514andclaude-sonnet-4-20250514are the official Claude 4 model names released by Anthropic in May 2025, matching their documented versioning scheme and immediately available via the Anthropic API.No changes are needed.
src/backend/base/langflow/base/models/openai_constants.py (3)
3-4: Good documentation and structure.The comment "Unified model metadata - single source of truth" clearly communicates the intent of this refactoring.
66-70: Verify reasoning models filtering logic.The reasoning models list excludes
not_supportedmodels, which is correct. However, ensure the reasoning flag is properly set for o1 models.
58-64:Details
✅ Verification successful
Review the complex filtering logic for OPENAI_MODEL_NAMES.
The filtering logic excludes reasoning, search, and not_supported models. This is more complex than other providers and should be verified for correctness.
🏁 Script executed:
#!/bin/bash # Description: Verify the filtering logic produces expected results # Expected: Check that regular models are correctly identified # Search for usage of OPENAI_MODEL_NAMES in the codebase to understand expected behavior rg -A 3 -B 3 "OPENAI_MODEL_NAMES"Length of output: 67934
🏁 Script executed:
#!/bin/bash # Inspect model categories in openai_constants.py python3 - <<'EOF' import importlib.util import sys # Load the module from its file path spec = importlib.util.spec_from_file_location( "openai_constants", "src/backend/base/langflow/base/models/openai_constants.py" ) mod = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod) # Gather categories regular = mod.OPENAI_MODEL_NAMES reasoning = getattr(mod, "OPENAI_REASONING_MODEL_NAMES", []) search = [m for m, v in mod.OPENAI_MODELS_DETAILED.items() if v.get("search", False)] not_supported = [m for m, v in mod.OPENAI_MODELS_DETAILED.items() if v.get("not_supported", False)] # Print results print("TOTAL DETAILED MODELS:", len(mod.OPENAI_MODELS_DETAILED)) print("REGULAR (no reasoning, no search, supported):", regular) print("REASONING MODELS:", reasoning) print("SEARCH MODELS:", search) print("NOT SUPPORTED MODELS:", not_supported) EOFLength of output: 466
🏁 Script executed:
#!/bin/bash # Load openai_constants via package import to handle relative imports python3 - <<'EOF' import sys # Add project path so 'langflow' package can be imported sys.path.insert(0, "src/backend/base") from langflow.base.models.openai_constants import OPENAI_MODEL_NAMES, OPENAI_REASONING_MODEL_NAMES, OPENAI_MODELS_DETAILED # Build search and not_supported lists search_models = [m for m, v in OPENAI_MODELS_DETAILED.items() if v.get("search", False)] not_supported_models = [m for m, v in OPENAI_MODELS_DETAILED.items() if v.get("not_supported", False)] print("Total detailed models:", len(OPENAI_MODELS_DETAILED)) print("Regular models (OPENAI_MODEL_NAMES):", OPENAI_MODEL_NAMES) print("Reasoning models (OPENAI_REASONING_MODEL_NAMES):", OPENAI_REASONING_MODEL_NAMES) print("Search models:", search_models) print("Not supported models:", not_supported_models) EOFLength of output: 434
🏁 Script executed:
#!/bin/bash # Parse OPENAI_MODELS_DETAILED via AST to categorize models without external imports python3 - <<'EOF' import ast, sys from pprint import pprint file_path = "src/backend/base/langflow/base/models/openai_constants.py" try: source = open(file_path).read() except FileNotFoundError: print(f"{file_path} not found") sys.exit(1) tree = ast.parse(source) detailed_node = None for node in tree.body: if isinstance(node, ast.Assign): for target in node.targets: if isinstance(target, ast.Name) and target.id == "OPENAI_MODELS_DETAILED": detailed_node = node.value break if detailed_node: break if detailed_node is None: print("OPENAI_MODELS_DETAILED assignment not found") sys.exit(1) models = ast.literal_eval(detailed_node) regular, reasoning, search, not_supported = [], [], [], [] for model, meta in models.items(): if meta.get("reasoning", False): reasoning.append(model) elif meta.get("search", False): search.append(model) elif meta.get("not_supported", False): not_supported.append(model) else: regular.append(model) print("Total detailed models:", len(models)) print("Regular models:", sorted(regular)) print("Reasoning models:", sorted(reasoning)) print("Search models:", sorted(search)) print("Not supported models:", sorted(not_supported)) EOFLength of output: 923
🏁 Script executed:
#!/bin/bash # Display create_model_metadata implementation and OPENAI_MODELS_DETAILED definition echo "=== model_metadata.py ===" sed -n '1,200p' src/backend/base/langflow/base/models/model_metadata.py echo echo "=== openai_constants.py ===" sed -n '1,200p' src/backend/base/langflow/base/models/openai_constants.pyLength of output: 5574
Filtering logic for OPENAI_MODEL_NAMES is correct
The list comprehension in openai_constants.py accurately excludes any models flagged withreasoning,search, ornot_supported, leaving only the core “regular” models (including preview ones) inOPENAI_MODEL_NAMES. No changes are needed.src/backend/base/langflow/base/models/groq_constants.py (4)
3-5: Excellent documentation approach.The comment structure clearly explains the purpose of the unified metadata approach.
6-23: Well-organized production models section.The inline comments indicating model providers (Google, Meta) and the consistent metadata structure enhance readability and maintainability.
106-112: Verify the production models filtering logic.The filtering correctly excludes preview, deprecated, and not_supported models. This logic looks sound for identifying stable production models.
134-138: Good backward compatibility approach.The combined list and reverse compatibility alias ensure existing code continues to work while providing the new categorized access patterns.
| "claude-opus-4-20250514", | ||
| "claude-sonnet-4-20250514", |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify and align new model options with backend definitions and default value.
Make sure the newly added keys ("claude-opus-4-20250514" and "claude-sonnet-4-20250514") exist in ANTHROPIC_MODELS/ANTHROPIC_MODELS_DETAILED in anthropic_constants.py and that the deprecated "claude-3-haiku-20240307" is fully removed. Also, the starter project’s default "value" ("claude-3-5-sonnet-20241022") must appear in the "options" list—currently it does not.
To verify definitions and default alignment:
If the default index is -1, update it to one of the allowed options (e.g., "claude-opus-4-20250514"):
--- a/src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json
+++ b/src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json
@@ -1574,7 +1574,7 @@
"type": "str",
- "value": "claude-3-5-sonnet-20241022"
+ "value": "claude-opus-4-20250514"
},🏁 Script executed:
#!/bin/bash
set -e
# Check that the new models are defined and the deprecated one is gone
rg -n 'claude-opus-4-20250514|claude-sonnet-4-20250514|claude-3-haiku-20240307' src/backend/base/langflow/base/models/anthropic_constants.py
# Ensure default value is in the options list (-1 means missing)
jq '.data.nodes[]
| select(.type=="AnthropicModel")
| .data.node.template.model_name as $mn
| ($mn.options | index($mn.value)) // -1' -Mr src/backend/base/langflow/initial_setup/starter_projects/"Custom Component Maker.json"Length of output: 874
🏁 Script executed:
#!/bin/bash
set -e
# Check occurrences of the default model in the JSON
rg -C2 '"claude-3-5-sonnet-20241022"' src/backend/base/langflow/initial_setup/starter_projects/"Custom Component Maker.json"
# Verify if the default value appears in the options array (prints index or -1)
jq '.data.nodes[]
| select(.type=="AnthropicModel")
| .data.node.template.options
| index("claude-3-5-sonnet-20241022") // -1' -Mr src/backend/base/langflow/initial_setup/starter_projects/"Custom Component Maker.json"Length of output: 533
Action Required: Sync Anthropic model definitions and starter‐project defaults
The new keys are correctly defined in anthropic_constants.py, but:
- The deprecated model claude-3-haiku-20240307 still appears in
ANTHROPIC_MODELS[_DETAILED]—remove its entry if you intend full removal. - The starter project’s default value
"claude-3-5-sonnet-20241022"isn’t listed under"options". Either add it to the list or choose one of the new options as the default.
Files to update:
src/backend/base/langflow/base/models/anthropic_constants.pysrc/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json
Example diffs:
--- a/src/backend/base/langflow/base/models/anthropic_constants.py
+++ b/src/backend/base/langflow/base/models/anthropic_constants.py
@@ -36,8 +36,6 @@
"claude-opus-4-20250514": create_model_metadata(
provider="Anthropic", name="claude-opus-4-20250514", icon="Anthropic", tool_calling=True
),
- "claude-3-haiku-20240307": create_model_metadata(
- provider="Anthropic", name="claude-3-haiku-20240307", icon="Anthropic", tool_calling=True, deprecated=True
- ),
"claude-sonnet-4-20250514": create_model_metadata(
provider="Anthropic", name="claude-sonnet-4-20250514", icon="Anthropic", tool_calling=True
),--- a/src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json
+++ b/src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json
@@ -1557,7 +1557,8 @@
"claude-opus-4-20250514",
"claude-sonnet-4-20250514",
+ "claude-3-5-sonnet-20241022"
],
"type": "str",
- "value": "claude-3-5-sonnet-20241022"
+ "value": "claude-3-5-sonnet-20241022"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "claude-opus-4-20250514", | |
| "claude-sonnet-4-20250514", | |
| "claude-opus-4-20250514", | |
| "claude-sonnet-4-20250514", | |
| + "claude-3-5-sonnet-20241022" | |
| ], | |
| "type": "str", | |
| - "value": "claude-3-5-sonnet-20241022" | |
| + "value": "claude-3-5-sonnet-20241022" |
🤖 Prompt for AI Agents
In src/backend/base/langflow/base/models/anthropic_constants.py and
src/backend/base/langflow/initial_setup/starter_projects/Custom Component
Maker.json around lines 1559-1560, remove the deprecated model
"claude-3-haiku-20240307" from ANTHROPIC_MODELS and ANTHROPIC_MODELS_DETAILED in
anthropic_constants.py. Then, in the JSON starter project file, ensure the
default value "claude-3-5-sonnet-20241022" is included in the "options" list or
update the default to one of the new valid options like
"claude-opus-4-20250514". This will align the model definitions and defaults
correctly.
| ANTHROPIC_MODELS = [ | ||
| # all the models below support tool calling also | ||
| "claude-3-7-sonnet-latest", | ||
| "claude-3-5-sonnet-latest", | ||
| "claude-3-5-haiku-latest", | ||
| "claude-3-opus-latest", | ||
| "claude-3-sonnet-20240229", | ||
| "claude-3-haiku-20240307", | ||
| model_name | ||
| for model_name, metadata in ANTHROPIC_MODELS_DETAILED.items() | ||
| if not metadata.get("deprecated", False) and metadata.get("tool_calling", False) | ||
| ] |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Review the ANTHROPIC_MODELS filtering logic.
The filtering logic excludes deprecated models and only includes tool_calling enabled models. This differs from the pattern in other files and may be overly restrictive.
Consider whether this filtering should match the pattern used in other provider files. The current logic:
if not metadata.get("deprecated", False) and metadata.get("tool_calling", False)This excludes models that don't support tool calling, which might not be the intended behavior. Consider:
- if not metadata.get("deprecated", False) and metadata.get("tool_calling", False)
+ if not metadata.get("deprecated", False)Or create a separate list for tool_calling models if both are needed.
🤖 Prompt for AI Agents
In src/backend/base/langflow/base/models/anthropic_constants.py around lines 44
to 48, the current filtering logic for ANTHROPIC_MODELS excludes deprecated
models but only includes those with tool_calling enabled, which is more
restrictive than other provider files. To fix this, adjust the filtering to
exclude only deprecated models without requiring tool_calling to be True,
matching the pattern used elsewhere. If tool_calling-specific filtering is
needed, create a separate list for those models instead of combining both
conditions in ANTHROPIC_MODELS.
| "o3-mini": create_model_metadata( | ||
| provider="OpenAI", name="o3-mini", icon="OpenAI", reasoning=True, not_supported=True | ||
| ), | ||
| "o1-mini": create_model_metadata( | ||
| provider="OpenAI", name="o1-mini", icon="OpenAI", reasoning=True, not_supported=True | ||
| ), | ||
| } |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Review the not_supported reasoning models.
The o3-mini and o1-mini models are marked as both reasoning and not_supported. Verify this is intentional and accurate according to OpenAI's current model availability.
🌐 Web query:
What is the current availability status of OpenAI's o1-mini, o3-mini, and o1 reasoning models? Are o1-mini and o3-mini currently supported in the OpenAI API?
💡 Result:
Current Availability and Support Status of OpenAI o1-mini, o3-mini, and o1 Reasoning Models
o3-mini
- Availability:
o3-mini is the latest small reasoning model from OpenAI and is available in the OpenAI API. It is positioned as a high-intelligence, low-latency alternative to o1-mini and is accessible via the Chat Completions API, Assistants API, and Batch API.[1][9] - Support in API:
o3-mini is confirmed as currently supported in the OpenAI API, with key developer features such as streaming, function calling, and structured outputs.[9] It is also available to ChatGPT Plus, Team, and Pro users, and to API users on usage tiers 3–5 (with limitations for lower usage tiers based on rollout).[1][9]
Additionally, developer messages are supported with o3-mini, unlike o1-mini.[7][9] - Context window and compatibility:
o3-mini supports a 200,000-token context window, making it suitable for larger reasoning tasks.[9] - Deprecation:
o3-mini is intended to replace o1-mini in many contexts, as it offers improved performance at the same cost and latency.[1][4][5]
o1-mini
- Availability:
o1-mini is now deprecated and is being replaced by o3-mini as the cost-effective small reasoning model in the lineup.[3][9] It is no longer listed as a featured or current model in OpenAI’s model documentation, and recent platform docs explicitly label o1-mini as deprecated.[3][9] - Support in API:
o1-mini is not currently supported as a production model in the OpenAI API for new users. Only select customers who had previous access (from limited preview releases) may still have regional access, but general access is closed for new deployments.[2][3][9] - Limitations:
o1-mini does not support developer messages and has fewer features compared to o3-mini.[7][9]
o1 (Main Model, Not Mini)
- Availability:
The primary o1 reasoning model (not the "mini" variant) is still available as a general reasoning model in the OpenAI API and does not require a special access request for global deployments.[2][3] - Support in API:
o1 is supported and can be accessed for reasoning tasks, but it is no longer the latest or most cost-effective option compared to o3 and o4-mini.[2][3][4]
Summary Table
| Model | OpenAI API Status | Feature Support | Notes |
|---|---|---|---|
| o3-mini | Supported | Full dev features, streaming, function calling | Replaces o1-mini; high performance[1][9] |
| o1-mini | Deprecated/Unsupported | Limited, no dev messages | Only legacy/regional exceptions[2][3][7][9] |
| o1 | Supported | Full features | Not as advanced as o3/o4-mini[2][3][4] |
Key Points
- o3-mini is supported and available via OpenAI’s API.
- o1-mini is deprecated and generally not available to new users or for standard deployments.
- o1 (main) reasoning model remains supported, but is not the latest or most cost-effective choice.
If you are developing new applications or updating existing ones, you should use o3-mini for high-performance, cost-effective reasoning tasks in the OpenAI ecosystem.[1][9]
Citations:
- 1: https://openai.com/index/openai-o3-mini/
- 2: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/reasoning
- 3: https://platform.openai.com/docs/models
- 4: https://openai.com/index/introducing-o3-and-o4-mini/
- 5: https://en.wikipedia.org/wiki/OpenAI_o3
- 6: https://community.openai.com/t/o3-mini-availability-as-of-27-march-25/1153356
- 7: https://community.openai.com/t/developer-role-not-accepted-for-o1-o1-mini-o3-mini/1110750
- 8: https://github.blog/changelog/2025-01-31-openai-o3-mini-now-available-in-github-copilot-and-github-models-public-preview/
- 9: https://platform.openai.com/docs/models/o3-mini
- 10: https://community.openai.com/t/cant-access-o1-or-o3-models/1147441
Correct support status for o3-mini
The o3-mini model is currently supported in the OpenAI API and should no longer be marked as not_supported. Please update its metadata accordingly; the o1-mini entry remains deprecated.
• File: src/backend/base/langflow/base/models/openai_constants.py
• Change not_supported=True → not_supported=False for "o3-mini"
Suggested diff:
- "o3-mini": create_model_metadata(
- provider="OpenAI", name="o3-mini", icon="OpenAI", reasoning=True, not_supported=True
- ),
+ "o3-mini": create_model_metadata(
+ provider="OpenAI", name="o3-mini", icon="OpenAI", reasoning=True, not_supported=False
+ ),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "o3-mini": create_model_metadata( | |
| provider="OpenAI", name="o3-mini", icon="OpenAI", reasoning=True, not_supported=True | |
| ), | |
| "o1-mini": create_model_metadata( | |
| provider="OpenAI", name="o1-mini", icon="OpenAI", reasoning=True, not_supported=True | |
| ), | |
| } | |
| "o3-mini": create_model_metadata( | |
| provider="OpenAI", name="o3-mini", icon="OpenAI", reasoning=True, not_supported=False | |
| ), | |
| "o1-mini": create_model_metadata( | |
| provider="OpenAI", name="o1-mini", icon="OpenAI", reasoning=True, not_supported=True | |
| ), | |
| } |
🤖 Prompt for AI Agents
In src/backend/base/langflow/base/models/openai_constants.py around lines 50 to
56, the o3-mini model is incorrectly marked as not_supported=True despite being
currently supported by the OpenAI API. Update the create_model_metadata call for
"o3-mini" to set not_supported=False to reflect its actual support status, while
leaving the o1-mini entry unchanged as deprecated.
|
This Looks good, |
| preview: bool # Whether model is in preview/beta (defaults to False) | ||
| not_supported: bool # Whether model is not supported or deprecated (defaults to False) | ||
| deprecated: bool # Whether model is deprecated (defaults to False) | ||
|
|
There was a problem hiding this comment.
Should we add multimodal capabilities tag
Also, mime_type supported or file type supported?
ogabrielluiz
left a comment
There was a problem hiding this comment.
Can all these be just lists instead of dicts?
* add model metadata * add new anthropic models * templates * [autofix.ci] apply automated fixes * stylel fix * whitespace * move models to a list * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* add model metadata * add new anthropic models * templates * [autofix.ci] apply automated fixes * stylel fix * whitespace * move models to a list * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
creates a model metadata class to use to enhance the model selectors and replaces existing provider model lists accordingly
Additionally adds the new claude 4 models
Summary by CodeRabbit
New Features
Bug Fixes
Refactor