feat: Add IBM watsonx.ai and Ollama to LanguageModelComponent#10471
Conversation
Extended LanguageModelComponent to support IBM watsonx.ai as a provider, including dynamic model fetching, new input fields for API endpoint and project ID, and integration with ChatWatsonx. Updated starter project JSONs to reflect these changes and enable selection of IBM watsonx.ai models.
Extended the LanguageModelComponent to support Ollama as a provider, including dynamic model fetching from the Ollama API and related UI input fields. Updated build_model and update_build_config logic to handle Ollama-specific configuration and improved provider switching logic for all supported providers.
|
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 WalkthroughExtends LanguageModelComponent across multiple starter projects and core codebase to support IBM watsonx.ai and Ollama as new LLM providers. Adds dynamic model discovery helpers, new provider-specific configuration inputs (base_url, project_id, ollama_base_url), and expands build and update logic to handle provider-specific validation, instantiation, and UI visibility toggling. Changes
Sequence DiagramsequenceDiagram
actor User
participant UI as Build Config UI
participant Component as LanguageModelComponent
participant IBM as IBM watsonx.ai API
participant Ollama as Ollama API
participant LLM as LLM Client
User->>UI: Select Provider
UI->>Component: update_build_config(provider=X)
alt Provider = "IBM watsonx.ai"
Component->>Component: Show base_url, project_id fields
Component->>IBM: fetch_ibm_models(base_url)
IBM-->>Component: Model list / Error
Component->>UI: Update model_name options
else Provider = "Ollama"
Component->>Component: Show ollama_base_url field
Component->>Ollama: fetch_ollama_models(ollama_base_url)
Ollama-->>Component: Model list / Empty list
Component->>UI: Update model_name options
else Provider = "OpenAI" / "Anthropic" / "Google"
Component->>Component: Show/hide respective API key field
Component->>UI: Update field visibility
end
User->>Component: build_model()
alt Provider = "IBM watsonx.ai"
Component->>Component: Validate api_key, base_url, project_id
Component->>LLM: ChatWatsonx(apikey, url, project_id, model_id)
else Provider = "Ollama"
Component->>Component: Validate ollama_base_url, model_name
Component->>Component: Normalize base_url (strip /v1 if present)
Component->>LLM: ChatOllama(base_url, model, temperature)
else Other providers
Component->>LLM: Instantiate provider-specific client
end
LLM-->>Component: Model instance
Component-->>User: Ready for inference
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 error, 4 warnings)
✅ Passed checks (2 passed)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (39.37%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #10471 +/- ##
==========================================
+ Coverage 31.39% 31.41% +0.01%
==========================================
Files 1325 1325
Lines 59987 59987
Branches 8980 8980
==========================================
+ Hits 18834 18844 +10
+ Misses 40246 40237 -9
+ Partials 907 906 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for IBM watsonx.ai and Ollama as model providers to the LanguageModelComponent, expanding the platform's LLM integration capabilities beyond OpenAI, Anthropic, and Google. The changes implement dynamic model fetching from provider APIs and introduce provider-specific configuration fields.
Key Changes:
- Added ChatWatsonx and ChatOllama integrations with respective provider-specific input fields
- Implemented API-based model discovery for IBM watsonx.ai and Ollama providers
- Enhanced input configuration logic to conditionally show/hide fields based on selected provider
Reviewed Changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/lfx/src/lfx/components/models/language_model.py | Core implementation adding IBM watsonx.ai and Ollama providers with model fetching logic |
| src/backend/base/langflow/initial_setup/starter_projects/*.json | Updated embedded LanguageModelComponent code in 14 starter project files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 14
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (27)
src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json (3)
1200-1377: Template/UI mismatch: new providers not exposed.The template still lists only OpenAI/Anthropic/Google and lacks base_url, project_id, and ollama_base_url fields. Users won’t see IBM/Ollama options in the starter without regenerating the node template. Please re-export/regenerate this starter so template.provider.options includes “IBM watsonx.ai” and “Ollama” and the new inputs are present. Based on learnings.
1200-1408: The verification reveals a critical issue:langchain-ibmis properly declared insrc/backend/base/pyproject.toml(line 91), butlangchain-ollamais not shown in the pyproject.toml output, despite being present in lock files and imported by the starter project JSON files. This confirms the reviewer's concern about potential runtime ImportError.Add
langchain-ollamatosrc/backend/base/pyproject.tomldependencies.The embedded Python code in the starter project JSON files (e.g., lines 1200-1408 in Image Sentiment Analysis.json) imports
from langchain_ollama import ChatOllama, but this dependency is missing from the project's declared dependencies. Ensure both are explicitly declared:
langchain-ibm>=0.3.8,<1.0.0(already present)langchain-ollama==0.3.10(or similar pinned version based on lock file)
1235-1408: Add Bearer token authentication and update API version to 2024-03-14.The
/ml/v1/foundation_model_specsendpoint requires authentication (Authorization: Bearer ...). The code makes an unauthenticated request that will fail on most IBM watsonx.ai tenants. Additionally, the current active API version to use is 2024-03-14, not 2024-09-16.Update
fetch_ibm_models()to:
- Accept an optional auth token parameter (or read from environment/config)
- Pass the Authorization header in the request
- Update
params = {"version": "2024-03-14", ...}- Handle 401/403 responses distinctly (auth failure) before catching all exceptions
src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json (2)
1493-1771: Template/UI mismatch: expose IBM/Ollama and new inputs.The template for these nodes still shows only OpenAI/Anthropic/Google. Regenerate the starter so provider options and fields (watsonx base_url/project_id, ollama_base_url) are present.
1264-1471: Update IBM watsonx API version parameter to a documented version.IBM's official documentation shows
/ml/v1/foundation_model_specswith versions 2024-12-10 and 2024-05-01, but the code uses version2024-09-16, which is not documented in IBM's official API reference. Update to a supported version to avoid potential runtime failures.The ChatOpenAI constructor kwarg is verified as correct—
model_nameis the proper parameter withmodelas an alias in langchain-openai 0.3.x.src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json (1)
2035-2070: Starter template ‘provider’ options don’t include IBM/OllamaThe template still lists only OpenAI/Anthropic/Google, while the component code supports IBM watsonx.ai and Ollama. Sync to avoid a confusing UI.
- "options": [ - "OpenAI", - "Anthropic", - "Google" - ], + "options": [ + "OpenAI", + "Anthropic", + "Google", + "IBM watsonx.ai", + "Ollama" + ], - "options_metadata": [ + "options_metadata": [ { "icon": "OpenAI" }, { "icon": "Anthropic" }, - { "icon": "Google" } + { "icon": "GoogleGenerativeAI" }, + { "icon": "WatsonxAI" }, + { "icon": "Ollama" } ],src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
1434-1468: Template provider options missing IBM/OllamaAlign with component capabilities.
- "options": [ - "OpenAI", - "Anthropic", - "Google" - ], + "options": [ + "OpenAI", + "Anthropic", + "Google", + "IBM watsonx.ai", + "Ollama" + ], - "options_metadata": [ + "options_metadata": [ { "icon": "OpenAI" }, { "icon": "Anthropic" }, - { "icon": "GoogleGenerativeAI" } + { "icon": "GoogleGenerativeAI" }, + { "icon": "WatsonxAI" }, + { "icon": "Ollama" } ],src/backend/base/langflow/initial_setup/starter_projects/SEO Keyword Generator.json (1)
1043-1069: Provider options in template should include IBM/OllamaExpose new providers in starter template.
- "options": [ - "OpenAI", - "Anthropic", - "Google" - ], + "options": [ + "OpenAI", + "Anthropic", + "Google", + "IBM watsonx.ai", + "Ollama" + ], - "options_metadata": [ + "options_metadata": [ { "icon": "OpenAI" }, { "icon": "Anthropic" }, - { "icon": "GoogleGenerativeAI" } + { "icon": "GoogleGenerativeAI" }, + { "icon": "WatsonxAI" }, + { "icon": "Ollama" } ],src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (5)
3320-3360: ChatOpenAI: wrong parameter names cause runtime failure (usemodelandapi_key).
ChatOpenAIexpectsmodel=andapi_key=, notmodel_name=andopenai_api_key=. This will raise a validation error at build time. Also avoid passingtemperature=None; omit the arg instead. (api.python.langchain.com)Apply this diff inside the code string:
- return ChatOpenAI( - model_name=model_name, - temperature=temperature, - streaming=stream, - openai_api_key=self.api_key, - ) + openai_kwargs = { + "model": model_name, + "streaming": stream, + "api_key": self.api_key, + } + if temperature is not None: + openai_kwargs["temperature"] = temperature + return ChatOpenAI(**openai_kwargs)
3310-3345: Starter template UI doesn’t list the new providers. Updateprovider.options.The saved template still shows only ["OpenAI","Anthropic","Google"], so IBM/Ollama won’t appear in this starter. Update options and icons.
"options": [ - "OpenAI", - "Anthropic", - "Google" + "OpenAI", + "Anthropic", + "Google", + "IBM watsonx.ai", + "Ollama" ], "options_metadata": [ { "icon": "OpenAI" }, { "icon": "Anthropic" }, - { "icon": "GoogleGenerativeAI" } + { "icon": "GoogleGenerativeAI" }, + { "icon": "WatsonxAI" }, + { "icon": "Ollama" } ],
3126-3134: Expose provider-specific fields in the starter template (field_order).Without adding these, the new inputs won’t be visible/ordered in the UI.
"field_order": [ "provider", "model_name", "api_key", + "base_url", + "project_id", + "ollama_base_url", "input_value", "system_message", "stream", "temperature" ],
3209-3418: Add template entries for new inputs (base_url,project_id,ollama_base_url).The code defines these inputs, but the template lacks their definitions; add minimal stubs with show:false so the UI can render/serialize them.
"api_key": { "_input_type": "SecretStrInput", "advanced": false, "display_name": "OpenAI API Key", "dynamic": false, "info": "Model Provider API key", "input_types": [], "load_from_db": true, "name": "api_key", "password": true, "placeholder": "", "real_time_refresh": true, "required": false, "show": true, "title_case": false, "type": "str", "value": "OPENAI_API_KEY" }, + "base_url": { + "_input_type": "DropdownInput", + "advanced": false, + "display_name": "watsonx API Endpoint", + "dynamic": false, + "info": "The base URL of the API (IBM watsonx.ai only)", + "name": "base_url", + "options": [ + "https://us-south.ml.cloud.ibm.com", + "https://eu-de.ml.cloud.ibm.com", + "https://eu-gb.ml.cloud.ibm.com", + "https://au-syd.ml.cloud.ibm.com", + "https://jp-tok.ml.cloud.ibm.com", + "https://ca-tor.ml.cloud.ibm.com" + ], + "placeholder": "", + "real_time_refresh": true, + "required": false, + "show": false, + "title_case": false, + "type": "str", + "value": "https://us-south.ml.cloud.ibm.com" + }, + "project_id": { + "_input_type": "StrInput", + "advanced": false, + "display_name": "watsonx Project ID", + "dynamic": false, + "info": "The project ID associated with the foundation model (IBM watsonx.ai only)", + "name": "project_id", + "placeholder": "", + "required": false, + "show": false, + "title_case": false, + "type": "str", + "value": "" + }, + "ollama_base_url": { + "_input_type": "MessageTextInput", + "advanced": false, + "display_name": "Ollama API URL", + "dynamic": false, + "info": "Endpoint of the Ollama API (Ollama only). Defaults to http://localhost:11434", + "name": "ollama_base_url", + "placeholder": "", + "real_time_refresh": true, + "required": false, + "show": false, + "title_case": false, + "type": "str", + "value": "http://localhost:11434" + },
3380-3418: Extend system_message visibility to o3/o4 reasoning models.The current code (line 169) only hides system_message for
o1*models, but leaves it in undefined state foro3*ando4*families. Since OpenAI o3 and o4-mini support system messages, the code should explicitly show system_message for these models.Current behavior at lines 165–176 of
src/lfx/src/lfx/components/openai/openai_chat_model.py:
- Reasoning models (line 165): Hide temperature/seed; conditionally hide system_message only for o1*
- Chat models (line 171): Show temperature/seed/system_message
- Gap: o3/o4 reasoning models never reach the show=True block, leaving system_message visibility undefined
Fix: After line 170, explicitly show system_message for o3/o4 models:
if field_value.startswith("o1") and "system_message" in build_config: build_config["system_message"]["show"] = False elif "system_message" in build_config: # o3/o4 models support system_message build_config["system_message"]["show"] = Truesrc/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (1)
1987-2196: Add missingollama_base_urltemplate field definition.The verification found that
base_url(line 2734) andproject_id(line 3097) are properly defined in the template section. However,ollama_base_urlis referenced throughout the code but lacks a corresponding template field definition. The code attempts to manipulatebuild_config["ollama_base_url"]in theupdate_build_configmethod and set its visibility, but the template definition is missing. This will cause a KeyError at runtime.Add the
ollama_base_urlfield definition to the template section betweenproject_idandinput_value:"ollama_base_url": { "_input_type": "MessageTextInput", "advanced": false, "display_name": "Ollama API URL", "dynamic": false, "info": "Endpoint of the Ollama API (Ollama only). Defaults to http://localhost:11434", "input_types": ["Message"], "list": false, "list_add_label": "Add More", "load_from_db": false, "multiline": false, "name": "ollama_base_url", "placeholder": "", "required": false, "show": false, "title_case": false, "tool_mode": false, "trace_as_input": true, "trace_as_metadata": true, "type": "str", "value": "http://localhost:11434" }src/backend/base/langflow/initial_setup/starter_projects/Custom Component Generator.json (7)
2667-2674: Verify requests library dependency.The code uses
requests.get()in bothfetch_ibm_models()andfetch_ollama_models()static methods, butrequestsis not listed in the component's declared dependencies (lines 2524-2543).Ensure
requestsis added to the project dependencies if not already present.
2651-2670: Validate error handling and API fallback logic in model fetching methods.The
fetch_ibm_models()method catches all exceptions broadly (except Exception) and silently falls back toIBM_WATSONX_DEFAULT_MODELS, which masks potential configuration errors (invalid endpoint, authentication failures, etc.). This could lead to users unaware that their custom base_url is not working. Similarly,fetch_ollama_models()returns an empty list on failure.Consider distinguishing between transient errors (network timeout) and configuration errors (invalid URL, auth failure) to provide more targeted feedback:
@staticmethod def fetch_ibm_models(base_url: str) -> list[str]: """Fetch available models from the watsonx.ai API.""" try: endpoint = f"{base_url}/ml/v1/foundation_model_specs" params = {"version": "2024-09-16", "filters": "function_text_chat,!lifecycle_withdrawn"} response = requests.get(endpoint, params=params, timeout=10) response.raise_for_status() data = response.json() models = [model["model_id"] for model in data.get("resources", [])] return sorted(models) except requests.exceptions.HTTPError as e: logger.error(f"HTTP error fetching IBM models: {e.response.status_code} - {e}") return IBM_WATSONX_DEFAULT_MODELS except requests.exceptions.Timeout: logger.warning("Timeout fetching IBM models. Using default models.") return IBM_WATSONX_DEFAULT_MODELS except Exception as e: # noqa: BLE001 logger.exception(f"Unexpected error fetching IBM models: {e}") return IBM_WATSONX_DEFAULT_MODELS
2674-2690: Implement proper URL validation before API calls.The
fetch_ollama_models()method applies URL normalization (transform_localhost_url,removesuffix, etc.) but doesn't validate thatbase_urlis a non-empty, properly formatted URL before making requests. An invalid or malformed URL could cause unexpected behavior or resource leaks.Add URL validation before the API call:
@staticmethod def fetch_ollama_models(base_url: str) -> list[str]: """Fetch available models from the Ollama API.""" try: if not base_url or not isinstance(base_url, str): logger.warning("Invalid Ollama base_url provided") return [] # Strip /v1 suffix if present, as Ollama API endpoints are at root level base_url = base_url.rstrip("/").removesuffix("/v1") if not base_url.endswith("/"): base_url = base_url + "/" base_url = transform_localhost_url(base_url) # Validate transformed URL is not empty if not base_url: logger.warning("Ollama base_url transformation resulted in empty URL") return [] tags_url = urljoin(base_url, "api/tags") response = requests.get(tags_url, timeout=10) response.raise_for_status() data = response.json() models = [model["name"] for model in data.get("models", [])] return sorted(models) except Exception: # noqa: BLE001 logger.exception("Error fetching Ollama models. Returning empty list.") return []
2704-2766: Verify field validation in build_model() method.The method validates required fields for each provider (e.g.,
if not self.api_key: raise ValueError), but there's a subtle issue: theapi_keyfield is markedrequired=Falsein the inputs (line 2609), which allows users to skip setting it and encounter the validation error at build time rather than at input time.Two approaches to fix:
- Set
required=Truefor provider-specific API keys (preferred for better UX)- Add more descriptive validation messages and early warnings
Additionally, for IBM watsonx.ai, the
project_idfield should also be markedrequired=Truewhen the provider is IBM watsonx.ai.Consider adding provider-dependent required field toggling in
update_build_config():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["api_key"]["required"] = True build_config["api_key"]["display_name"] = "OpenAI API Key" # ... rest of config elif field_value == "IBM watsonx.ai": build_config["api_key"]["required"] = True build_config["base_url"]["required"] = True build_config["project_id"]["required"] = True # ... rest of config elif field_value == "Ollama": build_config["api_key"]["required"] = False build_config["ollama_base_url"]["required"] = True # ... rest of config
2800-2828: Evaluate Ollama URL transformation logic for edge cases.The Ollama URL handling strips
/v1suffix and normalizes localhost URLs, but the logic has potential edge cases:
- What if
transformed_base_urlisNoneor empty aftertransform_localhost_url()?- The warning about
/v1suffix is logged but the behavior is transparent to the user in the UI—they may not see why their input was modified.Add null/empty check and consider surfacing the transformation to the user:
if provider == "Ollama": if not self.ollama_base_url: msg = "Ollama API URL is required when using Ollama provider" raise ValueError(msg) if not model_name: msg = "Model name is required when using Ollama provider" raise ValueError(msg) transformed_base_url = transform_localhost_url(self.ollama_base_url) # Validate transformation succeeded if not transformed_base_url: msg = f"Failed to transform Ollama URL: {self.ollama_base_url}" raise ValueError(msg) # Check if URL contains /v1 suffix (OpenAI-compatible mode) if transformed_base_url.rstrip("/").endswith("/v1"): # Strip /v1 suffix and log warning transformed_base_url = transformed_base_url.rstrip("/").removesuffix("/v1") logger.warning( "Detected '/v1' suffix in Ollama base URL. The Ollama component uses the native Ollama API, " "not the OpenAI-compatible API. The '/v1' suffix has been automatically removed. " "If you want to use the OpenAI-compatible API, please use the OpenAI component instead. " "Learn more at https://docs.ollama.com/openai#openai-compatibility" ) return ChatOllama( base_url=transformed_base_url, model=model_name, temperature=temperature, )
2682-2717: Verify provider options in template match code.The template's
providerdropdown (lines 2682-2706) shows options["OpenAI", "Anthropic", "Google"]but the code supports 5 providers including"IBM watsonx.ai"and"Ollama". The template is out of sync with the implementation.Update the template's
providerfield to include all five providers:"provider": { "_input_type": "DropdownInput", "advanced": false, "combobox": false, "dialog_inputs": {}, "display_name": "Model Provider", "dynamic": false, "info": "Select the model provider", "name": "provider", "options": [ "OpenAI", "Anthropic", "Google", "IBM watsonx.ai", "Ollama" ], "options_metadata": [ {"icon": "OpenAI"}, {"icon": "Anthropic"}, {"icon": "GoogleGenerativeAI"}, {"icon": "WatsonxAI"}, {"icon": "Ollama"} ], "placeholder": "", "real_time_refresh": true, "required": false, "show": true, "title_case": false, "toggle": false, "tool_mode": false, "trace_as_metadata": true, "type": "str", "value": "Anthropic" }
2594-2610: Add missing input field configurations to the template section for the three new provider-specific fields.The template JSON at lines 2592–2800 is indeed missing serialized configurations for
base_url,project_id, andollama_base_url. While these fields are defined in the embedded component code, they have no corresponding template entries with_input_type,display_name, options, and metadata. The template ends at line 2789 with only eight fields (api_key, code, input_value, model_name, provider, stream, system_message, temperature).Add JSON configurations for:
base_url: DropdownInput with IBM_WATSONX_URLS optionsproject_id: StrInputollama_base_url: MessageTextInputThese should be inserted into the template object before the closing
"tool_mode": falseline, following the same structure as existing fields (e.g.,api_key).src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json (1)
2514-2688: I'll verify the exact constructor signatures by searching for more detailed documentation on these specific library versions.Based on the official LangChain documentation, I can now provide the definitive verification:
ChatOpenAI (langchain_openai): Official examples show
model=andapi_key=as the correct parameters, notmodel_nameandopenai_api_key.ChatAnthropic (langchain_anthropic): The parameter is
anthropic_api_keywith an aliasapi_key, meaning both work butapi_keyis the aliased form. Official examples show usingmodelandapi_key=.
Fix ChatOpenAI and ChatAnthropic constructor arguments.
The current code uses incorrect parameter names that will cause runtime failures:
- ChatOpenAI: Change
model_name=tomodel=andopenai_api_key=toapi_key=- ChatAnthropic: Change
anthropic_api_key=toapi_key=(for consistency with ChatOpenAI and modern LangChain patterns)return ChatOpenAI( - model_name=model_name, + model=model_name, temperature=temperature, streaming=stream, - openai_api_key=self.api_key, + api_key=self.api_key, ) if provider == "Anthropic": if not self.api_key: msg = "Anthropic API key is required when using Anthropic provider" raise ValueError(msg) return ChatAnthropic( model=model_name, temperature=temperature, streaming=stream, - anthropic_api_key=self.api_key, + api_key=self.api_key, )src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1)
1471-1505: UI provider options not updated — IBM/Ollama missing. Users can’t select new providers.The serialized template still lists only OpenAI/Anthropic/Google. Update options and icons to expose the new backends.
- "options": [ - "OpenAI", - "Anthropic", - "Google" - ], - "options_metadata": [ - { "icon": "OpenAI" }, - { "icon": "Anthropic" }, - { "icon": "GoogleGenerativeAI" } - ], + "options": [ + "OpenAI", + "Anthropic", + "Google", + "IBM watsonx.ai", + "Ollama" + ], + "options_metadata": [ + { "icon": "OpenAI" }, + { "icon": "Anthropic" }, + { "icon": "GoogleGenerativeAI" }, + { "icon": "WatsonxAI" }, + { "icon": "Ollama" } + ],src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json (1)
2862-2896: UI provider options not updated for the new providers.Both LanguageModelComponent templates here still list only three providers. Add IBM watsonx.ai and Ollama (and icons) so the UI exposes the new paths.
- "options": [ - "OpenAI", - "Anthropic", - "Google" - ], - "options_metadata": [ - { "icon": "OpenAI" }, - { "icon": "Anthropic" }, - { "icon": "GoogleGenerativeAI" } - ], + "options": [ + "OpenAI", + "Anthropic", + "Google", + "IBM watsonx.ai", + "Ollama" + ], + "options_metadata": [ + { "icon": "OpenAI" }, + { "icon": "Anthropic" }, + { "icon": "GoogleGenerativeAI" }, + { "icon": "WatsonxAI" }, + { "icon": "Ollama" } + ],Also applies to: 3183-3218
src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (3)
1511-1531: Ollama model fetching returns empty list on error; inconsistent with IBM fallback.The
fetch_ollama_models()method returns an empty list when model fetching fails, whereasfetch_ibm_models()returns default models. This inconsistency could lead to confusion: IBM providers always have selectable defaults, but Ollama users may be left with no options if the endpoint is unreachable.Additionally, a KeyError may occur if a model object lacks a "name" key.
Apply this diff to improve robustness and consistency:
models = [model["name"] for model in data.get("models", [])] return sorted(models) except Exception: logger.exception("Error fetching Ollama models. Returning empty list.") - return [] + logger.warning("Ollama endpoint not available. Please ensure Ollama is running.") + return []And add defensive key access:
- models = [model["name"] for model in data.get("models", [])] + models = [model.get("name", "") for model in data.get("models", []) if model.get("name")]This prevents KeyErrors and provides user guidance.
Also applies to: 1639-1659, 1966-1986
1580-1610: Missing validation for IBM watsonx base_url format and potential null reference in Ollama.Two validation gaps identified:
- IBM watsonx base_url: The code checks if
base_urlexists but doesn't validate it's a well-formed URL. A malformed URL could be passed to ChatWatsonx.- Ollama base_url transformation: Line ~1599 calls
transform_localhost_url(self.ollama_base_url)but doesn't handle a potential None return value before using it at line ~1602.Add null checks and URL validation:
if provider == "IBM watsonx.ai": if not self.api_key: msg = "IBM API key is required..." raise ValueError(msg) if not self.base_url: msg = "IBM watsonx API Endpoint is required..." raise ValueError(msg) + # Optional: Add URL format validation here if not self.project_id: msg = "IBM watsonx Project ID is required..." raise ValueError(msg)if provider == "Ollama": if not self.ollama_base_url: msg = "Ollama API URL is required..." raise ValueError(msg) if not model_name: msg = "Model name is required..." raise ValueError(msg) transformed_base_url = transform_localhost_url(self.ollama_base_url) + if not transformed_base_url: + msg = "Failed to transform Ollama base URL" + raise ValueError(msg)Also applies to: 1708-1738, 2035-2065
1623-1675: Potential issues in update_build_config() when provider switches to Ollama and endpoint is unavailable.When the provider is switched to "Ollama", the code immediately calls
fetch_ollama_models(ollama_url). If Ollama is not running or the URL is incorrect, the method returns an empty list. The UI will then show no available models, potentially frustrating users.Additionally, there's no validation that
build_config["ollama_base_url"].get("value")returns a non-empty string before calling fetch.Improve Ollama initialization with better defaults and user guidance:
elif field_value == "Ollama": # Fetch Ollama models from the API ollama_url = build_config["ollama_base_url"].get("value", "http://localhost:11434") + if not ollama_url or not ollama_url.strip(): + ollama_url = "http://localhost:11434" models = self.fetch_ollama_models(base_url=ollama_url) + if not models: + logger.warning( + f"No models found at {ollama_url}. Ensure Ollama is running and check the API URL. " + "You can still enter a model name manually if needed." + ) build_config["model_name"]["options"] = models build_config["model_name"]["value"] = models[0] if models else ""Additionally, allow users to override the model_name even if no models are detected:
build_config["model_name"]["value"] = models[0] if models else "" + build_config["model_name"]["required"] = not bool(models)This ensures the component doesn't break if no models are initially available.
Also applies to: 1751-1803, 2078-2130
♻️ Duplicate comments (4)
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json (4)
964-1139: Same constructor kw concerns for ChatOpenAI/Anthropic as noted in YouTube Analysis.Please apply the same fix here (model/api_key). See prior comment for diff.
990-1029: Enable combobox on model_name to allow manual entry (esp. for Ollama).Match the adjustment suggested in the YouTube Analysis file.
1031-1065: Template provider options exclude IBM/Ollama; sync with code.Same issue as in the YouTube Analysis file. Please update or confirm runtime regeneration.
964-1139: Minor UX polish for Ollama empty model list.Apply the same graceful-handling suggestion as above.
🧹 Nitpick comments (35)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
3076-3076: API timeout configuration uses hardcoded 10-second timeout.Both
fetch_ibm_models()andfetch_ollama_models()use a 10-second timeout for HTTP requests (e.g., line in code:response = requests.get(endpoint, params=params, timeout=10)). This may be insufficient for slow networks or distant API endpoints, and offers no configurability.Consider making the timeout configurable through environment variables or component settings, with a documented default. This would improve resilience in diverse deployment scenarios:
FETCH_MODELS_TIMEOUT = int(os.getenv("LANGFLOW_FETCH_MODELS_TIMEOUT", "10")) response = requests.get(endpoint, params=params, timeout=FETCH_MODELS_TIMEOUT)Also applies to: 3403-3403
src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json (3)
1235-1408: Add streaming to ChatOllama and harden Ollama URL parsing.
- ChatOllama ignores the user’s Stream toggle. Pass streaming=stream.
- Sanitize ollama_base_url: enforce http(s) scheme and reject obvious non-routable/private targets before requests.get.
Apply this patch inside the code block:
@@ - return ChatOllama( - base_url=transformed_base_url, - model=model_name, - temperature=temperature, - ) + return ChatOllama( + base_url=transformed_base_url, + model=model_name, + temperature=temperature, + streaming=stream, + ) @@ - def fetch_ollama_models(base_url: str) -> list[str]: + def fetch_ollama_models(base_url: str) -> list[str]: """Fetch available models from the Ollama API.""" try: + from urllib.parse import urlparse + parsed = urlparse(base_url) + if parsed.scheme not in ("http", "https"): + raise ValueError("Ollama base URL must be http(s)") # Strip /v1 suffix if present, as Ollama API endpoints are at root level base_url = base_url.rstrip("/").removesuffix("/v1") if not base_url.endswith("/"): base_url = base_url + "/" base_url = transform_localhost_url(base_url)
761-769: Update prerequisites text.Note still mentions only OpenAI. Add IBM/Ollama guidance or make it provider-agnostic so the starter doesn’t mislead users.
1559-1731: Duplicate logic across two LanguageModelComponent nodes.Both nodes embed identical code. That’s expected in starters, but increases maintenance drift. If feasible in the export pipeline, prefer a single shared component or ensure automated regeneration keeps them in sync.
src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json (2)
1299-1471: Propagate ChatOllama streaming and URL guards.Mirror the same fixes as suggested in the other file: pass streaming=stream to ChatOllama and validate/sanitize ollama_base_url (http(s) scheme). See patch in prior comment.
1820-1844: Docs block mentions only OpenAI.Consider updating the Note’s prerequisites to include other providers or make neutral.
src/lfx/src/lfx/components/models/language_model.py (2)
283-292: Consider fallback when Ollama model fetch fails.When fetching Ollama models fails or returns an empty list (line 286),
model_name["value"]is set to an empty string (line 288). This could be confusing for users, as they'll see an empty model dropdown with no indication of what went wrong.Consider one of these approaches:
- Set a placeholder message like "No models found - check Ollama connection"
- Fall back to common Ollama model names (e.g., ["llama2", "mistral", "codellama"])
- Keep the current behavior but ensure the UI shows a helpful message
293-293: Optional: Fix minor line length violations.Lines 293 and 303 slightly exceed the maximum line length (121-122 characters vs 120 maximum). While not blocking, consider breaking these for consistency with project style.
Example for line 293:
- elif field_name == "base_url" and field_value and hasattr(self, "provider") and self.provider == "IBM watsonx.ai": + elif ( + field_name == "base_url" + and field_value + and hasattr(self, "provider") + and self.provider == "IBM watsonx.ai" + ):Also applies to: 303-303
src/backend/base/langflow/initial_setup/starter_projects/SEO Keyword Generator.json (1)
968-969: Optional improvements for URL validation and response caching in model fetchersIn
src/lfx/src/lfx/components/models/language_model.py(lines 45 and 60), consider adding:
- URL scheme validation before making requests (e.g., validate that
base_urlstarts withhttp://orhttps://)—this provides clearer error messages if invalid URLs are passed- Simple memoization per URL to cache results within a component lifecycle, since
fetch_ibm_models()andfetch_ollama_models()may be called repeatedly during UI edits when users adjust the base URL fieldThese changes would improve error handling clarity and avoid redundant API calls during rapid UI interactions, though the current implementation with try-catch blocks is functionally adequate.
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)
1367-1368: Add scheme validation and optional caching for dynamic URL fetchersThe
fetch_ibm_models()andfetch_ollama_models()methods accept user-suppliedbase_urlparameters without validating the URL scheme or host. While exceptions are safely caught, basic scheme validation (e.g.,http://orhttps://only) is a standard SSRF mitigation. Additionally, caching fetch results bybase_urlinupdate_build_config()would avoid repeated API calls.Example improvements:
- Validate URL scheme before making requests
- Add a simple cache (dict keyed by base_url) to avoid redundant API calls within the same config session
This pattern appears across multiple starter project files.
src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (2)
3396-3418: Fetch IBM models immediately on provider switch (not only on base_url change).Currently IBM model options update only after
base_urlchanges. Fetch on provider selection to populate the dropdown right away.elif field_value == "IBM watsonx.ai": - build_config["model_name"]["options"] = IBM_WATSONX_DEFAULT_MODELS - build_config["model_name"]["value"] = IBM_WATSONX_DEFAULT_MODELS[0] + try: + ibm_url = build_config["base_url"].get("value", IBM_WATSONX_URLS[0]) + models = self.fetch_ibm_models(base_url=ibm_url) + except Exception: # noqa: BLE001 + logger.exception("Error fetching IBM models on provider change. Falling back to defaults.") + models = IBM_WATSONX_DEFAULT_MODELS + build_config["model_name"]["options"] = models + build_config["model_name"]["value"] = models[0] if models else IBM_WATSONX_DEFAULT_MODELS[0] build_config["api_key"]["display_name"] = "IBM API Key" build_config["api_key"]["show"] = True build_config["base_url"]["show"] = True build_config["project_id"]["show"] = True build_config["ollama_base_url"]["show"] = False
3142-3161: Add missing runtime dependencies to metadata for reproducibility.Include
langchain_ibmandlangchain_ollamasince the component imports them. This helps automated installers and CI."dependencies": { "dependencies": [ { "name": "langchain_anthropic", "version": "0.3.14" }, { "name": "langchain_google_genai", "version": "2.0.6" }, - { "name": "langchain_openai", "version": "0.3.23" }, + { "name": "langchain_openai", "version": "0.3.23" }, + { "name": "langchain_ibm", "version": null }, + { "name": "langchain_ollama", "version": null }, { "name": "lfx", "version": null } ], - "total_dependencies": 4 + "total_dependencies": 6 },src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (2)
2023-2023: Exception handling pattern uses overly broad catch-all.While the code has appropriate fallback behavior, using bare
except Exceptioncatches network errors, malformed responses, and timeouts uniformly. Consider distinguishing timeout exceptions to provide more granular error messages to users, or at minimum log the exception type for debugging.Example improvement:
except requests.Timeout: logger.warning(f"Timeout fetching {provider} models from {base_url}") return defaults except requests.RequestException as e: logger.exception(f"Failed to fetch {provider} models: {e}") return defaultsThis is a lower-priority refinement since fallback behavior is sound.
2023-2023: Dynamic model fetching may show empty list if Ollama API unavailable on initial load.When a user first selects the "Ollama" provider, the code attempts to fetch models from the default
http://localhost:11434without first confirming the endpoint is reachable. If Ollama isn't running locally, the model dropdown will be empty, which could confuse users. Consider:
- Showing a placeholder message like "Connect to Ollama and enter the API URL" when no models are fetched
- Or deferring the fetch until the user explicitly enters a base_url
This is a UX polish opportunity rather than a critical bug, since users can still manually enter a URL and the models will update.
src/backend/base/langflow/initial_setup/starter_projects/Custom Component Generator.json (2)
2717-2743: Verify IBM watsonx.ai model caching and refresh behavior.In
update_build_config(), whenproviderchanges to "IBM watsonx.ai", the component usesIBM_WATSONX_DEFAULT_MODELSand doesn't fetch from the API untilbase_urlchanges. This means if a user switches to IBM watsonx.ai without changing the base_url field, they get default models. Later, when the user changesbase_url, the fetch happens. This could be confusing.Consider fetching IBM models eagerly when the provider is set to IBM watsonx.ai:
elif field_value == "IBM watsonx.ai": build_config["model_name"]["options"] = IBM_WATSONX_DEFAULT_MODELS build_config["model_name"]["value"] = IBM_WATSONX_DEFAULT_MODELS[0] build_config["api_key"]["display_name"] = "IBM API Key" build_config["api_key"]["show"] = True build_config["base_url"]["show"] = True build_config["project_id"]["show"] = True build_config["ollama_base_url"]["show"] = False # Eagerly fetch models if base_url has a value if "base_url" in build_config and build_config["base_url"].get("value"): try: models = self.fetch_ibm_models(build_config["base_url"]["value"]) if models: build_config["model_name"]["options"] = models build_config["model_name"]["value"] = models[0] except Exception: # noqa: BLE001 logger.warning("Failed to fetch IBM models on provider change")
2769-2803: Verify SecretStr usage and API key safe handling.For IBM watsonx.ai, the code converts the API key to a secret using
SecretStr(self.api_key).get_secret_value(). However,self.api_keycomes from aSecretStrInputand should already be a secure string. The conversion may be redundant or could introduce issues if the input is already handled securely by the framework.Verify with the framework's documentation whether
SecretStrconversion is necessary. Ifself.api_keyis already secure, simplify to:return ChatWatsonx( apikey=self.api_key, # Already secure from SecretStrInput url=self.base_url, # ... rest )Otherwise, document why the extra conversion is needed.
src/backend/base/langflow/initial_setup/starter_projects/Market Research.json (1)
1313-1314: Harden model fetching with lightweight resiliency.Add small retry/backoff and shorter timeouts to reduce UI stalls when endpoints are unreachable.
- response = requests.get(endpoint, params=params, timeout=10) + response = requests.get(endpoint, params=params, timeout=5) ... - response = requests.get(tags_url, timeout=10) + response = requests.get(tags_url, timeout=5)Optionally wrap with urllib3 Retry or a simple 2-attempt retry on RequestException.
Do you want me to add a tiny retry helper used by both fetch_* methods?
src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (2)
1502-1502: Consider adding observability to model fetch failures and implement resilience best practices.The
fetch_ibm_models()andfetch_ollama_models()methods include fallback logic on error, but they silently catch all exceptions and log only warnings. Users may not realize that model discovery failed and are viewing stale or default options. Additionally, the 10-second timeout is hardcoded with no room for adjustment on slow networks or overloaded services.Consider:
- Adding structured logging that distinguishes between network timeouts, authentication failures, and other errors so users can debug connectivity issues.
- Implementing exponential backoff retry logic for transient failures rather than immediately falling back.
- Surfacing a warning in the UI if model discovery fails (e.g., display a note like "Using cached/default models" when the API is unreachable).
- Making the timeout configurable or context-aware (e.g., longer for IBM API calls, shorter for local Ollama).
Also applies to: 1829-1829
1502-1502: Blocking API calls during UI field updates could degrade user experience for unreachable endpoints.In the
update_build_config()method, when the user selects the "Ollama" provider, the code immediately callsself.fetch_ollama_models(base_url=ollama_url)(line ~1653 in the code). If the Ollama endpoint is unreachable or slow, this synchronous API call will block the UI update and create a sluggish interaction.Consider:
- Making model fetches asynchronous or deferring them until the user explicitly clicks a "refresh" button or opens the model dropdown.
- Caching model lists so repeated provider switches don't re-fetch.
- Setting a tighter timeout (e.g., 3–5 seconds) for these update-time fetches so the UI doesn't hang for too long.
- Showing a loading indicator or spinner while models are being fetched.
Also applies to: 1829-1829
src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json (4)
2540-2579: Allow manual model entry when dynamic fetch fails (enable combobox).Ollama model discovery can return an empty list; with combobox=false, users can’t type a model name. Enable combobox for model_name to preserve usability.
Patch:
- "combobox": false, + "combobox": true,
2580-2615: Provider options in the static template omit IBM/Ollama.Template provider.options still shows ["OpenAI","Anthropic","Google"], while code supports IBM watsonx.ai and Ollama. Users may not see the new providers until regenerated. Sync the template to include the new options or ensure it’s rebuilt from code on import.
Patch:
- "options": [ - "OpenAI", - "Anthropic", - "Google" - ], + "options": [ + "OpenAI", + "Anthropic", + "Google", + "IBM watsonx.ai", + "Ollama" + ],If the runtime always derives inputs from the code block, please confirm and we can skip this change.
2514-2688: IBM model fetch is unauthenticated; consider optional auth for reliability.fetch_ibm_models calls foundation_model_specs without auth and falls back to defaults. Some regions/orgs require IAM; consider: if api_key present, obtain IAM token and pass Authorization to improve success rate.
Outline:
- POST to https://iam.cloud.ibm.com/identity/token with grant_type=urn:ibm:params:oauth:grant-type:apikey and apikey.
- Use Bearer token on GET foundation_model_specs.
- Keep current fallback on failure.
2514-2688: Ollama: handle empty model list more gracefully.When models=[], model_name is set to "", leading to immediate build-time error. Consider leaving current value unchanged or setting a helpful placeholder with instructions.
Example:
- build_config["model_name"]["value"] = models[0] if models else "" + build_config["model_name"]["value"] = models[0] if models else build_config["model_name"].get("value", "") + if not models: + logger.warning("No Ollama models found at %s. Ensure the server is running and models are pulled.", ollama_url)src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json (2)
2795-2796: Harden dynamic model fetch (Ollama) against SSRF.Same guardrails as suggested in the other file; apply in both code blocks.
(Reuse the fetch_ollama_models diff from the other comment.)
Also applies to: 3117-3118
2795-2796: IBM model discovery: accept api_key and use IAM token (optional but recommended).Same refactor as suggested for the other file; apply in both code blocks.
(Reuse the fetch_ibm_models + call‑site diff from the other comment.)
Also applies to: 3117-3118
src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (2)
1466-1466: Code duplication across three LanguageModelComponent instances.All three node instances (LanguageModelComponent-qFXT1, LanguageModelComponent-Wp3pC, LanguageModelComponent-gYAmH) contain identical Python code embedded in their template. While this is expected for a starter project (where multiple instances of the same component type coexist), ensure that any future updates to the component definition are propagated to all instances uniformly.
Consider centralizing the component definition outside the starter project JSON to reduce duplication and maintenance burden.
Also applies to: 1794-1794, 2121-2121
1488-1510: IBM watsonx API version is hardcoded; consider making it configurable.The
fetch_ibm_models()method uses a hardcoded API version ("2024-09-16"). While this ensures stability, it may become outdated and prevent access to newer models. The filter string ("function_text_chat,!lifecycle_withdrawn") is also fixed.Consider adding optional configuration parameters (environment variables or component settings) to control the API version and filters, allowing users to adapt to API changes without modifying the component code.
Also applies to: 1616-1638, 1943-1965
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json (8)
1271-1271: Extract common code segment to avoid duplication across three LanguageModelComponent nodes.The same Python code is duplicated across three separate LanguageModelComponent node instances. While this is typical for JSON flow files, any future maintenance or bug fixes will need to be applied in three places. Consider whether the starter project setup supports a shared code template or component inheritance.
Also applies to: 1593-1593, 1914-1914
1296-1310: Hardcoded IBM watsonx API version may become stale.The
fetch_ibm_models()method uses a hardcoded API version"2024-09-16"in the request parameters. IBM may release newer API versions, and this constant should be reviewed periodically or made configurable if this code is intended for long-term use.
1295-1310: Broad exception handling may mask specific API errors.Both
fetch_ibm_models()andfetch_ollama_models()catch all exceptions withexcept Exception: # noqa: BLE001. While fallbacks are provided, this masks specific errors (timeout, network, auth, invalid response format) that might need different handling. Consider catching specific exception types (e.g.,requests.RequestException,requests.Timeout) and logging more context.
1335-1385: Update build_config may fail silently on missing keys.In
update_build_config(), lines likebuild_config[\"model_name\"][\"options\"] = ...assume the keys exist. Ifbuild_configis missing expected structure, this will raise aKeyError. Add defensive checks or validation to ensure required config keys are present before modification.
1375-1385: Model selection may be empty for Ollama with no running instance.In the Ollama provider branch of
update_build_config(), iffetch_ollama_models()returns an empty list (e.g., Ollama is not running or unreachable), the model dropdown will be empty (models[0] if models else ""). This may confuse users. Consider setting a default placeholder or informative message.
1400-1410: o1 model detection uses prefix match that could over-match future models.The condition
field_value.startswith("o1")will match "o1", "o1-2025", "o1-preview", etc. If OpenAI releases models that start with "o1" but do support system messages, this logic will incorrectly hide the field. Consider using an explicit allowlist or exact version matching.
1345-1360: Potential AttributeError if field_name matches but provider attribute missing.In
update_build_config(), lines likeif field_name == "base_url" and field_value and hasattr(self, "provider") and self.provider == "IBM watsonx.ai":check for provider existence, but ifself.provideris None or an unexpected value, comparisons could behave unexpectedly. Add explicit None checks or use a safer comparison pattern.
1365-1380: Resource leak risk with unclosed HTTP requests.The
fetch_ibm_models()andfetch_ollama_models()methods userequests.get()withtimeout=10, but do not explicitly close the response. While therequestslibrary auto-closes responses in most cases, consider using a context manager for clarity and robustness:with requests.get(endpoint, params=params, timeout=10) as response: response.raise_for_status() data = response.json()
Introduces a context_id input to ChatInput and ChatOutput components for enhanced chat memory management. Expands LanguageModelComponent to support IBM watsonx.ai and Ollama providers, including dynamic model fetching and related configuration options.
Refactored LanguageModelComponent to support IBM watsonx and Ollama providers, including new input fields and validation logic. Updated build config logic and tests to handle provider-specific options, error cases, and model instantiation for IBM watsonx and Ollama.
…angflow-ai/langflow into feat-ibm-watsonx-ollama-models
…ow-ai#10471) * Add IBM watsonx.ai support to LanguageModelComponent Extended LanguageModelComponent to support IBM watsonx.ai as a provider, including dynamic model fetching, new input fields for API endpoint and project ID, and integration with ChatWatsonx. Updated starter project JSONs to reflect these changes and enable selection of IBM watsonx.ai models. * Add Ollama support to LanguageModelComponent Extended the LanguageModelComponent to support Ollama as a provider, including dynamic model fetching from the Ollama API and related UI input fields. Updated build_model and update_build_config logic to handle Ollama-specific configuration and improved provider switching logic for all supported providers. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * flow updates * Update component_index.json * Add context_id support and expand model providers Introduces a context_id input to ChatInput and ChatOutput components for enhanced chat memory management. Expands LanguageModelComponent to support IBM watsonx.ai and Ollama providers, including dynamic model fetching and related configuration options. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Add IBM watsonx and Ollama support to LanguageModelComponent Refactored LanguageModelComponent to support IBM watsonx and Ollama providers, including new input fields and validation logic. Updated build config logic and tests to handle provider-specific options, error cases, and model instantiation for IBM watsonx and Ollama. * update to the componentn index and templates * fix ruff * Update component_index.json * template updates --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This pull request significantly enhances the
LanguageModelComponentin theBasic Prompt Chaining.jsonstarter project by adding support for IBM watsonx.ai and Ollama providers, enabling dynamic model selection and configuration for these new providers. It also refactors the input configuration and model-building logic to be more extensible and robust, including the ability to fetch available models from provider APIs. The changes improve the flexibility and usability of the component for users who want to work with a broader range of language model providers.New Provider Integrations
Input and Configuration Refactoring
DropdownInput,StrInput,MessageTextInput) for provider-specific settings, such asbase_url,project_id, andollama_base_url. (F21eb8bSummary by CodeRabbit
Release Notes