From d481d887bccea9ccbb1fecbfd053fe2acf078199 Mon Sep 17 00:00:00 2001 From: Peng Qu <82029664+pengqu123@users.noreply.github.com> Date: Fri, 26 May 2023 21:32:35 +0800 Subject: [PATCH] Add an example to make the prompt more robust (#5291) # Add example to LLMMath to help with power operator Add example to LLMMath that helps the model to interpret `^` as the power operator rather than the python xor operator. --- langchain/chains/llm_math/prompt.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/langchain/chains/llm_math/prompt.py b/langchain/chains/llm_math/prompt.py index 0e858002fa..8659555332 100644 --- a/langchain/chains/llm_math/prompt.py +++ b/langchain/chains/llm_math/prompt.py @@ -25,6 +25,16 @@ Question: What is 37593 * 67? ``` Answer: 2518731 +Question: 37593^(1/5) +```text +37593**(1/5) +``` +...numexpr.evaluate("37593**(1/5)")... +```output +8.222831614237718 +``` +Answer: 8.222831614237718 + Question: {question} """