mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-05 17:35:28 +03:00
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>
1.9 KiB
1.9 KiB
In [1]:
from langchain import OpenAI, LLMMathChain
llm = OpenAI(temperature=0)
llm_math = LLMMathChain(llm=llm, verbose=True)
llm_math.run("How many of the integers between 0 and 99 inclusive are divisible by 8?")Out [1]:
[1m> Entering new chain...[0m
How many of the integers between 0 and 99 inclusive are divisible by 8?[102m
```python
count = 0
for i in range(100):
if i % 8 == 0:
count += 1
print(count)
```
[0m
Answer: [103m13
[0m
[1m> Finished chain.[0m
'Answer: 13\n'
In [ ]: