Reasoning
Reasoning is an experimental feature that enables an Agent
to think through a problem step-by-step before jumping into a response. The Agent works through different ideas, validating and correcting as needed. Once it reaches a final answer, it will validate and provide a response. Let’s give it a try. Create a file reasoning_agent.py
Run the Reasoning Agent:
Reasoning is currently limited to OpenAI models and will break about 20% of the time. It is not a replacement for o1.
It is an experiment fueled by curiosity, combining COT and tool use. Set your expectations very low for this initial release. For example: It will not be able to count ‘r’s in ‘strawberry’.
How to use reasoning
To add reasoning, set reasoning=True
. When using reasoning with tools, do not use structured_outputs=True
as gpt-4o cannot use tools with structured outputs.
Reasoning with tools
You can also use tools with a reasoning agent, but do not use structured_outputs=True
as gpt-4o cannot use tools with structured outputs. Lets create a finance agent that can reason.
Reasoning with tools is currently limited to OpenAI models and will break about 20% of the time.
Run the script to see the output.
More reasoning examples
Logical puzzles
Run the script to see the output.
Mathematical proofs
Run the script to see the output.
Scientific research
Run the script to see the output.
Ethical dilemma
Run the script to see the output.
Planning an itinerary
Run the script to see the output.
Creative writing
Run the script to see the output.
Was this page helpful?