diff --git a/src/backend/langflow/graph/vertex/types.py b/src/backend/langflow/graph/vertex/types.py index b7ac17983..9a2dc21c5 100644 --- a/src/backend/langflow/graph/vertex/types.py +++ b/src/backend/langflow/graph/vertex/types.py @@ -226,7 +226,12 @@ class PromptVertex(Vertex): # so the prompt format doesn't break artifacts.pop("handle_keys", None) try: - template = self._built_object.template + if not hasattr(self._built_object, "template") and hasattr( + self._built_object, "prompt" + ): + template = self._built_object.prompt.template + else: + template = self._built_object.template for key, value in artifacts.items(): if value: replace_key = "{" + key + "}" diff --git a/src/backend/langflow/interface/initialize/utils.py b/src/backend/langflow/interface/initialize/utils.py index 976d8906c..ceb8a53a1 100644 --- a/src/backend/langflow/interface/initialize/utils.py +++ b/src/backend/langflow/interface/initialize/utils.py @@ -51,7 +51,9 @@ def handle_partial_variables(prompt, format_kwargs: Dict): } # Remove handle_keys otherwise LangChain raises an error partial_variables.pop("handle_keys", None) - return prompt.partial(**partial_variables) + if partial_variables and hasattr(prompt, "partial"): + return prompt.partial(**partial_variables) + return prompt def handle_variable(params: Dict, input_variable: str, format_kwargs: Dict):