Relative Content

Tag Archive for python-asynciolangchain

How to activate async inference for class: load_qa_chain + map_reduce in Langchain

from langchain.chains.question_answering import load_qa_chain chain=load_qa_chain( llm=llm, #reduce_llm=llm, chain_type=”map_reduce”, question_prompt=question_prompt, combine_prompt=combine_prompt) query = “What is …….?” #Running function without in-built asynchonous method: res_a = chain.invoke({“input_documents”:documents,”question”:query}, return_only_outputs=False, verbose=True) #Running function with in-built asynchonous method: res_a = await chain.ainvoke({“input_documents”:documents,”question”:query}, return_only_outputs=True) There is no difference in inference time when running this on AWS sagemaker notebook with GPU. Is there […]