Commit Graph

40 Commits

Author SHA1 Message Date
Harrison Chase
3efee27e56 cr 2023-01-03 14:12:43 -08:00
Harrison Chase
23b8cfc123 cr 2023-01-03 12:14:25 -08:00
Harrison Chase
0db05b6725 Harrison/add human prefix (#520)
Co-authored-by: Andrew Huang <jhuang16888@gmail.com>
2023-01-03 08:03:50 -08:00
Ankush Gola
db5c8e0c42 explicitly set global verbosity flag in unit tests that test callbacks (#502)
If another file anywhere in `unit_tests` sets `langchain.verbose =
True`, it messes up all of the tests that check for no callbacks because
the `None` for verbose gets overridden by the global verbosity flag. By
explicitly setting it in unit tests, we bypass that potential issue
2023-01-02 14:06:46 -08:00
Harrison Chase
5d43246694 WIP: stdout callback (#479)
first pass at stdout callback

for the most part, went pretty smoothly. aside from the code here, here
are some comments/observations.

1. 
should somehow default to stdouthandler so i dont have to do 
```
from langchain.callbacks import get_callback_manager
from langchain.callbacks.stdout import StdOutCallbackHandler

get_callback_manager().add_handler(StdOutCallbackHandler())
```

2. I kept around the verbosity flag. 1) this is pretty important for
getting the stdout to look good for agents (and other things). 2) I
actually added this for LLM class since it didn't have it.

3. The only part that isn't basically perfectly moved over is the end of
the agent run. Here's a screenshot of the new stdout tracing
![Screen Shot 2022-12-29 at 4 03 50
PM](https://user-images.githubusercontent.com/11986836/210011538-6a74551a-2e61-437b-98d3-674212dede56.png)

Noticing it is missing logging of the final thought, eg before this is
what it looked like
![Screen Shot 2022-12-29 at 4 13 07
PM](https://user-images.githubusercontent.com/11986836/210011635-de68b3f5-e2b0-4cd3-9f1a-3afe970a8716.png)

The reason its missing is that this was previously logged as part of
agent end (lines 205 and 206)

this is probably only relevant for the std out logger? any thoughts for
how to get it back in?
2022-12-29 21:34:47 -05:00
Ankush Gola
36922318d3 allow for optional CallbackManager in LLM, Chain, and Agent (#482) 2022-12-29 17:30:31 -08:00
Harrison Chase
0c5d3fd894 version 0.0.49 (#436) 2022-12-27 09:17:01 -05:00
Harrison Chase
f8b605293f Harrison/improve memory (#432)
add AI prefix

add new type of memory

Co-authored-by: Jason <chisanch@usc.edu>
2022-12-27 08:23:51 -05: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
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
c1b50b7b13 Harrison/map reduce merge (#344)
Co-authored-by: John Nay <JohnNay@users.noreply.github.com>
2022-12-15 17:49:14 -08:00
Harrison Chase
78b31e5966 Harrison/cache (#343) 2022-12-15 07:53:32 -08: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
Harrison Chase
9bb7195085 Harrison/llm saving (#331)
Co-authored-by: Akash Samant <70665700+asamant21@users.noreply.github.com>
2022-12-13 06:46:01 -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
andersenchen
5267ebce2d Add LLMCheckerChain (#281)
Implementation of https://github.com/jagilley/fact-checker. Works pretty
well.

<img width="993" alt="Screenshot 2022-12-07 at 4 41 47 PM"
src="https://user-images.githubusercontent.com/101075607/206302751-356a19ff-d000-4798-9aee-9c38b7f532b9.png">

Verifying this manually:
1. "Only two kinds of egg-laying mammals are left on the planet
today—the duck-billed platypus and the echidna, or spiny anteater."
https://www.scientificamerican.com/article/extreme-monotremes/
2. "An [Echidna] egg weighs 1.5 to 2 grams (0.05 to 0.07
oz)[[19]](https://en.wikipedia.org/wiki/Echidna#cite_note-19) and is
about 1.4 centimetres (0.55 in) long."
https://en.wikipedia.org/wiki/Echidna#:~:text=sleep%20is%20suppressed.-,Reproduction,a%20reptile%2Dlike%20egg%20tooth.
3. "A [platypus] lays one to three (usually two) small, leathery eggs
(similar to those of reptiles), about 11 mm (7⁄16 in) in diameter and
slightly rounder than bird eggs."
https://en.wikipedia.org/wiki/Platypus#:~:text=It%20lays%20one%20to%20three,slightly%20rounder%20than%20bird%20eggs.
4. Therefore, an Echidna is the mammal that lays the biggest eggs.


cc @hwchase17
2022-12-09 12:49:05 -08:00
Harrison Chase
3c1c7ba672 update branch name in gha (#274) 2022-12-06 22:28:50 -08:00
Akash Samant
48b093823e Add a Transformation Chain (#257)
Arbitrary transformation chains that can be used to add dictionary
extractions from llms/other chains
2022-12-06 21:58:16 -08:00
coyotespike
b7bef36ee1 BashChain (#260)
Love the project, a ton of fun!

I think the PR is pretty self-explanatory, happy to make any changes! I
am working on using it in an `LLMBashChain` and may update as that
progresses.

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2022-12-06 21:57:50 -08:00
Harrison Chase
28be37f470 LLMRequestsChain (#267) 2022-12-06 21:55:02 -08:00
Harrison Chase
f5c665a544 combine python files (#256) 2022-12-04 15:57:36 -08:00
Harrison Chase
db58032973 introduce output parser (#250) 2022-12-03 13:28:07 -08:00
Harrison Chase
a9ce04201f Harrison/improve usability of api chain (#247)
improve usability of api chain
2022-12-02 15:44:10 -08:00
Harrison Chase
c897bd6cbd api chain (#246)
Co-authored-by: Subhash Ramesh <33400216+thecooltechguy@users.noreply.github.com>
2022-12-02 13:39:36 -08:00
Xupeng (Tony) Tong
bb4bf9d6d0 chore: minor clean up / formatting (#233)
to get familiarize with the project
2022-12-01 10:50:36 -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
d3a7429f61 (WIP) agents (#171) 2022-11-22 06:16:26 -08:00
Harrison Chase
4a4dfbfbed Harrison/sequential chains (#168)
add support for basic sequential chains
2022-11-21 13:08:53 -08:00
Harrison Chase
c02eb199b6 add few shot example (#148) 2022-11-19 20:32:45 -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
db37bd089f model laboratory (#95) 2022-11-08 22:17:10 -08:00
Harrison Chase
eb36317f9a Harrison/fix imports (#72)
fix imports and add section to notebook
2022-11-06 16:06:40 -08:00
Samantha Whitmore
a5b61d59e1 Refactor prompts into module, add example generation utils (#64) 2022-11-06 15:40:33 -08:00
Harrison Chase
2456a547de mrkl (#42) 2022-11-05 14:41:53 -07:00
Harrison Chase
e982cf4b2e Harrison/update docstore (#47)
change docstore interface
2022-10-31 21:18:52 -07:00
Harrison Chase
ce7b14b843 Harrison/add react chain (#24)
from https://arxiv.org/abs/2210.03629

still need to think if docstore abstraction makes sense
2022-10-26 21:02:23 -07:00
Harrison Chase
1ef3ab4d0e Harrison/add natbot (#18) 2022-10-24 19:56:26 -07:00
Harrison Chase
18aeb72012 initial commit 2022-10-24 14:51:15 -07:00