使用LangChain的ainvoke异步调用链时出现错误的问题求助
使用LangChain的ainvoke异步调用链时出现错误的问题求助
我正在写一个异步函数,想结合LangChain的ainvoke方法来调用我的链,但运行时碰到了报错,想请教大家怎么解决。
我的代码如下:
async def get_result(template, user_question): prompt = ChatPromptTemplate.from_template(template) model = mixtral_llm sql_response = ( RunnablePassthrough.assign(schema=get_schema) | prompt | model.bind(stop=["Question"]) | StrOutputParser() ) sql_query = await sql_response.ainvoke({"question":user_question})
收到的错误信息:
sql_query = await sql_response.ainvoke({"question":user_question}) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain_core/runnables/base.py", line 2536, in ainvoke input = await step.ainvoke( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain_core/runnables/base.py", line 4537, in ainvoke return await self.bo...
看起来是链的异步调用环节出了问题,有没有大佬能帮我排查下问题所在呀?
备注:内容来源于stack exchange,提问作者currently_into_ai
相关产品推荐
相关产品推荐

