diff --git a/src/backend/base/langflow/components/langchain_utilities/langchain_hub.py b/src/backend/base/langflow/components/langchain_utilities/langchain_hub.py index d9df71972..623d0f19c 100644 --- a/src/backend/base/langflow/components/langchain_utilities/langchain_hub.py +++ b/src/backend/base/langflow/components/langchain_utilities/langchain_hub.py @@ -99,9 +99,11 @@ class LangChainHubPromptComponent(Component): template = self._fetch_langchain_hub_template() # Get the parameters from the attributes - original_params = {k.removeprefix("param_"): v for k, v in self._attributes.items()} + params_dict = {param: getattr(self, "param_" + param, f"{{{param}}}") for param in template.input_variables} + original_params = {k: v.text if hasattr(v, "text") else v for k, v in params_dict.items() if v is not None} prompt_value = template.invoke(original_params) + # Update the template with the new value original_params["template"] = prompt_value.to_string() # Now pass the filtered attributes to the function