Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

feat: updated langflow to 1.9 (#1405)

Lucas Oliveirab901448d84dc
diff --git a/Dockerfile.langflow b/Dockerfile.langflow
index 2989fc65e..0603a0780 100644
--- a/Dockerfile.langflow
+++ b/Dockerfile.langflow
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.4
-FROM langflowai/langflow-nightly:1.9.0.dev40
+FROM langflowai/langflow:1.9.0
# Install uv and pre-create the Langflow data directory.
# The base image already runs as uid=1000 and owns /app, so no root or chown needed.
diff --git a/flows/ingestion_flow.json b/flows/ingestion_flow.json
index 361e5e6f4..0ef50b777 100644
--- a/flows/ingestion_flow.json
+++ b/flows/ingestion_flow.json
@@ -828,7 +828,7 @@
],
"frozen": false,
"icon": "braces",
- "last_updated": "2026-04-09T14:17:24.701Z",
+ "last_updated": "2026-04-15T17:08:23.611Z",
"legacy": false,
"lf_version": "1.7.0.dev21",
"metadata": {},
@@ -878,7 +878,7 @@
"value": "5488df7c-b93f-4f87-a446-b67028bc0813"
},
"_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"code": {
@@ -4577,15 +4577,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-01T20:51:22.443Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -4620,7 +4619,7 @@
"value": "5488df7c-b93f-4f87-a446-b67028bc0813"
},
"_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"api_base": {
@@ -4671,7 +4670,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -4737,7 +4736,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -6330,15 +6329,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-01T20:51:22.443Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -6373,7 +6371,7 @@
"value": "5488df7c-b93f-4f87-a446-b67028bc0813"
},
"_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"api_base": {
@@ -6424,7 +6422,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -6490,7 +6488,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -6822,11 +6820,13 @@
"x": 1313.5212863870001,
"y": 1858.0159458799487
},
- "selected": false,
+ "selected": true,
"type": "genericNode"
},
{
"data": {
+ "description": "Generate embeddings using a specified provider.",
+ "display_name": "Embedding Model",
"id": "EmbeddingModel-nQVVC",
"node": {
"base_classes": [
@@ -6857,20 +6857,19 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-01T20:51:45.866Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
},
- "module": "lfx.components.models_and_agents.embedding_model.EmbeddingModelComponent"
+ "module": "custom_components.embedding_model"
},
"minimized": false,
"output_types": [],
@@ -6900,7 +6899,7 @@
"value": "5488df7c-b93f-4f87-a446-b67028bc0813"
},
"_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"api_base": {
@@ -6951,7 +6950,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -7017,7 +7016,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -7102,6 +7101,7 @@
],
"list": false,
"list_add_label": "Add More",
+ "load_from_db": false,
"model_type": "embedding",
"name": "model",
"options": [
@@ -7351,16 +7351,16 @@
}
],
"viewport": {
- "x": -105.59760021687578,
- "y": -426.71954436081523,
- "zoom": 0.49198699185028627
+ "x": -242.06812754438226,
+ "y": -952.9999906063429,
+ "zoom": 0.6625692775925841
}
},
"description": "Load your data for chat context with Retrieval Augmented Generation.",
"endpoint_name": null,
"id": "5488df7c-b93f-4f87-a446-b67028bc0813",
"is_component": false,
- "last_tested_version": "1.9.0.dev38",
+ "last_tested_version": "1.9.0",
"locked": true,
"name": "OpenSearch Ingestion Flow",
"tags": [
diff --git a/flows/openrag_agent.json b/flows/openrag_agent.json
index c9f21ed99..486293973 100644
--- a/flows/openrag_agent.json
+++ b/flows/openrag_agent.json
@@ -286,6 +286,8 @@
"targetHandle": "{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-gWl8Eœ,œinputTypesœ:[œDataœ,œJSONœ,œDataFrameœ,œTableœ,œMessageœ],œtypeœ:œotherœ}"
},
{
+ "animated": false,
+ "className": "",
"data": {
"sourceHandle": {
"dataType": "OpenSearchVectorStoreComponentMultimodalMultiEmbedding",
@@ -305,6 +307,7 @@
}
},
"id": "xy-edge__OpenSearchVectorStoreComponentMultimodalMultiEmbedding-TyvvE{œdataTypeœ:œOpenSearchVectorStoreComponentMultimodalMultiEmbeddingœ,œidœ:œOpenSearchVectorStoreComponentMultimodalMultiEmbedding-TyvvEœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-Nfw7u{œfieldNameœ:œtoolsœ,œidœ:œAgent-Nfw7uœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
+ "selected": false,
"source": "OpenSearchVectorStoreComponentMultimodalMultiEmbedding-TyvvE",
"sourceHandle": "{œdataTypeœ:œOpenSearchVectorStoreComponentMultimodalMultiEmbeddingœ,œidœ:œOpenSearchVectorStoreComponentMultimodalMultiEmbedding-TyvvEœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}",
"target": "Agent-Nfw7u",
@@ -336,7 +339,7 @@
"frozen": false,
"icon": "Mcp",
"key": "mcp_lf-starter_project",
- "last_updated": "2026-04-07T17:35:25.058Z",
+ "last_updated": "2026-04-15T17:09:49.787Z",
"legacy": false,
"lf_version": "1.9.0",
"mcpServerName": "lf-starter_project",
@@ -389,7 +392,7 @@
"value": "1098eea1-6649-4e1d-aed1-b77249fb8dd0"
},
"_frontend_node_folder_id": {
- "value": "18ca84dc-4277-40a5-bbca-8bf9d7343bff"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"code": {
@@ -523,32 +526,6 @@
"tags": [
"opensearch_url_ingestion_flow"
]
- },
- {
- "args": {
- "input_value": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "default": null,
- "description": "Text to be passed as input.",
- "title": "Input Value"
- }
- },
- "description": "Load your data for chat context with Retrieval Augmented Generation.",
- "display_description": "Load your data for chat context with Retrieval Augmented Generation.",
- "display_name": "opensearch_ingestion_flow_1",
- "name": "opensearch_ingestion_flow_1",
- "readonly": false,
- "status": true,
- "tags": [
- "opensearch_ingestion_flow_1"
- ]
}
]
},
@@ -579,7 +556,7 @@
"dragging": false,
"id": "MCP-7EY21",
"measured": {
- "height": 315,
+ "height": 287,
"width": 320
},
"position": {
@@ -1259,9 +1236,8 @@
"frozen": false,
"icon": "bot",
"legacy": false,
- "lf_version": "1.9.0",
"metadata": {
- "code_hash": "7db77aa1eed6",
+ "code_hash": "154c71cf7441",
"dependencies": {
"dependencies": [
{
@@ -1270,11 +1246,11 @@
},
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
},
{
"name": "langchain_core",
- "version": "1.2.22"
+ "version": "1.2.29"
}
],
"total_dependencies": 3
@@ -1305,14 +1281,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "input_types": [],
- "value": "1098eea1-6649-4e1d-aed1-b77249fb8dd0"
- },
- "_frontend_node_folder_id": {
- "input_types": [],
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"add_current_date_tool": {
"_input_type": "BoolInput",
@@ -1320,7 +1288,6 @@
"display_name": "Current Date",
"dynamic": false,
"info": "If true, will add a tool to the agent that returns the current date.",
- "input_types": [],
"list": false,
"list_add_label": "Add More",
"name": "add_current_date_tool",
@@ -1369,7 +1336,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -1387,13 +1354,12 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
"external_options": {},
"info": "The base URL of the API (IBM watsonx.ai only)",
- "input_types": [],
"load_from_db": false,
"name": "base_url_ibm_watsonx",
"options": [
@@ -1424,7 +1390,6 @@
"fileTypes": [],
"file_path": "",
"info": "",
- "input_types": [],
"list": false,
"load_from_db": false,
"multiline": true,
@@ -1435,7 +1400,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from __future__ import annotations\n\nimport json\nimport re\nfrom typing import TYPE_CHECKING\n\nfrom pydantic import ValidationError\n\nfrom lfx.components.models_and_agents.memory import MemoryComponent\n\nif TYPE_CHECKING:\n from langchain_core.tools import Tool\n\nfrom lfx.base.agents.agent import LCToolsAgentComponent\nfrom lfx.base.agents.events import ExceptionWithMessageError\nfrom lfx.base.models.unified_models import (\n get_language_model_options,\n get_llm,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.components.agentics.helpers.model_config import validate_model_selection\nfrom lfx.components.helpers import CurrentDateComponent\nfrom lfx.components.langchain_utilities.tool_calling import ToolCallingAgentComponent\nfrom lfx.custom.custom_component.component import get_component_toolkit\nfrom lfx.field_typing.range_spec import RangeSpec\nfrom lfx.helpers.base_model import build_model_from_schema\nfrom lfx.inputs.inputs import BoolInput, DropdownInput, ModelInput, StrInput\nfrom lfx.io import IntInput, MessageTextInput, MultilineInput, Output, SecretStrInput, TableInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.data import Data\nfrom lfx.schema.dotdict import dotdict\nfrom lfx.schema.message import Message\nfrom lfx.schema.table import EditMode\n\n\ndef set_advanced_true(component_input):\n component_input.advanced = True\n return component_input\n\n\nclass AgentComponent(ToolCallingAgentComponent):\n display_name: str = \"Agent\"\n description: str = \"Define the agent's instructions, then enter a task to complete using tools.\"\n documentation: str = \"https://docs.langflow.org/agents\"\n icon = \"bot\"\n beta = False\n name = \"Agent\"\n\n memory_inputs = [set_advanced_true(component_input) for component_input in MemoryComponent().inputs]\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Language Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n StrInput(\n name=\"project_id\",\n display_name=\"watsonx Project ID\",\n info=\"The project ID associated with the foundation model (IBM watsonx.ai only)\",\n show=False,\n required=False,\n ),\n MultilineInput(\n name=\"system_prompt\",\n display_name=\"Agent Instructions\",\n info=\"System Prompt: Initial instructions and context provided to guide the agent's behavior.\",\n value=\"You are a helpful assistant that can use tools to answer questions and perform tasks.\",\n advanced=False,\n ),\n MessageTextInput(\n name=\"context_id\",\n display_name=\"Context ID\",\n info=\"The context ID of the chat. Adds an extra layer to the local memory.\",\n value=\"\",\n advanced=True,\n ),\n IntInput(\n name=\"n_messages\",\n display_name=\"Number of Chat History Messages\",\n value=100,\n info=\"Number of chat history messages to retrieve.\",\n advanced=True,\n show=True,\n ),\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n info=\"Maximum number of tokens to generate. Field name varies by provider.\",\n advanced=True,\n range_spec=RangeSpec(min=1, max=128000, step=1, step_type=\"int\"),\n ),\n MultilineInput(\n name=\"format_instructions\",\n display_name=\"Output Format Instructions\",\n info=\"Generic Template for structured output formatting. Valid only with Structured response.\",\n value=(\n \"You are an AI that extracts structured JSON objects from unstructured text. \"\n \"Use a predefined schema with expected types (str, int, float, bool, dict). \"\n \"Extract ALL relevant instances that match the schema - if multiple patterns exist, capture them all. \"\n \"Fill missing or ambiguous values with defaults: null for missing values. \"\n \"Remove exact duplicates but keep variations that have different field values. \"\n \"Always return valid JSON in the expected format, never throw errors. \"\n \"If multiple objects can be extracted, return them all in the structured format.\"\n ),\n advanced=True,\n ),\n TableInput(\n name=\"output_schema\",\n display_name=\"Output Schema\",\n info=(\n \"Schema Validation: Define the structure and data types for structured output. \"\n \"No validation if no output schema.\"\n ),\n advanced=True,\n required=False,\n value=[],\n table_schema=[\n {\n \"name\": \"name\",\n \"display_name\": \"Name\",\n \"type\": \"str\",\n \"description\": \"Specify the name of the output field.\",\n \"default\": \"field\",\n \"edit_mode\": EditMode.INLINE,\n },\n {\n \"name\": \"description\",\n \"display_name\": \"Description\",\n \"type\": \"str\",\n \"description\": \"Describe the purpose of the output field.\",\n \"default\": \"description of field\",\n \"edit_mode\": EditMode.POPOVER,\n },\n {\n \"name\": \"type\",\n \"display_name\": \"Type\",\n \"type\": \"str\",\n \"edit_mode\": EditMode.INLINE,\n \"description\": (\"Indicate the data type of the output field (e.g., str, int, float, bool, dict).\"),\n \"options\": [\"str\", \"int\", \"float\", \"bool\", \"dict\"],\n \"default\": \"str\",\n },\n {\n \"name\": \"multiple\",\n \"display_name\": \"As List\",\n \"type\": \"boolean\",\n \"description\": \"Set to True if this output field should be a list of the specified type.\",\n \"default\": \"False\",\n \"edit_mode\": EditMode.INLINE,\n },\n ],\n ),\n *LCToolsAgentComponent.get_base_inputs(),\n # removed memory inputs from agent component\n # *memory_inputs,\n BoolInput(\n name=\"add_current_date_tool\",\n display_name=\"Current Date\",\n advanced=True,\n info=\"If true, will add a tool to the agent that returns the current date.\",\n value=True,\n ),\n ]\n outputs = [\n Output(name=\"response\", display_name=\"Response\", method=\"message_response\"),\n ]\n\n def _resolve_selected_model(self):\n \"\"\"Resolve the selected model, including legacy agent_llm/model_name inputs.\"\"\"\n try:\n from langchain_core.language_models import BaseLanguageModel\n\n if isinstance(self.model, BaseLanguageModel):\n return self.model\n except ImportError:\n pass\n\n if isinstance(self.model, list) and self.model:\n return self.model\n\n legacy_provider = getattr(self, \"agent_llm\", None)\n legacy_model_name = getattr(self, \"model_name\", None)\n if not legacy_provider or not legacy_model_name:\n return self.model\n\n options = get_language_model_options(user_id=self.user_id)\n for option in options:\n if option.get(\"provider\") == legacy_provider and option.get(\"name\") == legacy_model_name:\n return [option]\n\n return [\n {\n \"name\": legacy_model_name,\n \"provider\": legacy_provider,\n \"metadata\": {},\n }\n ]\n\n def _get_max_tokens_value(self):\n \"\"\"Return the user-supplied max_tokens or None when unset/zero.\"\"\"\n val = getattr(self, \"max_tokens\", None)\n if val in {\"\", 0}:\n return None\n return val\n\n def _get_llm(self):\n \"\"\"Override parent to include max_tokens from the Agent's input field.\"\"\"\n return get_llm(\n model=self.model,\n user_id=self.user_id,\n api_key=getattr(self, \"api_key\", None),\n max_tokens=self._get_max_tokens_value(),\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n )\n\n async def get_agent_requirements(self):\n \"\"\"Get the agent requirements for the agent.\"\"\"\n from langchain_core.tools import StructuredTool\n\n selected_model = self._resolve_selected_model()\n try:\n from langchain_core.language_models import BaseLanguageModel\n\n is_connected_model = isinstance(selected_model, BaseLanguageModel)\n except ImportError:\n is_connected_model = False\n\n if not is_connected_model:\n validate_model_selection(selected_model)\n\n # Ensure _get_llm() uses the resolved model (e.g. from legacy agent_llm/model_name)\n self.model = selected_model\n llm_model = self._get_llm()\n if llm_model is None:\n msg = \"No language model selected. Please choose a model to proceed.\"\n raise ValueError(msg)\n\n # Get memory data\n self.chat_history = await self.get_memory_data()\n await logger.adebug(f\"Retrieved {len(self.chat_history)} chat history messages\")\n if isinstance(self.chat_history, Message):\n self.chat_history = [self.chat_history]\n\n # Add current date tool if enabled\n if self.add_current_date_tool:\n if not isinstance(self.tools, list): # type: ignore[has-type]\n self.tools = []\n current_date_tool = (await CurrentDateComponent(**self.get_base_args()).to_toolkit()).pop(0)\n\n if not isinstance(current_date_tool, StructuredTool):\n msg = \"CurrentDateComponent must be converted to a StructuredTool\"\n raise TypeError(msg)\n self.tools.append(current_date_tool)\n\n # Set shared callbacks for tracing the tools used by the agent\n self.set_tools_callbacks(self.tools, self._get_shared_callbacks())\n\n return llm_model, self.chat_history, self.tools\n\n async def message_response(self) -> Message:\n try:\n llm_model, self.chat_history, self.tools = await self.get_agent_requirements()\n # Set up and run agent\n self.set(\n llm=llm_model,\n tools=self.tools or [],\n chat_history=self.chat_history,\n input_value=self.input_value,\n system_prompt=self.system_prompt,\n )\n agent = self.create_agent_runnable()\n result = await self.run_agent(agent)\n\n # Store result for potential JSON output\n self._agent_result = result\n\n except (ValueError, TypeError, KeyError) as e:\n await logger.aerror(f\"{type(e).__name__}: {e!s}\")\n raise\n except ExceptionWithMessageError as e:\n await logger.aerror(f\"ExceptionWithMessageError occurred: {e}\")\n raise\n # Avoid catching blind Exception; let truly unexpected exceptions propagate\n except Exception as e:\n await logger.aerror(f\"Unexpected error: {e!s}\")\n raise\n else:\n return result\n\n def _preprocess_schema(self, schema):\n \"\"\"Preprocess schema to ensure correct data types for build_model_from_schema.\"\"\"\n processed_schema = []\n for field in schema:\n processed_field = {\n \"name\": str(field.get(\"name\", \"field\")),\n \"type\": str(field.get(\"type\", \"str\")),\n \"description\": str(field.get(\"description\", \"\")),\n \"multiple\": field.get(\"multiple\", False),\n }\n # Ensure multiple is handled correctly\n if isinstance(processed_field[\"multiple\"], str):\n processed_field[\"multiple\"] = processed_field[\"multiple\"].lower() in [\n \"true\",\n \"1\",\n \"t\",\n \"y\",\n \"yes\",\n ]\n processed_schema.append(processed_field)\n return processed_schema\n\n async def build_structured_output_base(self, content: str):\n \"\"\"Build structured output with optional BaseModel validation.\"\"\"\n json_pattern = r\"\\{.*\\}\"\n schema_error_msg = \"Try setting an output schema\"\n\n # Try to parse content as JSON first\n json_data = None\n try:\n json_data = json.loads(content)\n except json.JSONDecodeError:\n json_match = re.search(json_pattern, content, re.DOTALL)\n if json_match:\n try:\n json_data = json.loads(json_match.group())\n except json.JSONDecodeError:\n return {\"content\": content, \"error\": schema_error_msg}\n else:\n return {\"content\": content, \"error\": schema_error_msg}\n\n # If no output schema provided, return parsed JSON without validation\n if not hasattr(self, \"output_schema\") or not self.output_schema or len(self.output_schema) == 0:\n return json_data\n\n # Use BaseModel validation with schema\n try:\n processed_schema = self._preprocess_schema(self.output_schema)\n output_model = build_model_from_schema(processed_schema)\n\n # Validate against the schema\n if isinstance(json_data, list):\n # Multiple objects\n validated_objects = []\n for item in json_data:\n try:\n validated_obj = output_model.model_validate(item)\n validated_objects.append(validated_obj.model_dump())\n except ValidationError as e:\n await logger.aerror(f\"Validation error for item: {e}\")\n # Include invalid items with error info\n validated_objects.append({\"data\": item, \"validation_error\": str(e)})\n return validated_objects\n\n # Single object\n try:\n validated_obj = output_model.model_validate(json_data)\n return [validated_obj.model_dump()] # Return as list for consistency\n except ValidationError as e:\n await logger.aerror(f\"Validation error: {e}\")\n return [{\"data\": json_data, \"validation_error\": str(e)}]\n\n except (TypeError, ValueError) as e:\n await logger.aerror(f\"Error building structured output: {e}\")\n # Fallback to parsed JSON without validation\n return json_data\n\n async def json_response(self) -> Data:\n \"\"\"Convert agent response to structured JSON Data output with schema validation.\"\"\"\n # Always use structured chat agent for JSON response mode for better JSON formatting\n try:\n system_components = []\n\n # 1. Agent Instructions (system_prompt)\n agent_instructions = getattr(self, \"system_prompt\", \"\") or \"\"\n if agent_instructions:\n system_components.append(f\"{agent_instructions}\")\n\n # 2. Format Instructions\n format_instructions = getattr(self, \"format_instructions\", \"\") or \"\"\n if format_instructions:\n system_components.append(f\"Format instructions: {format_instructions}\")\n\n # 3. Schema Information from BaseModel\n if hasattr(self, \"output_schema\") and self.output_schema and len(self.output_schema) > 0:\n try:\n processed_schema = self._preprocess_schema(self.output_schema)\n output_model = build_model_from_schema(processed_schema)\n schema_dict = output_model.model_json_schema()\n schema_info = (\n \"You are given some text that may include format instructions, \"\n \"explanations, or other content alongside a JSON schema.\\n\\n\"\n \"Your task:\\n\"\n \"- Extract only the JSON schema.\\n\"\n \"- Return it as valid JSON.\\n\"\n \"- Do not include format instructions, explanations, or extra text.\\n\\n\"\n \"Input:\\n\"\n f\"{json.dumps(schema_dict, indent=2)}\\n\\n\"\n \"Output (only JSON schema):\"\n )\n system_components.append(schema_info)\n except (ValidationError, ValueError, TypeError, KeyError) as e:\n await logger.aerror(f\"Could not build schema for prompt: {e}\", exc_info=True)\n\n # Combine all components\n combined_instructions = \"\\n\\n\".join(system_components) if system_components else \"\"\n llm_model, self.chat_history, self.tools = await self.get_agent_requirements()\n self.set(\n llm=llm_model,\n tools=self.tools or [],\n chat_history=self.chat_history,\n input_value=self.input_value,\n system_prompt=combined_instructions,\n )\n\n # Create and run structured chat agent\n try:\n structured_agent = self.create_agent_runnable()\n except (NotImplementedError, ValueError, TypeError) as e:\n await logger.aerror(f\"Error with structured chat agent: {e}\")\n raise\n try:\n result = await self.run_agent(structured_agent)\n except (\n ExceptionWithMessageError,\n ValueError,\n TypeError,\n RuntimeError,\n ) as e:\n await logger.aerror(f\"Error with structured agent result: {e}\")\n raise\n # Extract content from structured agent result\n if hasattr(result, \"content\"):\n content = result.content\n elif hasattr(result, \"text\"):\n content = result.text\n else:\n content = str(result)\n\n except (\n ExceptionWithMessageError,\n ValueError,\n TypeError,\n NotImplementedError,\n AttributeError,\n ) as e:\n await logger.aerror(f\"Error with structured chat agent: {e}\")\n # Fallback to regular agent\n content_str = \"No content returned from agent\"\n return Data(data={\"content\": content_str, \"error\": str(e)})\n\n # Process with structured output validation\n try:\n structured_output = await self.build_structured_output_base(content)\n\n # Handle different output formats\n if isinstance(structured_output, list) and structured_output:\n if len(structured_output) == 1:\n return Data(data=structured_output[0])\n return Data(data={\"results\": structured_output})\n if isinstance(structured_output, dict):\n return Data(data=structured_output)\n return Data(data={\"content\": content})\n\n except (ValueError, TypeError) as e:\n await logger.aerror(f\"Error in structured output processing: {e}\")\n return Data(data={\"content\": content, \"error\": str(e)})\n\n async def get_memory_data(self):\n # TODO: This is a temporary fix to avoid message duplication. We should develop a function for this.\n messages = (\n await MemoryComponent(**self.get_base_args())\n .set(\n session_id=self.graph.session_id,\n context_id=self.context_id,\n order=\"Ascending\",\n n_messages=self.n_messages,\n )\n .retrieve_messages()\n )\n return [\n message for message in messages if getattr(message, \"id\", None) != getattr(self.input_value, \"id\", None)\n ]\n\n def update_input_types(self, build_config: dotdict) -> dotdict:\n \"\"\"Update input types for all fields in build_config.\"\"\"\n for key, value in build_config.items():\n if isinstance(value, dict):\n if value.get(\"input_types\") is None:\n build_config[key][\"input_types\"] = []\n elif hasattr(value, \"input_types\") and value.input_types is None:\n value.input_types = []\n return build_config\n\n async def update_build_config(\n self,\n build_config: dotdict,\n field_value: list[dict],\n field_name: str | None = None,\n ) -> dotdict:\n # Update model options with caching (for all field changes)\n # Agents require tool calling, so filter for only tool-calling capable models\n build_config = handle_model_input_update(\n component=self,\n build_config=dict(build_config),\n field_value=field_value,\n field_name=field_name,\n cache_key_prefix=\"language_model_options_tool_calling\",\n get_options_func=lambda user_id=None: get_language_model_options(user_id=user_id, tool_calling=True),\n )\n build_config = dotdict(build_config)\n\n if field_name == \"model\":\n build_config = self.update_input_types(build_config)\n\n # Validate required keys\n default_keys = [\n \"code\",\n \"_type\",\n \"model\",\n \"tools\",\n \"input_value\",\n \"add_current_date_tool\",\n \"system_prompt\",\n \"agent_description\",\n \"max_iterations\",\n \"handle_parsing_errors\",\n \"verbose\",\n ]\n missing_keys = [key for key in default_keys if key not in build_config]\n if missing_keys:\n msg = f\"Missing required keys in build_config: {missing_keys}\"\n raise ValueError(msg)\n return dotdict({k: v.to_dict() if hasattr(v, \"to_dict\") else v for k, v in build_config.items()})\n\n async def _get_tools(self) -> list[Tool]:\n component_toolkit = get_component_toolkit()\n tools_names = self._build_tools_names()\n agent_description = self.get_tool_description()\n # TODO: Agent Description Depreciated Feature to be removed\n description = f\"{agent_description}{tools_names}\"\n\n tools = component_toolkit(component=self).get_tools(\n tool_name=\"Call_Agent\",\n tool_description=description,\n # here we do not use the shared callbacks as we are exposing the agent as a tool\n callbacks=self.get_langchain_callbacks(),\n )\n if hasattr(self, \"tools_metadata\"):\n tools = component_toolkit(component=self, metadata=self.tools_metadata).update_tools_metadata(tools=tools)\n\n return tools\n"
+ "value": "from __future__ import annotations\n\nimport json\nimport re\nfrom typing import TYPE_CHECKING\n\nfrom pydantic import ValidationError\n\nfrom lfx.components.models_and_agents.memory import MemoryComponent\n\nif TYPE_CHECKING:\n from langchain_core.tools import Tool\n\nfrom lfx.base.agents.agent import LCToolsAgentComponent\nfrom lfx.base.agents.events import ExceptionWithMessageError\nfrom lfx.base.models.unified_models import (\n get_language_model_options,\n get_llm,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.components.agentics.helpers.model_config import validate_model_selection\nfrom lfx.components.helpers import CurrentDateComponent\nfrom lfx.components.langchain_utilities.tool_calling import ToolCallingAgentComponent\nfrom lfx.custom.custom_component.component import get_component_toolkit\nfrom lfx.field_typing.range_spec import RangeSpec\nfrom lfx.helpers.base_model import build_model_from_schema\nfrom lfx.inputs.inputs import BoolInput, DropdownInput, ModelInput, StrInput\nfrom lfx.io import IntInput, MessageTextInput, MultilineInput, Output, SecretStrInput, TableInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.data import Data\nfrom lfx.schema.dotdict import dotdict\nfrom lfx.schema.message import Message\nfrom lfx.schema.table import EditMode\n\n\ndef set_advanced_true(component_input):\n component_input.advanced = True\n return component_input\n\n\nclass AgentComponent(ToolCallingAgentComponent):\n display_name: str = \"Agent\"\n description: str = \"Define the agent's instructions, then enter a task to complete using tools.\"\n documentation: str = \"https://docs.langflow.org/agents\"\n icon = \"bot\"\n beta = False\n name = \"Agent\"\n\n memory_inputs = [set_advanced_true(component_input) for component_input in MemoryComponent().inputs]\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Language Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n StrInput(\n name=\"project_id\",\n display_name=\"watsonx Project ID\",\n info=\"The project ID associated with the foundation model (IBM watsonx.ai only)\",\n show=False,\n required=False,\n ),\n MultilineInput(\n name=\"system_prompt\",\n display_name=\"Agent Instructions\",\n info=\"System Prompt: Initial instructions and context provided to guide the agent's behavior.\",\n value=\"You are a helpful assistant that can use tools to answer questions and perform tasks.\",\n advanced=False,\n ),\n MessageTextInput(\n name=\"context_id\",\n display_name=\"Context ID\",\n info=\"The context ID of the chat. Adds an extra layer to the local memory.\",\n value=\"\",\n advanced=True,\n ),\n IntInput(\n name=\"n_messages\",\n display_name=\"Number of Chat History Messages\",\n value=100,\n info=\"Number of chat history messages to retrieve.\",\n advanced=True,\n show=True,\n ),\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n info=\"Maximum number of tokens to generate. Field name varies by provider.\",\n advanced=True,\n range_spec=RangeSpec(min=1, max=128000, step=1, step_type=\"int\"),\n ),\n MultilineInput(\n name=\"format_instructions\",\n display_name=\"Output Format Instructions\",\n info=\"Generic Template for structured output formatting. Valid only with Structured response.\",\n value=(\n \"You are an AI that extracts structured JSON objects from unstructured text. \"\n \"Use a predefined schema with expected types (str, int, float, bool, dict). \"\n \"Extract ALL relevant instances that match the schema - if multiple patterns exist, capture them all. \"\n \"Fill missing or ambiguous values with defaults: null for missing values. \"\n \"Remove exact duplicates but keep variations that have different field values. \"\n \"Always return valid JSON in the expected format, never throw errors. \"\n \"If multiple objects can be extracted, return them all in the structured format.\"\n ),\n advanced=True,\n ),\n TableInput(\n name=\"output_schema\",\n display_name=\"Output Schema\",\n info=(\n \"Schema Validation: Define the structure and data types for structured output. \"\n \"No validation if no output schema.\"\n ),\n advanced=True,\n required=False,\n value=[],\n table_schema=[\n {\n \"name\": \"name\",\n \"display_name\": \"Name\",\n \"type\": \"str\",\n \"description\": \"Specify the name of the output field.\",\n \"default\": \"field\",\n \"edit_mode\": EditMode.INLINE,\n },\n {\n \"name\": \"description\",\n \"display_name\": \"Description\",\n \"type\": \"str\",\n \"description\": \"Describe the purpose of the output field.\",\n \"default\": \"description of field\",\n \"edit_mode\": EditMode.POPOVER,\n },\n {\n \"name\": \"type\",\n \"display_name\": \"Type\",\n \"type\": \"str\",\n \"edit_mode\": EditMode.INLINE,\n \"description\": (\"Indicate the data type of the output field (e.g., str, int, float, bool, dict).\"),\n \"options\": [\"str\", \"int\", \"float\", \"bool\", \"dict\"],\n \"default\": \"str\",\n },\n {\n \"name\": \"multiple\",\n \"display_name\": \"As List\",\n \"type\": \"boolean\",\n \"description\": \"Set to True if this output field should be a list of the specified type.\",\n \"default\": \"False\",\n \"edit_mode\": EditMode.INLINE,\n },\n ],\n ),\n *LCToolsAgentComponent.get_base_inputs(),\n # removed memory inputs from agent component\n # *memory_inputs,\n BoolInput(\n name=\"add_current_date_tool\",\n display_name=\"Current Date\",\n advanced=True,\n info=\"If true, will add a tool to the agent that returns the current date.\",\n value=True,\n ),\n ]\n outputs = [\n Output(name=\"response\", display_name=\"Response\", method=\"message_response\"),\n ]\n\n def _resolve_selected_model(self):\n \"\"\"Resolve the selected model, including legacy agent_llm/model_name inputs.\"\"\"\n try:\n from langchain_core.language_models import BaseLanguageModel\n\n if isinstance(self.model, BaseLanguageModel):\n return self.model\n except ImportError:\n pass\n\n if isinstance(self.model, list) and self.model:\n return self.model\n\n legacy_provider = getattr(self, \"agent_llm\", None)\n legacy_model_name = getattr(self, \"model_name\", None)\n if not legacy_provider or not legacy_model_name:\n return self.model\n\n options = get_language_model_options(user_id=self.user_id)\n for option in options:\n if option.get(\"provider\") == legacy_provider and option.get(\"name\") == legacy_model_name:\n return [option]\n\n return [\n {\n \"name\": legacy_model_name,\n \"provider\": legacy_provider,\n \"metadata\": {},\n }\n ]\n\n def _get_max_tokens_value(self):\n \"\"\"Return the user-supplied max_tokens or None when unset/zero.\"\"\"\n val = getattr(self, \"max_tokens\", None)\n if val in {\"\", 0}:\n return None\n return val\n\n def _get_llm(self):\n \"\"\"Override parent to include max_tokens from the Agent's input field.\"\"\"\n return get_llm(\n model=self.model,\n user_id=self.user_id,\n api_key=getattr(self, \"api_key\", None),\n max_tokens=self._get_max_tokens_value(),\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n )\n\n async def get_agent_requirements(self):\n \"\"\"Get the agent requirements for the agent.\"\"\"\n from langchain_core.tools import StructuredTool\n\n selected_model = self._resolve_selected_model()\n try:\n from langchain_core.language_models import BaseLanguageModel\n\n is_connected_model = isinstance(selected_model, BaseLanguageModel)\n except ImportError:\n is_connected_model = False\n\n if not is_connected_model:\n validate_model_selection(selected_model)\n\n # Ensure _get_llm() uses the resolved model (e.g. from legacy agent_llm/model_name)\n self.model = selected_model\n llm_model = self._get_llm()\n if llm_model is None:\n msg = \"No language model selected. Please choose a model to proceed.\"\n raise ValueError(msg)\n\n # Get memory data\n self.chat_history = await self.get_memory_data()\n await logger.adebug(f\"Retrieved {len(self.chat_history)} chat history messages\")\n if isinstance(self.chat_history, Message):\n self.chat_history = [self.chat_history]\n\n # Add current date tool if enabled\n if self.add_current_date_tool:\n if not isinstance(self.tools, list): # type: ignore[has-type]\n self.tools = []\n current_date_tool = (await CurrentDateComponent(**self.get_base_args()).to_toolkit()).pop(0)\n\n if not isinstance(current_date_tool, StructuredTool):\n msg = \"CurrentDateComponent must be converted to a StructuredTool\"\n raise TypeError(msg)\n self.tools.append(current_date_tool)\n\n # Set shared callbacks for tracing the tools used by the agent\n self.set_tools_callbacks(self.tools, self._get_shared_callbacks())\n\n return llm_model, self.chat_history, self.tools\n\n async def message_response(self) -> Message:\n try:\n llm_model, self.chat_history, self.tools = await self.get_agent_requirements()\n # Set up and run agent\n self.set(\n llm=llm_model,\n tools=self.tools or [],\n chat_history=self.chat_history,\n input_value=self.input_value,\n system_prompt=self.system_prompt,\n )\n agent = self.create_agent_runnable()\n result = await self.run_agent(agent)\n\n # Store result for potential JSON output\n self._agent_result = result\n\n except (ValueError, TypeError, KeyError) as e:\n await logger.aerror(f\"{type(e).__name__}: {e!s}\")\n raise\n except ExceptionWithMessageError as e:\n await logger.aerror(f\"ExceptionWithMessageError occurred: {e}\")\n raise\n # Avoid catching blind Exception; let truly unexpected exceptions propagate\n except Exception as e:\n await logger.aerror(f\"Unexpected error: {e!s}\")\n raise\n else:\n return result\n\n def _preprocess_schema(self, schema):\n \"\"\"Preprocess schema to ensure correct data types for build_model_from_schema.\"\"\"\n processed_schema = []\n for field in schema:\n processed_field = {\n \"name\": str(field.get(\"name\", \"field\")),\n \"type\": str(field.get(\"type\", \"str\")),\n \"description\": str(field.get(\"description\", \"\")),\n \"multiple\": field.get(\"multiple\", False),\n }\n # Ensure multiple is handled correctly\n if isinstance(processed_field[\"multiple\"], str):\n processed_field[\"multiple\"] = processed_field[\"multiple\"].lower() in [\n \"true\",\n \"1\",\n \"t\",\n \"y\",\n \"yes\",\n ]\n processed_schema.append(processed_field)\n return processed_schema\n\n async def build_structured_output_base(self, content: str):\n \"\"\"Build structured output with optional BaseModel validation.\"\"\"\n json_pattern = r\"\\{.*\\}\"\n schema_error_msg = \"Try setting an output schema\"\n\n # Try to parse content as JSON first\n json_data = None\n try:\n json_data = json.loads(content)\n except json.JSONDecodeError:\n json_match = re.search(json_pattern, content, re.DOTALL)\n if json_match:\n try:\n json_data = json.loads(json_match.group())\n except json.JSONDecodeError:\n return {\"content\": content, \"error\": schema_error_msg}\n else:\n return {\"content\": content, \"error\": schema_error_msg}\n\n # If no output schema provided, return parsed JSON without validation\n if not hasattr(self, \"output_schema\") or not self.output_schema or len(self.output_schema) == 0:\n return json_data\n\n # Use BaseModel validation with schema\n try:\n processed_schema = self._preprocess_schema(self.output_schema)\n output_model = build_model_from_schema(processed_schema)\n\n # Validate against the schema\n if isinstance(json_data, list):\n # Multiple objects\n validated_objects = []\n for item in json_data:\n try:\n validated_obj = output_model.model_validate(item)\n validated_objects.append(validated_obj.model_dump())\n except ValidationError as e:\n await logger.aerror(f\"Validation error for item: {e}\")\n # Include invalid items with error info\n validated_objects.append({\"data\": item, \"validation_error\": str(e)})\n return validated_objects\n\n # Single object\n try:\n validated_obj = output_model.model_validate(json_data)\n return [validated_obj.model_dump()] # Return as list for consistency\n except ValidationError as e:\n await logger.aerror(f\"Validation error: {e}\")\n return [{\"data\": json_data, \"validation_error\": str(e)}]\n\n except (TypeError, ValueError) as e:\n await logger.aerror(f\"Error building structured output: {e}\")\n # Fallback to parsed JSON without validation\n return json_data\n\n async def json_response(self) -> Data:\n \"\"\"Convert agent response to structured JSON Data output with schema validation.\"\"\"\n # Always use structured chat agent for JSON response mode for better JSON formatting\n try:\n system_components = []\n\n # 1. Agent Instructions (system_prompt)\n agent_instructions = getattr(self, \"system_prompt\", \"\") or \"\"\n if agent_instructions:\n system_components.append(f\"{agent_instructions}\")\n\n # 2. Format Instructions\n format_instructions = getattr(self, \"format_instructions\", \"\") or \"\"\n if format_instructions:\n system_components.append(f\"Format instructions: {format_instructions}\")\n\n # 3. Schema Information from BaseModel\n if hasattr(self, \"output_schema\") and self.output_schema and len(self.output_schema) > 0:\n try:\n processed_schema = self._preprocess_schema(self.output_schema)\n output_model = build_model_from_schema(processed_schema)\n schema_dict = output_model.model_json_schema()\n schema_info = (\n \"You are given some text that may include format instructions, \"\n \"explanations, or other content alongside a JSON schema.\\n\\n\"\n \"Your task:\\n\"\n \"- Extract only the JSON schema.\\n\"\n \"- Return it as valid JSON.\\n\"\n \"- Do not include format instructions, explanations, or extra text.\\n\\n\"\n \"Input:\\n\"\n f\"{json.dumps(schema_dict, indent=2)}\\n\\n\"\n \"Output (only JSON schema):\"\n )\n system_components.append(schema_info)\n except (ValidationError, ValueError, TypeError, KeyError) as e:\n await logger.aerror(f\"Could not build schema for prompt: {e}\", exc_info=True)\n\n # Combine all components\n combined_instructions = \"\\n\\n\".join(system_components) if system_components else \"\"\n llm_model, self.chat_history, self.tools = await self.get_agent_requirements()\n self.set(\n llm=llm_model,\n tools=self.tools or [],\n chat_history=self.chat_history,\n input_value=self.input_value,\n system_prompt=combined_instructions,\n )\n\n # Create and run structured chat agent\n try:\n structured_agent = self.create_agent_runnable()\n except (NotImplementedError, ValueError, TypeError) as e:\n await logger.aerror(f\"Error with structured chat agent: {e}\")\n raise\n try:\n result = await self.run_agent(structured_agent)\n except (\n ExceptionWithMessageError,\n ValueError,\n TypeError,\n RuntimeError,\n ) as e:\n await logger.aerror(f\"Error with structured agent result: {e}\")\n raise\n # Extract content from structured agent result\n if hasattr(result, \"content\"):\n content = result.content\n elif hasattr(result, \"text\"):\n content = result.text\n else:\n content = str(result)\n\n except (\n ExceptionWithMessageError,\n ValueError,\n TypeError,\n NotImplementedError,\n AttributeError,\n ) as e:\n await logger.aerror(f\"Error with structured chat agent: {e}\")\n # Fallback to regular agent\n content_str = \"No content returned from agent\"\n return Data(data={\"content\": content_str, \"error\": str(e)})\n\n # Process with structured output validation\n try:\n structured_output = await self.build_structured_output_base(content)\n\n # Handle different output formats\n if isinstance(structured_output, list) and structured_output:\n if len(structured_output) == 1:\n return Data(data=structured_output[0])\n return Data(data={\"results\": structured_output})\n if isinstance(structured_output, dict):\n return Data(data=structured_output)\n return Data(data={\"content\": content})\n\n except (ValueError, TypeError) as e:\n await logger.aerror(f\"Error in structured output processing: {e}\")\n return Data(data={\"content\": content, \"error\": str(e)})\n\n async def get_memory_data(self):\n # TODO: This is a temporary fix to avoid message duplication. We should develop a function for this.\n messages = (\n await MemoryComponent(**self.get_base_args())\n .set(\n session_id=self.graph.session_id,\n context_id=self.context_id,\n order=\"Ascending\",\n n_messages=self.n_messages,\n )\n .retrieve_messages()\n )\n return [\n message for message in messages if getattr(message, \"id\", None) != getattr(self.input_value, \"id\", None)\n ]\n\n def update_input_types(self, build_config: dotdict) -> dotdict:\n \"\"\"Update input types for all fields in build_config.\"\"\"\n for key, value in build_config.items():\n if isinstance(value, dict):\n if value.get(\"input_types\") is None:\n build_config[key][\"input_types\"] = []\n elif hasattr(value, \"input_types\") and value.input_types is None:\n value.input_types = []\n return build_config\n\n async def update_build_config(\n self,\n build_config: dotdict,\n field_value: list[dict],\n field_name: str | None = None,\n ) -> dotdict:\n # Update model options with caching (for all field changes)\n # Agents require tool calling, so filter for only tool-calling capable models\n build_config = handle_model_input_update(\n component=self,\n build_config=dict(build_config),\n field_value=field_value,\n field_name=field_name,\n cache_key_prefix=\"language_model_options_tool_calling\",\n get_options_func=lambda user_id=None: get_language_model_options(user_id=user_id, tool_calling=True),\n )\n build_config = dotdict(build_config)\n\n if field_name == \"model\":\n build_config = self.update_input_types(build_config)\n\n # Validate required keys\n default_keys = [\n \"code\",\n \"_type\",\n \"model\",\n \"tools\",\n \"input_value\",\n \"add_current_date_tool\",\n \"system_prompt\",\n \"agent_description\",\n \"max_iterations\",\n \"handle_parsing_errors\",\n \"verbose\",\n ]\n missing_keys = [key for key in default_keys if key not in build_config]\n if missing_keys:\n msg = f\"Missing required keys in build_config: {missing_keys}\"\n raise ValueError(msg)\n return dotdict({k: v.to_dict() if hasattr(v, \"to_dict\") else v for k, v in build_config.items()})\n\n async def _get_tools(self) -> list[Tool]:\n component_toolkit = get_component_toolkit()\n tools_names = self._build_tools_names()\n agent_description = self.get_tool_description()\n # TODO: Agent Description Depreciated Feature to be removed\n description = f\"{agent_description}{tools_names}\"\n\n tools = component_toolkit(component=self).get_tools(\n tool_name=\"Call_Agent\",\n tool_description=description,\n # here we do not use the shared callbacks as we are exposing the agent as a tool\n callbacks=self.get_langchain_callbacks(),\n )\n if hasattr(self, \"tools_metadata\"):\n tools = component_toolkit(component=self, metadata=self.tools_metadata).update_tools_metadata(tools=tools)\n\n return tools\n"
},
"context_id": {
"_input_type": "MessageTextInput",
@@ -1497,7 +1462,6 @@
"display_name": "Handle Parse Errors",
"dynamic": false,
"info": "Should the Agent fix errors when reading user input for better processing?",
- "input_types": [],
"list": false,
"list_add_label": "Add More",
"name": "handle_parsing_errors",
@@ -1537,14 +1501,12 @@
"type": "str",
"value": ""
},
- "is_refresh": true,
"max_iterations": {
"_input_type": "IntInput",
"advanced": true,
"display_name": "Max Iterations",
"dynamic": false,
"info": "The maximum number of attempts the agent can make to complete its task before it stops.",
- "input_types": [],
"list": false,
"list_add_label": "Add More",
"name": "max_iterations",
@@ -1565,7 +1527,6 @@
"display_name": "Max Tokens",
"dynamic": false,
"info": "Maximum number of tokens to generate. Field name varies by provider.",
- "input_types": [],
"list": false,
"list_add_label": "Add More",
"load_from_db": false,
@@ -1612,166 +1573,6 @@
"load_from_db": false,
"model_type": "language",
"name": "model",
- "options": [
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-opus-4-6",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-sonnet-4-6",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-haiku-4-5-20251001",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-opus-4-5-20251101",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-sonnet-4-5-20250929",
- "provider": "Anthropic"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.4"
- ]
- },
- "name": "gpt-5.4",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.4-mini"
- ]
- },
- "name": "gpt-5.4-mini",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.4-pro"
- ]
- },
- "name": "gpt-5.4-pro",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.3"
- ]
- },
- "name": "gpt-5.3",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.3-instant"
- ]
- },
- "name": "gpt-5.3-instant",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model"
- },
- "name": "gpt-4o",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -1805,7 +1606,6 @@
"display_name": "Number of Chat History Messages",
"dynamic": false,
"info": "Number of chat history messages to retrieve.",
- "input_types": [],
"list": false,
"list_add_label": "Add More",
"name": "n_messages",
@@ -1844,7 +1644,6 @@
"description": "Specify the name of the output field.",
"display_name": "Name",
"edit_mode": "inline",
- "formatter": "text",
"name": "name",
"type": "str"
},
@@ -1853,7 +1652,6 @@
"description": "Describe the purpose of the output field.",
"display_name": "Description",
"edit_mode": "popover",
- "formatter": "text",
"name": "description",
"type": "str"
},
@@ -1862,7 +1660,6 @@
"description": "Indicate the data type of the output field (e.g., str, int, float, bool, dict).",
"display_name": "Type",
"edit_mode": "inline",
- "formatter": "text",
"name": "type",
"options": [
"str",
@@ -1878,7 +1675,6 @@
"description": "Set to True if this output field should be a list of the specified type.",
"display_name": "As List",
"edit_mode": "inline",
- "formatter": "text",
"name": "multiple",
"type": "boolean"
}
@@ -1898,7 +1694,6 @@
"display_name": "watsonx Project ID",
"dynamic": false,
"info": "The project ID associated with the foundation model (IBM watsonx.ai only)",
- "input_types": [],
"list": false,
"list_add_label": "Add More",
"load_from_db": false,
@@ -1971,7 +1766,6 @@
"display_name": "Verbose",
"dynamic": false,
"info": "",
- "input_types": [],
"list": false,
"list_add_label": "Add More",
"name": "verbose",
@@ -2026,7 +1820,7 @@
],
"frozen": false,
"icon": "calculator",
- "last_updated": "2026-04-07T17:35:25.059Z",
+ "last_updated": "2026-04-15T17:09:49.341Z",
"legacy": false,
"lf_version": "1.9.0",
"metadata": {
@@ -2070,7 +1864,7 @@
"value": "1098eea1-6649-4e1d-aed1-b77249fb8dd0"
},
"_frontend_node_folder_id": {
- "value": "18ca84dc-4277-40a5-bbca-8bf9d7343bff"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"code": {
@@ -2211,16 +2005,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:35:25.059Z",
"legacy": false,
- "lf_version": "1.9.0",
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -2251,12 +2043,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "1098eea1-6649-4e1d-aed1-b77249fb8dd0"
- },
- "_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -2288,7 +2074,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -2306,7 +2092,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -2372,7 +2158,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -2415,7 +2201,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -2461,71 +2246,6 @@
"load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -2755,7 +2475,7 @@
],
"frozen": false,
"icon": "OpenSearch",
- "last_updated": "2026-04-07T19:13:24.610Z",
+ "last_updated": "2026-04-15T17:09:49.341Z",
"legacy": false,
"lf_version": "1.9.0",
"metadata": {
@@ -2807,7 +2527,7 @@
"value": "1098eea1-6649-4e1d-aed1-b77249fb8dd0"
},
"_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"auth_mode": {
@@ -3524,7 +3244,7 @@
"x": 982.8593504384346,
"y": 1372.6753259451405
},
- "selected": true,
+ "selected": false,
"type": "genericNode"
},
{
@@ -3561,16 +3281,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:35:25.062Z",
"legacy": false,
- "lf_version": "1.9.0",
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -3601,12 +3319,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "1098eea1-6649-4e1d-aed1-b77249fb8dd0"
- },
- "_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -3638,7 +3350,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -3656,7 +3368,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -3722,7 +3434,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -3765,7 +3477,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -3811,71 +3522,6 @@
"load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -4091,16 +3737,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:35:25.062Z",
"legacy": false,
- "lf_version": "1.9.0",
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -4131,12 +3775,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "1098eea1-6649-4e1d-aed1-b77249fb8dd0"
- },
- "_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -4168,7 +3806,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -4186,7 +3824,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -4252,7 +3890,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -4295,7 +3933,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -4341,71 +3978,6 @@
"load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -4616,14 +4188,13 @@
"frozen": false,
"icon": "prompts",
"legacy": false,
- "lf_version": "1.9.0",
"metadata": {
- "code_hash": "5b3e6730923e",
+ "code_hash": "3d3fd7b8a36f",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -4671,7 +4242,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from typing import Any\n\nfrom lfx.base.prompts.api_utils import process_prompt_template\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.inputs.input_mixin import FieldTypes\nfrom lfx.inputs.inputs import DefaultPromptField\nfrom lfx.io import BoolInput, MessageTextInput, Output, PromptInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.dotdict import dotdict\nfrom lfx.schema.message import Message\nfrom lfx.template.utils import update_template_values\nfrom lfx.utils.mustache_security import validate_mustache_template\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt Template\"\n description: str = \"Create a prompt template with dynamic variables.\"\n documentation: str = \"https://docs.langflow.org/components-prompts\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt Template\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n BoolInput(\n name=\"use_double_brackets\",\n display_name=\"Use Double Brackets\",\n value=False,\n advanced=True,\n info=\"Use {{variable}} syntax instead of {variable}.\",\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"tool_placeholder\",\n display_name=\"Tool Placeholder\",\n tool_mode=True,\n advanced=True,\n info=\"A placeholder input for tool mode.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Prompt\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:\n \"\"\"Update the template field type based on the selected mode.\"\"\"\n if field_name == \"use_double_brackets\":\n # Change the template field type based on mode\n is_mustache = field_value is True\n if is_mustache:\n build_config[\"template\"][\"type\"] = FieldTypes.MUSTACHE_PROMPT.value\n else:\n build_config[\"template\"][\"type\"] = FieldTypes.PROMPT.value\n\n # Re-process the template to update variables when mode changes\n template_value = build_config.get(\"template\", {}).get(\"value\", \"\")\n if template_value:\n # Ensure custom_fields is properly initialized\n if \"custom_fields\" not in build_config:\n build_config[\"custom_fields\"] = {}\n\n # Clean up fields from the OLD mode before processing with NEW mode\n # This ensures we don't keep fields with wrong syntax even if validation fails\n old_custom_fields = build_config[\"custom_fields\"].get(\"template\", [])\n for old_field in list(old_custom_fields):\n # Remove the field from custom_fields and template\n if old_field in old_custom_fields:\n old_custom_fields.remove(old_field)\n build_config.pop(old_field, None)\n\n # Try to process template with new mode to add new variables\n # If validation fails, at least we cleaned up old fields\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template_value)\n\n # Re-process template with new mode to add new variables\n _ = process_prompt_template(\n template=template_value,\n name=\"template\",\n custom_fields=build_config[\"custom_fields\"],\n frontend_node_template=build_config,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, we still updated the mode and cleaned old fields\n # User will see error when they try to save\n logger.debug(f\"Template validation failed during mode switch: {e}\")\n return build_config\n\n async def build_prompt(self) -> Message:\n use_double_brackets = self.use_double_brackets if hasattr(self, \"use_double_brackets\") else False\n template_format = \"mustache\" if use_double_brackets else \"f-string\"\n prompt = await Message.from_template_and_variables(template_format=template_format, **self._attributes)\n self.status = prompt.text\n return prompt\n\n def _update_template(self, frontend_node: dict):\n prompt_template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(prompt_template)\n\n custom_fields = frontend_node[\"custom_fields\"]\n frontend_node_template = frontend_node[\"template\"]\n _ = process_prompt_template(\n template=prompt_template,\n name=\"template\",\n custom_fields=custom_fields,\n frontend_node_template=frontend_node_template,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be created\n logger.debug(f\"Template validation failed in _update_template: {e}\")\n return frontend_node\n\n async def update_frontend_node(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"This function is called after the code validation is done.\"\"\"\n frontend_node = await super().update_frontend_node(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template)\n\n # Kept it duplicated for backwards compatibility\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be updated\n logger.debug(f\"Template validation failed in update_frontend_node: {e}\")\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n\n def _get_fallback_input(self, **kwargs):\n return DefaultPromptField(**kwargs)\n"
+ "value": "from typing import Any\n\nfrom lfx.base.prompts.api_utils import process_prompt_template\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.inputs.input_mixin import FieldTypes\nfrom lfx.inputs.inputs import DefaultPromptField\nfrom lfx.io import BoolInput, MessageTextInput, Output, PromptInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.dotdict import dotdict\nfrom lfx.schema.message import Message\nfrom lfx.template.utils import update_template_values\nfrom lfx.utils.mustache_security import validate_mustache_template\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt Template\"\n description: str = \"Create a prompt template with dynamic variables.\"\n documentation: str = \"https://docs.langflow.org/components-prompts\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt Template\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n BoolInput(\n name=\"use_double_brackets\",\n display_name=\"Use Double Brackets\",\n value=False,\n advanced=True,\n info=\"Use {{variable}} syntax instead of {variable}.\",\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"tool_placeholder\",\n display_name=\"Tool Placeholder\",\n tool_mode=True,\n advanced=True,\n show=False,\n info=\"A placeholder input for tool mode.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Prompt\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:\n \"\"\"Update the template field type based on the selected mode.\"\"\"\n if field_name == \"use_double_brackets\":\n # Change the template field type based on mode\n is_mustache = field_value is True\n if is_mustache:\n build_config[\"template\"][\"type\"] = FieldTypes.MUSTACHE_PROMPT.value\n else:\n build_config[\"template\"][\"type\"] = FieldTypes.PROMPT.value\n\n # Re-process the template to update variables when mode changes\n template_value = build_config.get(\"template\", {}).get(\"value\", \"\")\n if template_value:\n # Ensure custom_fields is properly initialized\n if \"custom_fields\" not in build_config:\n build_config[\"custom_fields\"] = {}\n\n # Clean up fields from the OLD mode before processing with NEW mode\n # This ensures we don't keep fields with wrong syntax even if validation fails\n old_custom_fields = build_config[\"custom_fields\"].get(\"template\", [])\n for old_field in list(old_custom_fields):\n # Remove the field from custom_fields and template\n if old_field in old_custom_fields:\n old_custom_fields.remove(old_field)\n build_config.pop(old_field, None)\n\n # Try to process template with new mode to add new variables\n # If validation fails, at least we cleaned up old fields\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template_value)\n\n # Re-process template with new mode to add new variables\n _ = process_prompt_template(\n template=template_value,\n name=\"template\",\n custom_fields=build_config[\"custom_fields\"],\n frontend_node_template=build_config,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, we still updated the mode and cleaned old fields\n # User will see error when they try to save\n logger.debug(f\"Template validation failed during mode switch: {e}\")\n return build_config\n\n async def build_prompt(self) -> Message:\n use_double_brackets = self.use_double_brackets if hasattr(self, \"use_double_brackets\") else False\n template_format = \"mustache\" if use_double_brackets else \"f-string\"\n prompt = await Message.from_template_and_variables(template_format=template_format, **self._attributes)\n self.status = prompt.text\n return prompt\n\n def _update_template(self, frontend_node: dict):\n prompt_template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(prompt_template)\n\n custom_fields = frontend_node[\"custom_fields\"]\n frontend_node_template = frontend_node[\"template\"]\n _ = process_prompt_template(\n template=prompt_template,\n name=\"template\",\n custom_fields=custom_fields,\n frontend_node_template=frontend_node_template,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be created\n logger.debug(f\"Template validation failed in _update_template: {e}\")\n return frontend_node\n\n async def update_frontend_node(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"This function is called after the code validation is done.\"\"\"\n frontend_node = await super().update_frontend_node(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template)\n\n # Kept it duplicated for backwards compatibility\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be updated\n logger.debug(f\"Template validation failed in update_frontend_node: {e}\")\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n\n def _get_fallback_input(self, **kwargs):\n return DefaultPromptField(**kwargs)\n"
},
"filter": {
"advanced": false,
@@ -4754,7 +4325,7 @@
"override_skip": false,
"placeholder": "",
"required": false,
- "show": true,
+ "show": false,
"title_case": false,
"tool_mode": true,
"trace_as_input": true,
@@ -4959,9 +4530,9 @@
}
],
"viewport": {
- "x": -169.68076736399166,
- "y": -734.2500559151576,
- "zoom": 0.6012722580995798
+ "x": -49.22528051700942,
+ "y": -498.84623680779896,
+ "zoom": 0.47881539339214985
}
},
"description": "OpenRAG OpenSearch Agent",
diff --git a/flows/openrag_nudges.json b/flows/openrag_nudges.json
index dfd3323ed..5ce1e012f 100644
--- a/flows/openrag_nudges.json
+++ b/flows/openrag_nudges.json
@@ -292,12 +292,12 @@
"icon": "prompts",
"legacy": false,
"metadata": {
- "code_hash": "5b3e6730923e",
+ "code_hash": "3d3fd7b8a36f",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -345,7 +345,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from typing import Any\n\nfrom lfx.base.prompts.api_utils import process_prompt_template\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.inputs.input_mixin import FieldTypes\nfrom lfx.inputs.inputs import DefaultPromptField\nfrom lfx.io import BoolInput, MessageTextInput, Output, PromptInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.dotdict import dotdict\nfrom lfx.schema.message import Message\nfrom lfx.template.utils import update_template_values\nfrom lfx.utils.mustache_security import validate_mustache_template\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt Template\"\n description: str = \"Create a prompt template with dynamic variables.\"\n documentation: str = \"https://docs.langflow.org/components-prompts\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt Template\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n BoolInput(\n name=\"use_double_brackets\",\n display_name=\"Use Double Brackets\",\n value=False,\n advanced=True,\n info=\"Use {{variable}} syntax instead of {variable}.\",\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"tool_placeholder\",\n display_name=\"Tool Placeholder\",\n tool_mode=True,\n advanced=True,\n info=\"A placeholder input for tool mode.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Prompt\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:\n \"\"\"Update the template field type based on the selected mode.\"\"\"\n if field_name == \"use_double_brackets\":\n # Change the template field type based on mode\n is_mustache = field_value is True\n if is_mustache:\n build_config[\"template\"][\"type\"] = FieldTypes.MUSTACHE_PROMPT.value\n else:\n build_config[\"template\"][\"type\"] = FieldTypes.PROMPT.value\n\n # Re-process the template to update variables when mode changes\n template_value = build_config.get(\"template\", {}).get(\"value\", \"\")\n if template_value:\n # Ensure custom_fields is properly initialized\n if \"custom_fields\" not in build_config:\n build_config[\"custom_fields\"] = {}\n\n # Clean up fields from the OLD mode before processing with NEW mode\n # This ensures we don't keep fields with wrong syntax even if validation fails\n old_custom_fields = build_config[\"custom_fields\"].get(\"template\", [])\n for old_field in list(old_custom_fields):\n # Remove the field from custom_fields and template\n if old_field in old_custom_fields:\n old_custom_fields.remove(old_field)\n build_config.pop(old_field, None)\n\n # Try to process template with new mode to add new variables\n # If validation fails, at least we cleaned up old fields\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template_value)\n\n # Re-process template with new mode to add new variables\n _ = process_prompt_template(\n template=template_value,\n name=\"template\",\n custom_fields=build_config[\"custom_fields\"],\n frontend_node_template=build_config,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, we still updated the mode and cleaned old fields\n # User will see error when they try to save\n logger.debug(f\"Template validation failed during mode switch: {e}\")\n return build_config\n\n async def build_prompt(self) -> Message:\n use_double_brackets = self.use_double_brackets if hasattr(self, \"use_double_brackets\") else False\n template_format = \"mustache\" if use_double_brackets else \"f-string\"\n prompt = await Message.from_template_and_variables(template_format=template_format, **self._attributes)\n self.status = prompt.text\n return prompt\n\n def _update_template(self, frontend_node: dict):\n prompt_template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(prompt_template)\n\n custom_fields = frontend_node[\"custom_fields\"]\n frontend_node_template = frontend_node[\"template\"]\n _ = process_prompt_template(\n template=prompt_template,\n name=\"template\",\n custom_fields=custom_fields,\n frontend_node_template=frontend_node_template,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be created\n logger.debug(f\"Template validation failed in _update_template: {e}\")\n return frontend_node\n\n async def update_frontend_node(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"This function is called after the code validation is done.\"\"\"\n frontend_node = await super().update_frontend_node(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template)\n\n # Kept it duplicated for backwards compatibility\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be updated\n logger.debug(f\"Template validation failed in update_frontend_node: {e}\")\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n\n def _get_fallback_input(self, **kwargs):\n return DefaultPromptField(**kwargs)\n"
+ "value": "from typing import Any\n\nfrom lfx.base.prompts.api_utils import process_prompt_template\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.inputs.input_mixin import FieldTypes\nfrom lfx.inputs.inputs import DefaultPromptField\nfrom lfx.io import BoolInput, MessageTextInput, Output, PromptInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.dotdict import dotdict\nfrom lfx.schema.message import Message\nfrom lfx.template.utils import update_template_values\nfrom lfx.utils.mustache_security import validate_mustache_template\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt Template\"\n description: str = \"Create a prompt template with dynamic variables.\"\n documentation: str = \"https://docs.langflow.org/components-prompts\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt Template\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n BoolInput(\n name=\"use_double_brackets\",\n display_name=\"Use Double Brackets\",\n value=False,\n advanced=True,\n info=\"Use {{variable}} syntax instead of {variable}.\",\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"tool_placeholder\",\n display_name=\"Tool Placeholder\",\n tool_mode=True,\n advanced=True,\n show=False,\n info=\"A placeholder input for tool mode.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Prompt\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:\n \"\"\"Update the template field type based on the selected mode.\"\"\"\n if field_name == \"use_double_brackets\":\n # Change the template field type based on mode\n is_mustache = field_value is True\n if is_mustache:\n build_config[\"template\"][\"type\"] = FieldTypes.MUSTACHE_PROMPT.value\n else:\n build_config[\"template\"][\"type\"] = FieldTypes.PROMPT.value\n\n # Re-process the template to update variables when mode changes\n template_value = build_config.get(\"template\", {}).get(\"value\", \"\")\n if template_value:\n # Ensure custom_fields is properly initialized\n if \"custom_fields\" not in build_config:\n build_config[\"custom_fields\"] = {}\n\n # Clean up fields from the OLD mode before processing with NEW mode\n # This ensures we don't keep fields with wrong syntax even if validation fails\n old_custom_fields = build_config[\"custom_fields\"].get(\"template\", [])\n for old_field in list(old_custom_fields):\n # Remove the field from custom_fields and template\n if old_field in old_custom_fields:\n old_custom_fields.remove(old_field)\n build_config.pop(old_field, None)\n\n # Try to process template with new mode to add new variables\n # If validation fails, at least we cleaned up old fields\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template_value)\n\n # Re-process template with new mode to add new variables\n _ = process_prompt_template(\n template=template_value,\n name=\"template\",\n custom_fields=build_config[\"custom_fields\"],\n frontend_node_template=build_config,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, we still updated the mode and cleaned old fields\n # User will see error when they try to save\n logger.debug(f\"Template validation failed during mode switch: {e}\")\n return build_config\n\n async def build_prompt(self) -> Message:\n use_double_brackets = self.use_double_brackets if hasattr(self, \"use_double_brackets\") else False\n template_format = \"mustache\" if use_double_brackets else \"f-string\"\n prompt = await Message.from_template_and_variables(template_format=template_format, **self._attributes)\n self.status = prompt.text\n return prompt\n\n def _update_template(self, frontend_node: dict):\n prompt_template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(prompt_template)\n\n custom_fields = frontend_node[\"custom_fields\"]\n frontend_node_template = frontend_node[\"template\"]\n _ = process_prompt_template(\n template=prompt_template,\n name=\"template\",\n custom_fields=custom_fields,\n frontend_node_template=frontend_node_template,\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be created\n logger.debug(f\"Template validation failed in _update_template: {e}\")\n return frontend_node\n\n async def update_frontend_node(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"This function is called after the code validation is done.\"\"\"\n frontend_node = await super().update_frontend_node(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n use_double_brackets = frontend_node[\"template\"].get(\"use_double_brackets\", {}).get(\"value\", False)\n is_mustache = use_double_brackets is True\n\n try:\n # Validate mustache templates for security\n if is_mustache:\n validate_mustache_template(template)\n\n # Kept it duplicated for backwards compatibility\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n is_mustache=is_mustache,\n )\n except ValueError as e:\n # If validation fails, don't add variables but allow component to be updated\n logger.debug(f\"Template validation failed in update_frontend_node: {e}\")\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n\n def _get_fallback_input(self, **kwargs):\n return DefaultPromptField(**kwargs)\n"
},
"docs": {
"advanced": false,
@@ -428,7 +428,7 @@
"override_skip": false,
"placeholder": "",
"required": false,
- "show": true,
+ "show": false,
"title_case": false,
"tool_mode": true,
"trace_as_input": true,
@@ -1110,15 +1110,14 @@
],
"frozen": false,
"icon": "brain-circuit",
- "last_updated": "2026-04-07T17:40:34.187Z",
"legacy": false,
"metadata": {
- "code_hash": "5572546e82aa",
+ "code_hash": "1d46e80acad2",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -1173,19 +1172,13 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "ebc01d31-1976-46ce-a385-b0240327226c"
- },
- "_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"api_key": {
"_input_type": "SecretStrInput",
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -1203,7 +1196,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -1249,7 +1242,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.models.model import LCModelComponent\nfrom lfx.base.models.unified_models import (\n get_llm,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing.constants import LanguageModel\nfrom lfx.field_typing.range_spec import RangeSpec\nfrom lfx.inputs.inputs import BoolInput, DropdownInput, StrInput\nfrom lfx.io import IntInput, MessageInput, ModelInput, MultilineInput, SecretStrInput, SliderInput\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass LanguageModelComponent(LCModelComponent):\n display_name = \"Language Model\"\n description = \"Runs a language model given a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-models\"\n icon = \"brain-circuit\"\n category = \"models\"\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Language Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n required=False,\n show=True,\n real_time_refresh=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n StrInput(\n name=\"project_id\",\n display_name=\"watsonx Project ID\",\n info=\"The project ID associated with the foundation model (IBM watsonx.ai only)\",\n show=False,\n required=False,\n ),\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n MessageInput(\n name=\"input_value\",\n display_name=\"Input\",\n info=\"The input text to send to the model\",\n ),\n MultilineInput(\n name=\"system_message\",\n display_name=\"System Message\",\n info=\"A system message that helps set the behavior of the assistant\",\n advanced=False,\n ),\n BoolInput(\n name=\"stream\",\n display_name=\"Stream\",\n info=\"Whether to stream the response\",\n value=False,\n advanced=True,\n ),\n SliderInput(\n name=\"temperature\",\n display_name=\"Temperature\",\n value=0.1,\n info=\"Controls randomness in responses\",\n range_spec=RangeSpec(min=0, max=1, step=0.01),\n advanced=True,\n ),\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n info=\"Maximum number of tokens to generate. Field name varies by provider.\",\n advanced=True,\n range_spec=RangeSpec(min=1, max=128000, step=1, step_type=\"int\"),\n ),\n ]\n\n def build_model(self) -> LanguageModel:\n return get_llm(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n temperature=self.temperature,\n stream=self.stream,\n max_tokens=getattr(self, \"max_tokens\", None),\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(self, build_config, field_value, field_name)\n"
+ "value": "from lfx.base.models.model import LCModelComponent\nfrom lfx.base.models.unified_models import (\n get_llm,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing.constants import LanguageModel\nfrom lfx.field_typing.range_spec import RangeSpec\nfrom lfx.inputs.inputs import BoolInput, DropdownInput, StrInput\nfrom lfx.io import IntInput, MessageInput, ModelInput, MultilineInput, SecretStrInput, SliderInput\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass LanguageModelComponent(LCModelComponent):\n display_name = \"Language Model\"\n description = \"Runs a language model given a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-models\"\n icon = \"brain-circuit\"\n category = \"models\"\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Language Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n required=False,\n show=True,\n real_time_refresh=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n StrInput(\n name=\"project_id\",\n display_name=\"watsonx Project ID\",\n info=\"The project ID associated with the foundation model (IBM watsonx.ai only)\",\n show=False,\n required=False,\n ),\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n MessageInput(\n name=\"input_value\",\n display_name=\"Input\",\n info=\"The input text to send to the model\",\n ),\n MultilineInput(\n name=\"system_message\",\n display_name=\"System Message\",\n info=\"A system message that helps set the behavior of the assistant\",\n advanced=False,\n ),\n BoolInput(\n name=\"stream\",\n display_name=\"Stream\",\n info=\"Whether to stream the response\",\n value=False,\n advanced=True,\n ),\n SliderInput(\n name=\"temperature\",\n display_name=\"Temperature\",\n value=0.1,\n info=\"Controls randomness in responses\",\n range_spec=RangeSpec(min=0, max=1, step=0.01),\n advanced=True,\n ),\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n info=\"Maximum number of tokens to generate. Field name varies by provider.\",\n advanced=True,\n range_spec=RangeSpec(min=1, max=128000, step=1, step_type=\"int\"),\n ),\n ]\n\n def build_model(self) -> LanguageModel:\n return get_llm(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n temperature=self.temperature,\n stream=self.stream,\n max_tokens=getattr(self, \"max_tokens\", None),\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(self, build_config, field_value, field_name)\n"
},
"input_value": {
"_input_type": "MessageInput",
@@ -1276,7 +1269,6 @@
"type": "str",
"value": ""
},
- "is_refresh": true,
"max_tokens": {
"_input_type": "IntInput",
"advanced": true,
@@ -1328,166 +1320,6 @@
"load_from_db": false,
"model_type": "language",
"name": "model",
- "options": [
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-opus-4-6",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-sonnet-4-6",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-haiku-4-5-20251001",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-opus-4-5-20251101",
- "provider": "Anthropic"
- },
- {
- "category": "Anthropic",
- "icon": "Anthropic",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatAnthropic",
- "model_name_param": "model"
- },
- "name": "claude-sonnet-4-5-20250929",
- "provider": "Anthropic"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.4"
- ]
- },
- "name": "gpt-5.4",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.4-mini"
- ]
- },
- "name": "gpt-5.4-mini",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.4-pro"
- ]
- },
- "name": "gpt-5.4-pro",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.3"
- ]
- },
- "name": "gpt-5.3",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model",
- "reasoning_models": [
- "gpt-5.3-instant"
- ]
- },
- "name": "gpt-5.3-instant",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "api_key_param": "api_key",
- "context_length": 128000,
- "max_tokens_field_name": "max_tokens",
- "model_class": "ChatOpenAI",
- "model_name_param": "model"
- },
- "name": "gpt-4o",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -1691,15 +1523,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:40:34.188Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -1730,12 +1561,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "ebc01d31-1976-46ce-a385-b0240327226c"
- },
- "_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -1767,7 +1592,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -1785,7 +1610,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -1851,7 +1676,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -1894,7 +1719,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -1940,71 +1764,6 @@
"load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -2993,15 +2752,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:40:34.188Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -3032,12 +2790,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "ebc01d31-1976-46ce-a385-b0240327226c"
- },
- "_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -3069,7 +2821,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -3087,7 +2839,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -3153,7 +2905,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -3196,7 +2948,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -3242,71 +2993,6 @@
"load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -3522,15 +3208,14 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:40:34.189Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
@@ -3561,12 +3246,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "ebc01d31-1976-46ce-a385-b0240327226c"
- },
- "_frontend_node_folder_id": {
- "value": "3832f035-bbe8-40c4-ba61-8f760b613bdb"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -3598,7 +3277,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -3616,7 +3295,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -3682,7 +3361,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -3725,7 +3404,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -3771,71 +3449,6 @@
"load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -4375,7 +3988,7 @@
],
"viewport": {
"x": 219.98802613623758,
- "y": -149.42019049039925,
+ "y": -187.42019049039925,
"zoom": 0.4738353067326915
}
},
diff --git a/flows/openrag_url_mcp.json b/flows/openrag_url_mcp.json
index a93e1288a..8bbb772f2 100644
--- a/flows/openrag_url_mcp.json
+++ b/flows/openrag_url_mcp.json
@@ -4354,7 +4354,7 @@
],
"frozen": false,
"icon": "braces",
- "last_updated": "2026-04-09T14:18:34.963Z",
+ "last_updated": "2026-04-15T17:09:16.808Z",
"legacy": false,
"lf_version": "1.8.0",
"metadata": {},
@@ -4404,7 +4404,7 @@
"value": "72c3d17c-2dac-4a73-b48a-6518473d7830"
},
"_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
+ "value": "e37c04f4-bd18-4083-8f6f-6ee172319d91"
},
"_type": "Component",
"code": {
@@ -6073,6 +6073,8 @@
},
{
"data": {
+ "description": "Generate embeddings using a specified provider.",
+ "display_name": "Embedding Model",
"id": "EmbeddingModel-FrWjX",
"node": {
"base_classes": [
@@ -6103,20 +6105,19 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:01:59.867Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
},
- "module": "lfx.components.models_and_agents.embedding_model.EmbeddingModelComponent"
+ "module": "custom_components.embedding_model"
},
"minimized": false,
"output_types": [],
@@ -6142,12 +6143,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "72c3d17c-2dac-4a73-b48a-6518473d7830"
- },
- "_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -6179,7 +6174,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -6197,7 +6192,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -6263,7 +6258,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -6305,7 +6300,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -6348,73 +6342,9 @@
],
"list": false,
"list_add_label": "Add More",
+ "load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -6598,6 +6528,8 @@
},
{
"data": {
+ "description": "Generate embeddings using a specified provider.",
+ "display_name": "Embedding Model",
"id": "EmbeddingModel-cBonL",
"node": {
"base_classes": [
@@ -6628,20 +6560,19 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:02:02.017Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
},
- "module": "lfx.components.models_and_agents.embedding_model.EmbeddingModelComponent"
+ "module": "custom_components.embedding_model"
},
"minimized": false,
"output_types": [],
@@ -6667,12 +6598,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "72c3d17c-2dac-4a73-b48a-6518473d7830"
- },
- "_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -6704,7 +6629,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -6722,7 +6647,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -6788,7 +6713,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -6830,7 +6755,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -6873,73 +6797,9 @@
],
"list": false,
"list_add_label": "Add More",
+ "load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -7123,6 +6983,8 @@
},
{
"data": {
+ "description": "Generate embeddings using a specified provider.",
+ "display_name": "Embedding Model",
"id": "EmbeddingModel-qb5S3",
"node": {
"base_classes": [
@@ -7153,20 +7015,19 @@
],
"frozen": false,
"icon": "binary",
- "last_updated": "2026-04-07T17:02:02.874Z",
"legacy": false,
"metadata": {
- "code_hash": "965b8431bfd8",
+ "code_hash": "59c007553b38",
"dependencies": {
"dependencies": [
{
"name": "lfx",
- "version": null
+ "version": "0.4.0"
}
],
"total_dependencies": 1
},
- "module": "lfx.components.models_and_agents.embedding_model.EmbeddingModelComponent"
+ "module": "custom_components.embedding_model"
},
"minimized": false,
"output_types": [],
@@ -7192,12 +7053,6 @@
],
"pinned": false,
"template": {
- "_frontend_node_flow_id": {
- "value": "72c3d17c-2dac-4a73-b48a-6518473d7830"
- },
- "_frontend_node_folder_id": {
- "value": "d89df57e-0640-47c5-973b-37849ac97186"
- },
"_type": "Component",
"api_base": {
"_input_type": "MessageTextInput",
@@ -7229,7 +7084,7 @@
"advanced": true,
"display_name": "API Key",
"dynamic": false,
- "info": "Falls back to OPENAI_API_KEY environment variable",
+ "info": "Overrides global provider settings. Leave blank to use your pre-configured API Key.",
"input_types": [],
"load_from_db": true,
"name": "api_key",
@@ -7247,7 +7102,7 @@
"base_url_ibm_watsonx": {
"_input_type": "DropdownInput",
"advanced": false,
- "combobox": false,
+ "combobox": true,
"dialog_inputs": {},
"display_name": "watsonx API Endpoint",
"dynamic": false,
@@ -7313,7 +7168,7 @@
"show": true,
"title_case": false,
"type": "code",
- "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
+ "value": "from lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.unified_models import (\n get_embedding_model_options,\n get_embeddings,\n handle_model_input_update,\n)\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n BoolInput,\n DictInput,\n DropdownInput,\n FloatInput,\n IntInput,\n MessageTextInput,\n ModelInput,\n SecretStrInput,\n StrInput,\n)\n\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n display_name = \"Embedding Model\"\n description = \"Generate embeddings using a specified provider.\"\n documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n icon = \"binary\"\n name = \"EmbeddingModel\"\n category = \"models\"\n\n def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):\n \"\"\"Dynamically update build config with user-filtered model options.\"\"\"\n return handle_model_input_update(\n self,\n dict(build_config),\n field_value,\n field_name,\n cache_key_prefix=\"embedding_model_options\",\n get_options_func=get_embedding_model_options,\n )\n\n inputs = [\n ModelInput(\n name=\"model\",\n display_name=\"Embedding Model\",\n info=\"Select your model provider\",\n real_time_refresh=True,\n required=True,\n model_type=\"embedding\",\n input_types=[\"Embeddings\"], # Override default to accept Embeddings instead of LanguageModel\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"API Key\",\n info=\"Overrides global provider settings. Leave blank to use your pre-configured API Key.\",\n real_time_refresh=True,\n advanced=True,\n ),\n MessageTextInput(\n name=\"api_base\",\n display_name=\"API Base URL\",\n info=\"Base URL for the API. Leave empty for default.\",\n advanced=True,\n ),\n # Watson-specific inputs\n DropdownInput(\n name=\"base_url_ibm_watsonx\",\n display_name=\"watsonx API Endpoint\",\n info=\"The base URL of the API (IBM watsonx.ai only)\",\n options=IBM_WATSONX_URLS,\n value=IBM_WATSONX_URLS[0],\n combobox=True,\n show=False,\n real_time_refresh=True,\n ),\n MessageTextInput(\n name=\"project_id\",\n display_name=\"Project ID\",\n info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n show=False,\n ),\n # Ollama-specific input\n StrInput(\n name=\"ollama_base_url\",\n display_name=\"Ollama API URL\",\n info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n value=DEFAULT_OLLAMA_URL,\n show=False,\n real_time_refresh=True,\n ),\n IntInput(\n name=\"dimensions\",\n display_name=\"Dimensions\",\n info=\"The number of dimensions the resulting output embeddings should have. \"\n \"Only supported by certain models.\",\n advanced=True,\n ),\n IntInput(\n name=\"chunk_size\",\n display_name=\"Chunk Size\",\n advanced=True,\n value=1000,\n ),\n FloatInput(\n name=\"request_timeout\",\n display_name=\"Request Timeout\",\n advanced=True,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n advanced=True,\n value=3,\n ),\n BoolInput(\n name=\"show_progress_bar\",\n display_name=\"Show Progress Bar\",\n advanced=True,\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=(\n \"Additional keyword arguments to pass to the model. Only used by providers that support this parameter \"\n \"(e.g. OpenAI, Google Generative AI). \"\n \"Ignored for providers that do not include it in their parameter mapping.\"\n ),\n ),\n IntInput(\n name=\"truncate_input_tokens\",\n display_name=\"Truncate Input Tokens\",\n advanced=True,\n value=200,\n show=False,\n ),\n BoolInput(\n name=\"input_text\",\n display_name=\"Include the original text in the output\",\n value=True,\n advanced=True,\n show=False,\n ),\n ]\n\n def build_embeddings(self) -> Embeddings:\n \"\"\"Build and return an embeddings instance based on the selected model.\"\"\"\n return get_embeddings(\n model=self.model,\n user_id=self.user_id,\n api_key=self.api_key,\n api_base=self.api_base,\n dimensions=self.dimensions,\n chunk_size=self.chunk_size,\n request_timeout=self.request_timeout,\n max_retries=self.max_retries,\n show_progress_bar=self.show_progress_bar,\n model_kwargs=self.model_kwargs,\n watsonx_url=getattr(self, \"base_url_ibm_watsonx\", None),\n watsonx_project_id=getattr(self, \"project_id\", None),\n watsonx_truncate_input_tokens=getattr(self, \"truncate_input_tokens\", None),\n watsonx_input_text=getattr(self, \"input_text\", None),\n ollama_base_url=getattr(self, \"ollama_base_url\", None),\n )\n"
},
"dimensions": {
"_input_type": "IntInput",
@@ -7355,7 +7210,6 @@
"type": "bool",
"value": true
},
- "is_refresh": true,
"max_retries": {
"_input_type": "IntInput",
"advanced": true,
@@ -7398,73 +7252,9 @@
],
"list": false,
"list_add_label": "Add More",
+ "load_from_db": false,
"model_type": "embedding",
"name": "model",
- "options": [
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-small",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-3-large",
- "provider": "OpenAI"
- },
- {
- "category": "OpenAI",
- "icon": "OpenAI",
- "metadata": {
- "embedding_class": "OpenAIEmbeddings",
- "model_type": "embeddings",
- "param_mapping": {
- "api_base": "base_url",
- "api_key": "api_key",
- "chunk_size": "chunk_size",
- "dimensions": "dimensions",
- "max_retries": "max_retries",
- "model": "model",
- "model_kwargs": "model_kwargs",
- "request_timeout": "timeout",
- "show_progress_bar": "show_progress_bar"
- }
- },
- "name": "text-embedding-ada-002",
- "provider": "OpenAI"
- }
- ],
"override_skip": false,
"placeholder": "Setup Provider",
"real_time_refresh": true,
@@ -7649,7 +7439,7 @@
],
"viewport": {
"x": 64.9552082060377,
- "y": -83.58254357131239,
+ "y": -121.58254357131239,
"zoom": 0.34893413159301545
}
},
@@ -7657,9 +7447,9 @@
"endpoint_name": null,
"id": "72c3d17c-2dac-4a73-b48a-6518473d7830",
"is_component": false,
- "last_tested_version": "1.9.0.dev38",
- "mcp_enabled": true,
+ "last_tested_version": "1.9.0",
"locked": true,
+ "mcp_enabled": true,
"name": "OpenSearch URL Ingestion Flow",
"tags": [
"openai",