Commit Graph

27 Commits

Author SHA1 Message Date
Ankush Gola d3ec00b566 Callbacks Refactor [base] (#3256)
Co-authored-by: Nuno Campos <nuno@boringbits.io>
Co-authored-by: Davis Chase <130488702+dev2049@users.noreply.github.com>
Co-authored-by: Zander Chase <130414180+vowelparrot@users.noreply.github.com>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-04-30 11:14:09 -07:00
Harrison Chase 5c907d9998 Harrison/base agent without docs (#2166) 2023-03-29 22:11:25 -07:00
Harrison Chase 7bec461782 Harrison/memory refactor (#1478)
moves memory to own module, factors out common stuff
2023-03-07 07:59:37 -08:00
Harrison Chase 63a5614d23 Harrison/simple memory (#1435)
Co-authored-by: Tim Asp <707699+timothyasp@users.noreply.github.com>
2023-03-04 08:15:52 -08:00
Ankush Gola caa8e4742e Enable streaming for OpenAI LLM (#986)
* Support a callback `on_llm_new_token` that users can implement when
`OpenAI.streaming` is set to `True`
2023-02-14 15:06:14 -08:00
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)
2023-02-07 21:21:57 -08:00
Ankush Gola 57609845df add tracing support to langchain (#741)
* add implementations of `BaseCallbackHandler` to support tracing:
`SharedTracer` which is thread-safe and `Tracer` which is not and is
meant to be used locally.
* Tracers persist runs to locally running `langchain-server`

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-01-26 17:38:13 -08:00
Harrison Chase 0ffeabd14f Harrison/serialize llm chain (#671) 2023-01-24 21:36:19 -08:00
Harrison Chase cbc146720b verbose flag (#683) 2023-01-22 12:44:14 -08:00
Harrison Chase 5aefc2b7ce add handling on error (#541) 2023-01-04 20:23:55 -08:00
Harrison Chase 9e04c34e20 Add BaseCallbackHandler and CallbackManager (#478)
Co-authored-by: Ankush Gola <9536492+agola11@users.noreply.github.com>
2023-01-04 07:54:25 -08:00
Harrison Chase 20959d8c36 check memory variables (#411)
can have multiple input keys, if some come from memory
2022-12-24 08:35:46 -05:00
Harrison Chase cf98f219f9 Harrison/tools exp (#372) 2022-12-18 21:51:23 -05:00
Ankush Gola 8d0869c6d3 change run to use args and kwargs (#367)
Before, `run` was not able to be called with multiple arguments. This
expands the functionality.
2022-12-18 15:54:56 -05:00
Harrison Chase 8cf62ce06e Harrison/single input (#347)
allow passing of single input into chain

Co-authored-by: thepok <richterthepok@yahoo.de>
2022-12-15 07:52:51 -08:00
Shobith Alva 19a9fa16a9 Add clear() method for Memory (#305)
a simple helper to clear the buffer in `Conversation*Memory` classes
2022-12-11 07:09:06 -08:00
Harrison Chase e02d6b2288 beta: logger (#307) 2022-12-10 23:17:19 -08:00
Hansen Qian a39c998342 Add chain name to verbose logging (#214)
Adds some context over what chain is running, thereby making it more
obvious how different chains are entered and existed

<img width="867" alt="Screen Shot 2022-11-28 at 11 55 34 AM"
src="https://user-images.githubusercontent.com/2548973/204336849-25d87b44-6f5d-487b-b583-5455f306a470.png">

(note that the `...` is because the output is too long and VSCode
truncated it)
2022-11-28 11:11:30 -08:00
Harrison Chase 08deed9002 Harrison/memory docs (#195)
update memory docs and change variables
2022-11-26 05:58:54 -08:00
Harrison Chase b913df3774 make attrs public (#187)
since they are used outside of the class, should be public
2022-11-24 20:11:29 -08:00
Samantha Whitmore a408ed3ea3 Samantha/add conversation chain (#166)
Add MemoryChain and ConversationChain as chains that take a docstore in
addition to the prompt, and use the docstore to stuff context into the
prompt. This can be used to have an ongoing conversation with a chatbot.

Probably needs a bit of refactoring for code quality

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2022-11-23 16:35:38 -08:00
Harrison Chase 4a4dfbfbed Harrison/sequential chains (#168)
add support for basic sequential chains
2022-11-21 13:08:53 -08:00
Nicholas Larus-Stone 0c3ae78ec1 chore: update ascii colors to work with dark mode (#152) 2022-11-16 22:05:28 -08:00
Harrison Chase d775ddd749 add apply functionality (#150) 2022-11-16 21:39:02 -08:00
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
2022-11-13 18:14:35 -08:00
Harrison Chase f772934108 improve logging (#66) 2022-11-05 15:13:12 -07:00
Harrison Chase 18aeb72012 initial commit 2022-10-24 14:51:15 -07:00