Commit Graph

16 Commits (main)

Author SHA1 Message Date
Ankush Gola bc7e56e8df
Add asyncio support for LLM (OpenAI), Chain (LLMChain, LLMMathChain), and Agent (#841)
Supporting asyncio in langchain primitives allows for users to run them
concurrently and creates more seamless integration with
asyncio-supported frameworks (FastAPI, etc.)

Summary of changes:

**LLM**
* Add `agenerate` and `_agenerate`
* Implement in OpenAI by leveraging `client.Completions.acreate`

**Chain**
* Add `arun`, `acall`, `_acall`
* Implement them in `LLMChain` and `LLMMathChain` for now

**Agent**
* Refactor and leverage async chain and llm methods
* Add ability for `Tools` to contain async coroutine
* Implement async SerpaPI `arun`

Create demo notebook.

Open questions:
* Should all the async stuff go in separate classes? I've seen both
patterns (keeping the same class and having async and sync methods vs.
having class separation)
1 year ago
Samantha Whitmore be7de427ca
Serialize all the chains! (#761)
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
1 year ago
Harrison Chase cbc146720b
verbose flag (#683) 1 year ago
Harrison Chase 9f9afbb6a8
add custom prompt for LLMMathChain and SQLDatabase chain (#605) 1 year ago
Harrison Chase 9e04c34e20
Add BaseCallbackHandler and CallbackManager (#478)
Co-authored-by: Ankush Gola <9536492+agola11@users.noreply.github.com>
1 year ago
Harrison Chase c65efd2986
fix llm math prompt (#466)
basically, it didnt realize that the question was over after the input
and would some times hallucinate more input
1 year ago
Harrison Chase 3474f39e21
Harrison/improve cache (#368)
make it so everything goes through generate, which removes the need for
two types of caches
2 years ago
Harrison Chase f5c665a544
combine python files (#256) 2 years ago
Harrison Chase 9481a23314
stop using chained input except in agent (#249) 2 years ago
Harrison Chase c02eb199b6
add few shot example (#148) 2 years ago
Harrison Chase f23b3ceb49
consolidate run functions (#126)
consolidating logic for when a chain is able to run with single input
text, single output text

open to feedback on naming, logic, usefulness
2 years ago
Samantha Whitmore a5b61d59e1
Refactor prompts into module, add example generation utils (#64) 2 years ago
Harrison Chase f772934108
improve logging (#66) 2 years ago
Harrison Chase 4cc18d6c2a
Harrison/pretty print (#57)
make stuff look nice
2 years ago
Harrison Chase 5621ca7b07
Harrison/more documentation (#19) 2 years ago
Harrison Chase 18aeb72012 initial commit 2 years ago