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