Skip to content

Conversation

@Adam-Aghili
Copy link
Collaborator

@Adam-Aghili Adam-Aghili commented Nov 11, 2025

clean up watsonx urls

Summary by CodeRabbit

Release Notes

  • Refactor
    • Centralized IBM Watsonx API endpoint configuration from multiple component locations into a shared resource for improved maintainability and consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 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 PR consolidates hardcoded IBM Watsonx API endpoint lists across four component and model files by replacing them with a shared constant IBM_WATSONX_URLS imported from lfx.base.models.watsonx_constants, reducing duplication and centralizing URL management.

Changes

Cohort / File(s) Change Summary
IBM Components
src/lfx/src/lfx/components/ibm/watsonx.py, src/lfx/src/lfx/components/ibm/watsonx_embeddings.py
Updated to import and reference IBM_WATSONX_URLS constant instead of hardcoded endpoint lists; WatsonxAIComponent._urls and WatsonxEmbeddingsComponent url dropdown now use the shared constant
Models
src/lfx/src/lfx/components/models/embedding_model.py, src/lfx/src/lfx/components/models/language_model.py
Updated to import and use IBM_WATSONX_URLS instead of hardcoded or locally-defined URL lists; embedding model default URL selection and language model URL options now source from the shared constant

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Repetitive refactoring pattern applied consistently across all affected files
  • No behavioral or logic changes; straightforward constant reference replacement
  • Changes are homogeneous and low-risk—primarily import additions and variable substitutions

Possibly related PRs

Suggested labels

size:S

Suggested reviewers

  • lucaseduoli
  • edwinjosechittilappilly

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Test Quality And Coverage ⚠️ Warning PR lacks test coverage for watsonx URL constant refactoring; no tests validate centralized URL references or catch syntax errors like curly braces. Add unit tests verifying components correctly reference IBM_WATSONX_URLS, validate dropdown options render properly, and confirm default URL selection functions correctly.
Test File Naming And Structure ❓ Inconclusive The PR refactors hardcoded IBM Watsonx URLs into shared constants but no corresponding test files or updates were found in the repository. Verify whether test files are required for this refactoring PR and confirm if existing test coverage adequately covers the modified components.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Test Coverage For New Implementations ✅ Passed Refactoring PR consolidating hardcoded URL lists into shared constants without altering functionality or introducing new behavior.
Excessive Mock Usage Warning ✅ Passed PR refactors watsonx URL constants without modifying test files. No excessive mock usage patterns detected in affected components.
Title check ✅ Passed The title accurately reflects the main objective of the PR: consolidating hard-coded Watsonx URLs across multiple files into a shared constant (IBM_WATSONX_URLS), thereby reducing duplication and improving maintainability.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 15%
14.67% (3963/26999) 7.46% (1535/20568) 9.02% (534/5918)

Unit Test Results

Tests Skipped Failures Errors Time
1602 0 💤 0 ❌ 0 🔥 19.409s ⏱️

@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 31.66%. Comparing base (17e4b83) to head (ad7fa05).

❗ There is a different number of reports uploaded between BASE (17e4b83) and HEAD (ad7fa05). Click for more details.

HEAD has 6 uploads less than BASE
Flag BASE (17e4b83) HEAD (ad7fa05)
frontend 2 1
backend 10 5
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #10562      +/-   ##
==========================================
- Coverage   39.03%   31.66%   -7.37%     
==========================================
  Files        1482     1330     -152     
  Lines       85923    60416   -25507     
  Branches    10348     9030    -1318     
==========================================
- Hits        33539    19132   -14407     
+ Misses      51330    40374   -10956     
+ Partials     1054      910     -144     
Flag Coverage Δ
backend 51.38% <ø> (-5.70%) ⬇️
frontend 13.57% <ø> (-0.71%) ⬇️
lfx 39.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 378 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91d73e7 and bced2a4.

📒 Files selected for processing (4)
  • src/lfx/src/lfx/components/ibm/watsonx.py (2 hunks)
  • src/lfx/src/lfx/components/ibm/watsonx_embeddings.py (2 hunks)
  • src/lfx/src/lfx/components/models/embedding_model.py (1 hunks)
  • src/lfx/src/lfx/components/models/language_model.py (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Use 'MockLanguageModel' for testing language model components without external API calls in backend Python tests.

Applied to files:

  • src/lfx/src/lfx/components/models/language_model.py
📚 Learning: 2025-08-11T16:52:17.902Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 9336
File: src/backend/base/langflow/base/models/openai_constants.py:5-33
Timestamp: 2025-08-11T16:52:17.902Z
Learning: In the Langflow codebase (src/backend/base/langflow/base/models/openai_constants.py), GPT-5 series models (gpt-5, gpt-5-mini, gpt-5-nano, gpt-5-chat-latest) are reasoning models and should have the reasoning=True flag set, which places them in OPENAI_REASONING_MODEL_NAMES rather than OPENAI_CHAT_MODEL_NAMES.

Applied to files:

  • src/lfx/src/lfx/components/models/language_model.py
📚 Learning: 2025-08-11T16:52:26.755Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 9336
File: src/backend/base/langflow/base/models/openai_constants.py:29-33
Timestamp: 2025-08-11T16:52:26.755Z
Learning: The "gpt-5-chat-latest" model in the OpenAI models configuration does not support tool calling, so tool_calling should be set to False for this model in src/backend/base/langflow/base/models/openai_constants.py.

Applied to files:

  • src/lfx/src/lfx/components/models/language_model.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Update Component Index
🔇 Additional comments (5)
src/lfx/src/lfx/components/models/language_model.py (2)

16-16: LGTM! Clean refactoring to centralized URL constant.

The import consolidates URL management by using a shared constant instead of duplicating the URL list across multiple files.


110-111: Correct usage of the imported constant.

The dropdown correctly references the centralized IBM_WATSONX_URLS constant.

src/lfx/src/lfx/components/models/embedding_model.py (1)

8-8: LGTM! Consistent refactoring.

The import and usage of IBM_WATSONX_URLS are consistent with the centralization effort. The fallback to IBM_WATSONX_URLS[0] on line 160 provides a sensible default.

Also applies to: 50-51, 160-160

src/lfx/src/lfx/components/ibm/watsonx.py (1)

9-9: LGTM! Clean refactoring pattern.

Replacing the inline hardcoded list with IBM_WATSONX_URLS centralizes URL management effectively.

Also applies to: 25-25

src/lfx/src/lfx/components/ibm/watsonx_embeddings.py (1)

10-10: IBM_WATSONX_URLS is properly defined and correctly exported.

The constant is defined as a list of six valid Watson x regional endpoint URLs in lfx.base.models.watsonx_constants and is correctly importable from that module. The import statement is accurate.

"https://jp-tok.ml.cloud.ibm.com",
"https://ca-tor.ml.cloud.ibm.com",
],
options={IBM_WATSONX_URLS},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix syntax error: remove curly braces around IBM_WATSONX_URLS.

The options={IBM_WATSONX_URLS} syntax creates a set containing the list object itself, not a list of URL strings. This will cause the dropdown to malfunction. All other files in this PR correctly use options=IBM_WATSONX_URLS without braces.

Apply this diff:

-            options={IBM_WATSONX_URLS},
+            options=IBM_WATSONX_URLS,
📝 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.

Suggested change
options={IBM_WATSONX_URLS},
options=IBM_WATSONX_URLS,
🤖 Prompt for AI Agents
In src/lfx/src/lfx/components/ibm/watsonx_embeddings.py around line 37, the
dropdown options are set using options={IBM_WATSONX_URLS} which incorrectly
creates a set containing the list object; change it to options=IBM_WATSONX_URLS
so the dropdown receives the actual list of URL strings. Make this
single-character removal of the curly braces and ensure no other surrounding
syntax is altered.

@Adam-Aghili Adam-Aghili added the chore Maintenance tasks and housekeeping label Nov 11, 2025
@Adam-Aghili Adam-Aghili force-pushed the aka-watsonx-url-cleanup branch from 14126c2 to 9a5e54d Compare November 13, 2025 19:01
@Adam-Aghili Adam-Aghili changed the title chore: clean up watsonx urls chore: clean up watsonx urls usage Nov 13, 2025
@github-actions github-actions bot added ignore-for-release and removed chore Maintenance tasks and housekeeping ignore-for-release labels Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants