Async API for Chain β€” πŸ¦œπŸ”— LangChain 0.0.142 thumbnail
Async API for Chain β€” πŸ¦œπŸ”— LangChain 0.0.142
python.langchain.com
Async API for Chain LangChain provides async support for Chains by leveraging the asyncio library. Async methods are currently supported in LLMChain (through arun, apredict, acall) and LLMMathChain (through arun and acall), ChatVectorDBChain, and QA chains. Async support for other chains is on the
1 Users
0 Comments
5 Highlights
5 Notes

Top Highlights

  • Async API for Chain
  • LangChain provides async support for Chains by leveraging the asyncio library. Async methods are currently supported in LLMChain (through arun, apredict, acall) and LLMMathChain (through arun and acall), ChatVectorDBChain, and QA chains. Async support for other chains is on the roadmap.
  • async def async_generate(chain): resp = await chain.arun(product="toothpaste") print(resp)
  • chain = LLMChain(llm=llm, prompt=prompt) tasks = [async_generate(chain) for _ in range(5)] await asyncio.gather(*tasks)

Ready to highlight and find good content?

Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.