🐛 fix(prompt_runner.py): fix issue with accessing result content when invoking chain with an empty dict input
This commit is contained in:
parent
c5b0f6a7f1
commit
929d51ea61
1 changed files with 4 additions and 2 deletions
|
|
@ -25,7 +25,9 @@ class PromptRunner(CustomComponent):
|
||||||
prompt: PromptTemplate,
|
prompt: PromptTemplate,
|
||||||
) -> Document:
|
) -> Document:
|
||||||
chain = prompt | llm
|
chain = prompt | llm
|
||||||
result = chain.invoke()
|
# The input is an empty dict because the prompt is already filled
|
||||||
result = result[chain.output_key]
|
result = chain.invoke({})
|
||||||
|
if hasattr(result, "content"):
|
||||||
|
result = result.content
|
||||||
self.repr_value = result
|
self.repr_value = result
|
||||||
return Document(page_content=str(result))
|
return Document(page_content=str(result))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue