I’m trying to create a process where I can break down a user query into multiple searchable queries using LLMs and then fetch the results online. I’ve set up two chains for extracting information and searching, but encountered a KeyError: 'analysis'
during execution.
Here’s the relevant code snippet::
search_tool = DuckDuckGoSearchRun()
extract_chain = (
extract_prompt
| llm
| StrOutputParser()
)
search_chain = (
search_prompt
| llm
| StrOutputParser()
)
chain = {"analysis" : extract_chain} | {"search_results": lambda x: search_tool.run(x["analysis"])} | search_chain
What could be the cause of this error?
You need to sign in to view this answers