Skip to content

fix: templated did not auto update the model and api key fields#8697

Merged
edwinjosechittilappilly merged 4 commits into
mainfrom
fix-language-model-selection
Jun 24, 2025
Merged

fix: templated did not auto update the model and api key fields#8697
edwinjosechittilappilly merged 4 commits into
mainfrom
fix-language-model-selection

Conversation

@Yukiyukiyeah
Copy link
Copy Markdown
Contributor

@Yukiyukiyeah Yukiyukiyeah commented Jun 24, 2025

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

  • Updated SKIPPED_COMPONENTS in constants.py to include the Agent component, ensuring it is excluded from specific operations. (src/backend/base/langflow/base/constants.py, src/backend/base/langflow/base/constants.pyL46-R46)
  • Adjusted the conditional check in update_projects_components_with_latest_component_versions to use node_type instead of node_data.get("key") for consistency with the updated SKIPPED_COMPONENTS. (src/backend/base/langflow/initial_setup/setup.py, src/backend/base/langflow/initial_setup/setup.pyL70-R70)

Starter Project Template Updates

Summary by CodeRabbit

  • New Features

    • Updated starter projects to support SambaNova and Anthropic Claude models by adding new model options and updating API key labels and descriptions.
  • Refactor

    • Changed the filtering logic for skipping components during project node updates to use node type instead of node key.
  • Style

    • Updated display names and info texts for API key fields to reference SambaNova instead of OpenAI in relevant starter projects.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 24, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The 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

File(s) Change Summary
src/backend/base/langflow/base/constants.py Updated SKIPPED_COMPONENTS to include "Agent" in addition to "LanguageModelComponent".
src/backend/base/langflow/initial_setup/setup.py Changed component skipping logic to check node "type" instead of "key" against SKIPPED_COMPONENTS.
src/backend/base/langflow/initial_setup/starter_projects/Financial Agent.json Updated API key field labels and info from "OpenAI" to "SambaNova"/"Sambanova"; replaced model options.
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json Replaced OpenAI GPT model options with Anthropic Claude models in the "Language Model" component.

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
Loading

Possibly related PRs

Suggested labels

bug, size:S, lgtm

Suggested reviewers

  • edwinjosechittilappilly
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix-language-model-selection

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dosubot dosubot Bot added the bug Something isn't working label Jun 24, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@Yukiyukiyeah Yukiyukiyeah requested review from edwinjosechittilappilly and ogabrielluiz and removed request for ogabrielluiz June 24, 2025 01:04
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 time

The model_name dropdown now exposes only Anthropic Claude models, yet
• the provider still defaults to OpenAI
• the API-key field is still labelled “OpenAI API Key” and pre-filled with OPENAI_API_KEY
• the default model_name value is gpt-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_name options 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_name is "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 switch

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between aeebbd3 and 2dd9aeb.

📒 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_COMPONENTS aligns 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") to node_type properly aligns with the updated SKIPPED_COMPONENTS set 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 models

The model_name list was switched to SambaNova models for Agent-J7aBZ, but Agent-oCAnt (lines 3518-3529, unchanged in this diff) still lists GPT-4 / GPT-3.5 options while its agent_llm is set to "SambaNova".
Please update the second Agent’s model_name options (or reset agent_llm) so both agents remain consistent with the chosen provider; otherwise users will see an invalid model list.

@edwinjosechittilappilly
Copy link
Copy Markdown
Collaborator

This is Nice @Yukiyukiyeah I shall review the PRs soon.

Copy link
Copy Markdown
Collaborator

@edwinjosechittilappilly edwinjosechittilappilly left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 24, 2025
@edwinjosechittilappilly
Copy link
Copy Markdown
Collaborator

Tested!

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 24, 2025
@edwinjosechittilappilly edwinjosechittilappilly added this pull request to the merge queue Jun 24, 2025
Merged via the queue into main with commit a1188e0 Jun 24, 2025
65 checks passed
@edwinjosechittilappilly edwinjosechittilappilly deleted the fix-language-model-selection branch June 24, 2025 07:55
ogabrielluiz pushed a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
…flow-ai#8697)

* update model

* update financial template

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
…flow-ai#8697)

* update model

* update financial template

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants