Skip to content

Conversation

@simon-ifx
Copy link

@simon-ifx simon-ifx commented Oct 12, 2025

Added functionality to modify the OpenAI API baseUrl inside the LanguageModelComponent card (similar as in the EmbeddingModelComponent).

Summary by CodeRabbit

  • New Features

    • Added an optional “API Base URL” field to Language Model components across starter projects.
    • When OpenAI is selected, the UI now shows “OpenAI API Base URL” and uses it during model setup if provided.
    • Other providers remain unchanged.
  • Documentation

    • Updated Language Model documentation to include the new api_base parameter with guidance that it is optional and defaults to the standard endpoint when left empty.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 12, 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

Adds a new api_base input to Language Model components and starter projects. For OpenAI provider paths, build logic now passes base_url=api_base (or None) to ChatOpenAI. Documentation updated to include the api_base parameter. Configuration updates set provider-specific display names for the new field.

Changes

Cohort / File(s) Summary
Documentation update
docs/docs/Components/components-models.mdx
Adds api_base parameter to Language Model docs in parameter tables with description and type.
Core component logic
src/lfx/src/lfx/components/models/language_model.py
Introduces api_base input (MessageInput). OpenAI build path now passes base_url from api_base. update_build_config sets "OpenAI API Base URL" display name.
Starter projects: LanguageModelComponent updates
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json, .../Basic Prompting.json, .../Blog Writer.json, .../Custom Component Generator.json, .../Document Q&A.json, .../Financial Report Parser.json, .../Hybrid Search RAG.json, .../Image Sentiment Analysis.json, .../Instagram Copywriter.json, .../Market Research.json, .../Meeting Summary.json, .../Memory Chatbot.json, .../Portfolio Website Code Generator.json, .../Research Agent.json, .../Research Translation Loop.json, .../SEO Keyword Generator.json, .../Text Sentiment Analysis.json, .../Twitter Thread Generator.json, .../Vector Store RAG.json, .../Youtube Analysis.json
Adds api_base input to LanguageModelComponent. OpenAI path in build_model passes base_url=api_base or None to ChatOpenAI. update_build_config labels api_base as "OpenAI API Base URL". Minor UI/config adjustments where present (e.g., input_value additions in some projects).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as Starter Project UI
  participant LMC as LanguageModelComponent
  participant OpenAI as ChatOpenAI (SDK)

  User->>UI: Select provider=OpenAI, set api_key, model_name, api_base?
  UI->>LMC: Build with provider, model_name, api_key, api_base
  Note over LMC: Read inputs incl. optional api_base
  LMC->>OpenAI: new ChatOpenAI(api_key, model_name, base_url=api_base or None)
  OpenAI-->>LMC: Model instance
  LMC-->>UI: Configured model
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

size:L, lgtm

Suggested reviewers

  • edwinjosechittilappilly
  • jordanrfrazier
  • ogabrielluiz

Pre-merge checks and finishing touches

❌ Failed checks (1 error, 2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error I reviewed the diff and it only modifies documentation and multiple starter project JSON files plus the language_model component, with no new or updated backend test_*.py or frontend *.test.ts files. Per the custom check, new functionality like the API Base URL option requires accompanying tests, but none were added or adjusted. Without regression or feature tests covering the new base URL input and its propagation into ChatOpenAI, the PR fails the coverage requirement. Please add tests that exercise the new api_base handling, ensuring the LanguageModelComponent passes the configured base URL through to ChatOpenAI (and any relevant integration flows), following the project’s test naming conventions.
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 No new or updated tests accompany the added API base URL functionality in LanguageModelComponent, so there is no verification that ChatOpenAI receives the new api_base value or that configuration updates behave correctly. Because the PR introduces user-facing behavior without any test coverage to assert the intended outcomes, the test quality and coverage requirements are not met. Add targeted tests that exercise LanguageModelComponent with a custom api_base, verifying both the configuration update output and that the constructed OpenAI client receives the expected base URL. Submit the updated tests for review to satisfy the test coverage requirement.
Test File Naming And Structure ❓ Inconclusive No new or modified test files are included in this pull request, so there are no additions to evaluate against the required naming and structural conventions; existing test suites remain unchanged, leaving the check without actionable evidence. Because the conditions cannot be verified on untouched files, the result is inconclusive. Introduce or modify relevant tests in the pull request so their naming, structure, and coverage can be reviewed, or provide references to the specific test files whose compliance should be assessed.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the addition of a feature to allow modifying the base URL from the LanguageModelComponent card, directly reflecting the main change introduced by the pull request without extraneous detail.
Excessive Mock Usage Warning ✅ Passed The pull request only updates documentation and starter project JSON configurations and does not touch any test files, so no new or modified tests introduce mock objects; therefore there is no evidence of excessive mock usage to flag.

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 github-actions bot added the enhancement New feature or request label Oct 12, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 12, 2025
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

🧹 Nitpick comments (2)
src/lfx/src/lfx/components/models/language_model.py (2)

52-57: Consider using StrInput instead of MessageInput for the URL field.

MessageInput is designed for message/chat data and accepts Message objects, iterators, etc. For a simple URL string, StrInput would be more semantically appropriate and clearer to maintainers.

Apply this diff to use the more appropriate input type:

+from lfx.io import DropdownInput, MessageInput, MultilineInput, SecretStrInput, SliderInput, StrInput
-        MessageInput(
+        StrInput(
             name="api_base",
             display_name="API Base URL",
             info="Base URL for the API. Leave empty for default.",
             advanced=True,
         ),

102-108: Consider hiding api_base for non-OpenAI providers.

The api_base parameter is only used when the provider is OpenAI (line 107), but it's currently visible and configurable for all providers. Users might be confused if they set this value for Anthropic or Google providers where it has no effect.

Update the update_build_config method to conditionally show/hide the field:

def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:
    if field_name == "provider":
        if field_value == "OpenAI":
            build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + OPENAI_REASONING_MODEL_NAMES
            build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0]
            build_config["api_key"]["display_name"] = "OpenAI API Key"
            build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+           build_config["api_base"]["show"] = True
        elif field_value == "Anthropic":
            build_config["model_name"]["options"] = ANTHROPIC_MODELS
            build_config["model_name"]["value"] = ANTHROPIC_MODELS[0]
            build_config["api_key"]["display_name"] = "Anthropic API Key"
+           build_config["api_base"]["show"] = False
        elif field_value == "Google":
            build_config["model_name"]["options"] = GOOGLE_GENERATIVE_AI_MODELS
            build_config["model_name"]["value"] = GOOGLE_GENERATIVE_AI_MODELS[0]
            build_config["api_key"]["display_name"] = "Google API Key"
+           build_config["api_base"]["show"] = False
📜 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 f24a064 and e46804c.

📒 Files selected for processing (2)
  • docs/docs/Components/components-models.mdx (1 hunks)
  • src/lfx/src/lfx/components/models/language_model.py (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

docs/**/*.{md,mdx}: All Markdown/MDX pages must start with front matter including at least title and description; include sidebar_position for docs pages when applicable
Code blocks must specify a language and may include a title (```lang title="…")
Use sentence case for headings and keep paragraphs short and scannable
Write in second person, present tense, with a professional but approachable tone
Use inline code with backticks for code terms; use bold for UI elements and italics for emphasis; keep lists in parallel structure
Ensure internal links are functional and navigation works (update cross-references as needed)
Verify all code examples in docs and blog actually run as shown
Use correct terminology capitalization: Langflow, Component, Flow, API, JSON
Reference images with absolute paths under /img/... and provide descriptive alt text

Files:

  • docs/docs/Components/components-models.mdx
docs/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

Use Docusaurus admonitions (:::+tip|warning|danger) instead of custom callouts in docs pages

Files:

  • docs/docs/Components/components-models.mdx
🧬 Code graph analysis (1)
src/lfx/src/lfx/components/models/language_model.py (1)
src/lfx/src/lfx/inputs/inputs.py (1)
  • MessageInput (185-203)
⏰ 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). (2)
  • GitHub Check: Test Docs Build / Test Docs Build
  • GitHub Check: Update Starter Projects

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 12, 2025
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (12)
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1)

1324-1358: Align the template’s api_base input with the runtime fix.

This embedded component code still declares api_base as a MessageInput, so any flow instantiated from this starter will keep passing a Message object to ChatOpenAI(base_url=…) and fail. Mirror the runtime fix here: import MessageTextInput, use it for api_base, and normalize self.api_base to a plain string before handing it to LangChain.

src/backend/base/langflow/initial_setup/starter_projects/Market Research.json (1)

1232-1266: Update the embedded LanguageModel component to use a string input for api_base.

Like the other starter, this template still wires api_base through a MessageInput, which produces a Message object and will break ChatOpenAI(base_url=…). Switch to MessageTextInput (plus the .text extraction) so flows created from this JSON inherit the corrected behavior.

src/backend/base/langflow/initial_setup/starter_projects/Custom Component Generator.json (1)

2525-2564: Don't touch build_config["api_base"] before defining the field.
update_build_config now writes to build_config["api_base"], but the component template never registers an api_base field. As soon as the provider switches to OpenAI, this raises a KeyError and the UI payload breaks. Add the api_base entry to the template (like the other inputs) before you access it in the config.

               "api_key": {
                   "_input_type": "SecretStrInput",
                   ...
                   "value": "ANTHROPIC_API_KEY"
               },
+              "api_base": {
+                "_input_type": "MessageInput",
+                "advanced": true,
+                "display_name": "API Base URL",
+                "dynamic": false,
+                "info": "Base URL for the API. Leave empty for default.",
+                "input_types": [
+                  "Message"
+                ],
+                "list": false,
+                "load_from_db": false,
+                "name": "api_base",
+                "placeholder": "",
+                "required": false,
+                "show": true,
+                "title_case": false,
+                "tool_mode": false,
+                "trace_as_input": true,
+                "trace_as_metadata": true,
+                "type": "str",
+                "value": ""
+              },
src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json (1)

1889-1930: Define api_base in the template before you mutate it.
update_build_config expects build_config["api_base"], but this template never adds that field. Switching providers triggers a KeyError, so the new base URL option can’t load. Register api_base alongside the other template fields before the config logic runs.

               "api_key": {
                   "_input_type": "SecretStrInput",
                   ...
                   "value": "OPENAI_API_KEY"
               },
+              "api_base": {
+                "_input_type": "MessageInput",
+                "advanced": true,
+                "display_name": "API Base URL",
+                "dynamic": false,
+                "info": "Base URL for the API. Leave empty for default.",
+                "input_types": [
+                  "Message"
+                ],
+                "list": false,
+                "load_from_db": false,
+                "name": "api_base",
+                "placeholder": "",
+                "required": false,
+                "show": true,
+                "title_case": false,
+                "tool_mode": false,
+                "trace_as_input": true,
+                "trace_as_metadata": true,
+                "type": "str",
+                "value": ""
+              },
src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1)

1541-1595: Reset the API base field when switching providers.

Once a user touches the provider dropdown, the code renames the field to “OpenAI API Base URL” but never restores the generic label or hides the field when Anthropic/Google is selected. That leaves a misleading OpenAI-only label visible for providers that don’t use this input. Please reset the label (or hide the field) outside the OpenAI branch.

         if field_name == "provider":
             if field_value == "OpenAI":
                 build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + OPENAI_REASONING_MODEL_NAMES
                 build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0]
                 build_config["api_key"]["display_name"] = "OpenAI API Key"
-                build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+                if "api_base" in build_config:
+                    build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+                    build_config["api_base"]["show"] = True
             elif field_value == "Anthropic":
                 build_config["model_name"]["options"] = ANTHROPIC_MODELS
                 build_config["model_name"]["value"] = ANTHROPIC_MODELS[0]
                 build_config["api_key"]["display_name"] = "Anthropic API Key"
+                if "api_base" in build_config:
+                    build_config["api_base"]["display_name"] = "API Base URL"
+                    build_config["api_base"]["show"] = False
             elif field_value == "Google":
                 build_config["model_name"]["options"] = GOOGLE_GENERATIVE_AI_MODELS
                 build_config["model_name"]["value"] = GOOGLE_GENERATIVE_AI_MODELS[0]
                 build_config["api_key"]["display_name"] = "Google API Key"
+                if "api_base" in build_config:
+                    build_config["api_base"]["display_name"] = "API Base URL"
+                    build_config["api_base"]["show"] = False
src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json (1)

2403-2457: Reset the API base input for non-OpenAI providers.

Same as the other template: after selecting OpenAI the label sticks as “OpenAI API Base URL,” even if the user later switches to Anthropic/Google. Please restore the neutral label or hide the field when OpenAI isn’t active.

         if field_name == "provider":
             if field_value == "OpenAI":
                 build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + OPENAI_REASONING_MODEL_NAMES
                 build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0]
                 build_config["api_key"]["display_name"] = "OpenAI API Key"
-                build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+                if "api_base" in build_config:
+                    build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+                    build_config["api_base"]["show"] = True
             elif field_value == "Anthropic":
                 build_config["model_name"]["options"] = ANTHROPIC_MODELS
                 build_config["model_name"]["value"] = ANTHROPIC_MODELS[0]
                 build_config["api_key"]["display_name"] = "Anthropic API Key"
+                if "api_base" in build_config:
+                    build_config["api_base"]["display_name"] = "API Base URL"
+                    build_config["api_base"]["show"] = False
             elif field_value == "Google":
                 build_config["model_name"]["options"] = GOOGLE_GENERATIVE_AI_MODELS
                 build_config["model_name"]["value"] = GOOGLE_GENERATIVE_AI_MODELS[0]
                 build_config["api_key"]["display_name"] = "Google API Key"
+                if "api_base" in build_config:
+                    build_config["api_base"]["display_name"] = "API Base URL"
+                    build_config["api_base"]["show"] = False
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)

3037-3071: Reset api_base label when provider changes away from OpenAI

update_build_config now renames the api_base field to “OpenAI API Base URL”, but we never switch it back. If a user selects OpenAI (default) and then switches to Anthropic or Google, the UI still shows “OpenAI API Base URL”, even though that setting is unused. Please restore the generic label for non‑OpenAI providers (and mirror the fix in the second LanguageModelComponent block).

         if field_name == "provider":
+            build_config["api_base"]["display_name"] = "API Base URL"
             if field_value == "OpenAI":
                 build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + OPENAI_REASONING_MODEL_NAMES
                 build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0]
                 build_config["api_key"]["display_name"] = "OpenAI API Key"
                 build_config["api_base"]["display_name"] = "OpenAI API Base URL"
             elif field_value == "Anthropic":
                 build_config["model_name"]["options"] = ANTHROPIC_MODELS
                 build_config["model_name"]["value"] = ANTHROPIC_MODELS[0]
                 build_config["api_key"]["display_name"] = "Anthropic API Key"
             elif field_value == "Google":
                 build_config["model_name"]["options"] = GOOGLE_GENERATIVE_AI_MODELS
                 build_config["model_name"]["value"] = GOOGLE_GENERATIVE_AI_MODELS[0]
                 build_config["api_key"]["display_name"] = "Google API Key"
src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json (1)

2633-2688: Reset api_base label when leaving OpenAI

Toggling the provider from OpenAI to Anthropic/Google leaves the api_base field labeled “OpenAI API Base URL”, which is misleading for those providers. Please reset the display name (or hide the field) when the provider changes away from OpenAI.

         if field_name == "provider":
             if field_value == "OpenAI":
                 build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + OPENAI_REASONING_MODEL_NAMES
                 build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0]
                 build_config["api_key"]["display_name"] = "OpenAI API Key"
                 build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+            else:
+                build_config["api_base"]["display_name"] = "API Base URL"
             elif field_value == "Anthropic":
                 build_config["model_name"]["options"] = ANTHROPIC_MODELS
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)

1263-1318: Restore generic label for api_base on non-OpenAI providers

Here too, switching the provider from OpenAI to Anthropic/Google leaves the field labeled “OpenAI API Base URL”. Reset the label (or hide the field) when the provider is not OpenAI.

         if field_name == "provider":
             if field_value == "OpenAI":
                 build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + OPENAI_REASONING_MODEL_NAMES
                 build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0]
                 build_config["api_key"]["display_name"] = "OpenAI API Key"
                 build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+            else:
+                build_config["api_base"]["display_name"] = "API Base URL"
             elif field_value == "Anthropic":
                 build_config["model_name"]["options"] = ANTHROPIC_MODELS
src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (1)

1977-2034: Use a text input for api_base so it’s actually editable

MessageInput renders as a handle-only connector in the UI, meaning the new API Base field can’t be typed in—defeating the whole purpose of this feature. Switch the field to a text input (StrInput or MessageTextInput, as we already do for openai_api_base in Agent) and update the import accordingly.

-from lfx.io import DropdownInput, MessageInput, MultilineInput, SecretStrInput, SliderInput
+from lfx.io import DropdownInput, MessageInput, MultilineInput, SecretStrInput, SliderInput, StrInput-        MessageInput(
+        StrInput(
             name="api_base",
             display_name="API Base URL",
             info="Base URL for the API. Leave empty for default.",
             advanced=True,
         ),
src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json (1)

1254-1286: Reset the API Base label when leaving OpenAI

update_build_config renames the api_base field to “OpenAI API Base URL” but never restores a neutral label when the user switches to Anthropic or Google, so the UI keeps the OpenAI-specific wording. Please add an else branch (or explicit assignments in the non-OpenAI blocks) to reset build_config["api_base"]["display_name"] to a provider-appropriate or generic value.

src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json (1)

1189-1219: Restore a generic API Base label for non-OpenAI providers

Here again, when the provider changes away from OpenAI the api_base field keeps the “OpenAI API Base URL” label. Please mirror the fix by resetting build_config["api_base"]["display_name"] to a neutral or provider-specific string in the Anthropic/Google branches so the UI stays accurate.

🧹 Nitpick comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (1)

1462-1496: Hide api_base when provider isn’t OpenAI.

Great addition. One tweak: when the user switches to Anthropic or Google we still surface the API Base URL even though build_model never consumes it. Hiding/resetting that field for non-OpenAI providers keeps the UI consistent and avoids accidental configuration drift.

         if field_name == "provider":
             if field_value == "OpenAI":
                 build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + OPENAI_REASONING_MODEL_NAMES
                 build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0]
                 build_config["api_key"]["display_name"] = "OpenAI API Key"
                 build_config["api_base"]["display_name"] = "OpenAI API Base URL"
+                build_config["api_base"]["show"] = True
+            else:
+                if "api_base" in build_config:
+                    build_config["api_base"]["show"] = False
+                    build_config["api_base"]["value"] = ""
📜 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 f24a064 and 3f5af3f.

📒 Files selected for processing (22)
  • docs/docs/Components/components-models.mdx (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json (3 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Custom Component Generator.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Financial Report Parser.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Market Research.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/SEO Keyword Generator.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (3 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json (1 hunks)
  • src/lfx/src/lfx/components/models/language_model.py (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

docs/**/*.{md,mdx}: All Markdown/MDX pages must start with front matter including at least title and description; include sidebar_position for docs pages when applicable
Code blocks must specify a language and may include a title (```lang title="…")
Use sentence case for headings and keep paragraphs short and scannable
Write in second person, present tense, with a professional but approachable tone
Use inline code with backticks for code terms; use bold for UI elements and italics for emphasis; keep lists in parallel structure
Ensure internal links are functional and navigation works (update cross-references as needed)
Verify all code examples in docs and blog actually run as shown
Use correct terminology capitalization: Langflow, Component, Flow, API, JSON
Reference images with absolute paths under /img/... and provide descriptive alt text

Files:

  • docs/docs/Components/components-models.mdx
docs/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

Use Docusaurus admonitions (:::+tip|warning|danger) instead of custom callouts in docs pages

Files:

  • docs/docs/Components/components-models.mdx
🧬 Code graph analysis (1)
src/lfx/src/lfx/components/models/language_model.py (1)
src/lfx/src/lfx/inputs/inputs.py (1)
  • MessageInput (185-203)
⏰ 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). (14)
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Test Docs Build / Test Docs Build
  • GitHub Check: Lint Backend / Run Mypy (3.10)
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Test Docker Images / Test docker images
  • GitHub Check: Run Frontend Tests / Determine Test Suites and Shard Distribution
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Test Starter Templates
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: test-starter-projects
🔇 Additional comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1)

927-1002: Add api_base to the field_order for consistent UI placement

We introduced a new api_base input, but the surrounding field_order array still skips it. That array is what keeps the editor layout predictable; leaving the new field out causes it to fall back to implicit ordering, which makes the advanced panel inconsistent across starter projects. Please add "api_base" (right after "api_key" like in Embedding components) so the field shows up where users expect.

[ suggest_recommended_refactor ]

           "field_order": [
             "provider",
             "model_name",
             "api_key",
+            "api_base",
             "input_value",
             "system_message",
             "stream",
             "temperature"
           ],
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json (1)

1216-1379: Keep api_base in the declared field_order

Same as in the other starter project: we added an api_base field but didn’t list it in the component’s field_order. Without it, the UI places the control outside the expected slot, which is confusing when you toggle advanced options across flows. Please insert "api_base" immediately after "api_key".

[ suggest_recommended_refactor ]

           "field_order": [
             "provider",
             "model_name",
             "api_key",
+            "api_base",
             "input_value",
             "system_message",
             "stream",
             "temperature"
           ],

| provider | String | Input parameter. The model provider to use. |
| model_name | String | Input parameter. The name of the model to use. Options depend on the selected provider. |
| api_key | SecretString | Input parameter. The API Key for authentication with the selected provider. |
| api_base | API Base URL | String | Input parameter. Base URL for the API. Leave empty for default. |
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 | 🟠 Major

Fix the api_base table row to use three columns.

The parameters table header defines three columns, but the api_base row now has four cells. This breaks Markdown rendering—only keep a single Type cell (for example String) and move “API Base URL” into the description if needed.

Apply this diff:

-| api_base | API Base URL | String | Input parameter. Base URL for the API. Leave empty for default. |
+| api_base | String | Input parameter. Base URL for the API. Leave empty for default. |
📝 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
| api_base | API Base URL | String | Input parameter. Base URL for the API. Leave empty for default. |
| api_base | String | Input parameter. Base URL for the API. Leave empty for default. |
🤖 Prompt for AI Agents
In docs/docs/Components/components-models.mdx around line 145, the table row for
`api_base` has four cells which breaks the three-column table header; update the
row to use three columns only by keeping the parameter name as the first cell,
the type (e.g., "String") as the second cell, and a combined description as the
third cell (for example: "API Base URL. Input parameter. Base URL for the API.
Leave empty for default.").

Comment on lines +52 to +57
MessageInput(
name="api_base",
display_name="API Base URL",
info="Base URL for the API. Leave empty for default.",
advanced=True,
),
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

Switch api_base to a string input before wiring it into ChatOpenAI.

MessageInput wraps string values into lfx.schema.message.Message instances (see MessageInput._validate_value in lfx/inputs/inputs.py), so self.api_base becomes a Message. When you pass that object to ChatOpenAI(base_url=...), LangChain will raise because it expects a plain URL string. Replace this field with a MessageTextInput (or extract .text explicitly) so base_url always receives the literal URL.

Apply this diff:

-from lfx.io import DropdownInput, MessageInput, MultilineInput, SecretStrInput, SliderInput
+from lfx.io import DropdownInput, MessageInput, MessageTextInput, MultilineInput, SecretStrInput, SliderInput
@@
-        MessageInput(
+        MessageTextInput(
             name="api_base",
             display_name="API Base URL",
             info="Base URL for the API. Leave empty for default.",
             advanced=True,
         ),
@@
-        api_base = self.api_base
+        api_base = getattr(self.api_base, "text", self.api_base)
📝 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
MessageInput(
name="api_base",
display_name="API Base URL",
info="Base URL for the API. Leave empty for default.",
advanced=True,
),
++ b/src/lfx/src/lfx/components/models/language_model.py
@@ -1,5 +1,5 @@
from lfx.io import DropdownInput, MessageInput, MessageTextInput, MultilineInput, SecretStrInput, SliderInput
@@ -52,7 +52,7 @@
MessageTextInput(
name="api_base",
display_name="API Base URL",
info="Base URL for the API. Leave empty for default.",
@@ -105,7 +105,7 @@
api_base = getattr(self.api_base, "text", self.api_base)
🤖 Prompt for AI Agents
In src/lfx/src/lfx/components/models/language_model.py around lines 52 to 57,
the api_base field is defined as MessageInput which wraps values in a Message
object; when that value is later passed into ChatOpenAI(base_url=...) it will
cause a type error. Change the field to a string-style input (use
MessageTextInput) so the stored value is a plain string, or if you prefer to
keep MessageInput, explicitly pass self.api_base.text (the raw string) into
ChatOpenAI.base_url; update the field or the usage so base_url always receives a
literal URL string.

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 12, 2025
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant