diff --git a/src/backend/langflow/components/prompts/Prompt.py b/src/backend/langflow/components/prompts/Prompt.py index 2ca7eb71c..934cfddf5 100644 --- a/src/backend/langflow/components/prompts/Prompt.py +++ b/src/backend/langflow/components/prompts/Prompt.py @@ -19,8 +19,15 @@ class PromptComponent(CustomComponent): template: Prompt, **kwargs, ) -> Text: + prompt_template = PromptTemplate.from_template(template) + attributes_to_check = ["text", "page_content"] + for key, value in kwargs.items(): + for attribute in attributes_to_check: + if hasattr(value, attribute): + kwargs[key] = getattr(value, attribute) + try: formated_prompt = prompt_template.format(**kwargs) except Exception as exc: