Files
litellm/docs/extras/use_cases/code_writing/llm_math.ipynb
T
2023-07-29 07:12:19 -07:00

1.8 KiB

Math chain

This notebook showcases using LLMs and Python REPLs to do complex word math problems.

In [4]:
from langchain import OpenAI, LLMMathChain

llm = OpenAI(temperature=0)
llm_math = LLMMathChain.from_llm(llm, verbose=True)

llm_math.run("What is 13 raised to the .3432 power?")
Out [4]:

> Entering new LLMMathChain chain...
What is 13 raised to the .3432 power?
```text
13 ** .3432
```
...numexpr.evaluate("13 ** .3432")...

Answer: 2.4116004626599237
> Finished chain.
'Answer: 2.4116004626599237'
In [ ]: