LLM Math

这个笔记本展示了如何使用 LLM 和 Python REPL 来解决复杂的单词数学问题。

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?")
> 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'

Last Updated:
Contributors: 刘强