fix: templated did not auto update the model and api key fields#8697
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 WalkthroughThe changes update the set of skipped components to include "Agent", modify the filtering logic in the setup script to use node "type" instead of "key", and update starter project JSON files to reflect new model options and provider labels, replacing OpenAI models with SambaNova and Anthropic Claude models. Changes
Sequence Diagram(s)sequenceDiagram
participant SetupScript
participant Node
participant Constants
SetupScript->>Node: Iterate over project nodes
Node->>SetupScript: Provide node "type"
SetupScript->>Constants: Check if node "type" in SKIPPED_COMPONENTS
alt Node type is skipped
SetupScript-->>Node: Skip updating template
else Node type not skipped
SetupScript-->>Node: Update template
end
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. 🪧 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
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1)
1521-1537: Mismatch between provider, API-key label, and model list breaks the template at load timeThe
model_namedropdown now exposes only Anthropic Claude models, yet
• theproviderstill defaults to OpenAI
• the API-key field is still labelled “OpenAI API Key” and pre-filled withOPENAI_API_KEY
• the defaultmodel_namevalue isgpt-4o-mini, which no longer exists in the options array.This combination makes the form invalid when the UI hydrates and prevents the component from building a model without manual user intervention.
Patch the static template so it is internally consistent:
@@ - "display_name": "OpenAI API Key", + "display_name": "Anthropic API Key", @@ - "value": "OPENAI_API_KEY" + "value": "ANTHROPIC_API_KEY" @@ - "value": "gpt-4o-mini" + "value": "claude-3-sonnet-20240229" @@ - "value": "OpenAI" + "value": "Anthropic"Optionally, clean up the
model_nameoptions list so the first entry matches the default.Also applies to: 1581-1608, 1610-1644
♻️ Duplicate comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json (1)
3273-3289: Same capitalization issue as earlier – applies to this Agent too.
🧹 Nitpick comments (3)
src/backend/base/langflow/initial_setup/setup.py (1)
73-76: Consider refactoring redundant component filtering logic.The logic here still checks for "Agent" and "LanguageModelComponent" by key, which is now redundant since these components are already filtered out by type on line 70. Consider simplifying this conditional or removing the redundant checks.
- is_tool_or_agent = node_data.get("tool_mode", False) or node_data.get("key") in { - "Agent", - "LanguageModelComponent", - } + is_tool_or_agent = node_data.get("tool_mode", False)src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json (1)
2488-2504: Use consistent capitalization for “SambaNova” across all components
display_nameis"SambaNova API Key"here, but other nodes still use"Sambanova API Key".
Pick one spelling (preferably “SambaNova”, matching the provider’s branding) and apply it everywhere to avoid UI confusion and duplicate secrets.src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1)
1008-1013: Update template note to reflect provider switchThe introductory note still instructs the user to “add your OpenAI API key” and mentions “OpenAI model component”.
Replace these references with “Anthropic API key / Anthropic model component” to avoid confusion.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/backend/base/langflow/base/constants.py(1 hunks)src/backend/base/langflow/initial_setup/setup.py(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json(3 hunks)src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (3)
src/backend/base/langflow/base/constants.py (1)
46-46: LGTM! Clean addition of Agent component to skipped list.The addition of "Agent" to
SKIPPED_COMPONENTSaligns well with the PR objectives and maintains consistency with the existing pattern of skipping components that have dynamic values needing persistence in templates.src/backend/base/langflow/initial_setup/setup.py (1)
70-70: LGTM! Improved consistency by using node type for filtering.The change from checking
node_data.get("key")tonode_typeproperly aligns with the updatedSKIPPED_COMPONENTSset and provides a more consistent approach to component filtering.src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json (1)
2733-2746: Model-name options updated for only one Agent – other Agent still shows GPT modelsThe
model_namelist was switched to SambaNova models forAgent-J7aBZ, butAgent-oCAnt(lines 3518-3529, unchanged in this diff) still lists GPT-4 / GPT-3.5 options while itsagent_llmis set to"SambaNova".
Please update the second Agent’smodel_nameoptions (or resetagent_llm) so both agents remain consistent with the chosen provider; otherwise users will see an invalid model list.
|
This is Nice @Yukiyukiyeah I shall review the PRs soon. |
|
Tested! |
…flow-ai#8697) * update model * update financial template --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
…flow-ai#8697) * update model * update financial template --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
This pull request introduces updates to skipped components, refines logic in the project setup code, and updates starter project templates to support new model options and API key configurations.
Updates to Skipped Components
SKIPPED_COMPONENTSinconstants.pyto include theAgentcomponent, ensuring it is excluded from specific operations. (src/backend/base/langflow/base/constants.py, src/backend/base/langflow/base/constants.pyL46-R46)update_projects_components_with_latest_component_versionsto usenode_typeinstead ofnode_data.get("key")for consistency with the updatedSKIPPED_COMPONENTS. (src/backend/base/langflow/initial_setup/setup.py, src/backend/base/langflow/initial_setup/setup.pyL70-R70)Starter Project Template Updates
Financial Agent.jsontemplate to reflect a shift in API usage. (src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json, [1] [2]Financial Agent.jsonto include new models such asMeta-LlamaandQwen2, replacing older GPT models. (src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json, src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.jsonL2733-R2746)Research Translation Loop.jsonto includeclaudemodels, replacing older GPT models. (src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json, src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.jsonL1590-R1596)Summary by CodeRabbit
New Features
Refactor
Style