Using MathChat to Solve Math Problems
AssistantAgent
and
MathUserProxyAgent
, which is similar to the usage of AssistantAgent
and UserProxyAgent
in other notebooks (e.g., Automated Task Solving
with Code Generation, Execution &
Debugging).
Essentially, MathUserProxyAgent
implements a different auto reply
mechanism corresponding to the MathChat prompts. You can find more
details in the paper An Empirical Study on Challenging Math Problem
Solving with GPT-4 or the
blogpost.
config_list_from_json
function loads a list of configurations from an environment variable or
a json file.
AssistantAgent
and MathUserProxyAgent
.
The system message needs to be set to “You are a helpful assistant.” for
MathChat. The detailed instructions are given in the user message. Later
we will use the MathUserProxyAgent.message_generator
to combine the
instructions and a math problem for an initial message to be sent to the
LLM assistant.
$(2x+10)(x+3)<(3x+9)(x+8)$
. Express your answer in interval notation.
Correct Solution: We have This inequality is satisfied if and only if
and are either both positive or both negative. Both
factors are positive for and both factors are negative for
$x<-14$
. When $-14<x<-3$
, one factor is positive and the other
negative, so their product is negative. Therefore, the range of that
satisfies the inequality is $ $.
MathUserProxyAgent.message_generator
: - You may choose from
['default', 'python', 'two_tools']
for parameter prompt_type
. We
include two more prompts in the paper: 1. 'python'
is a simplified
prompt from the default prompt that uses Python only. 2. 'two_tools'
further allows the selection of Python or Wolfram Alpha based on this
simplified python
prompt. Note that this option requires a Wolfram
Alpha API key and put it in wolfram.txt
.
prompt_type
will be ignored.$\boxed{(-\infty,0]\cup[4,\infty)}$
.