-
Input: The program takes a math problem in plain English (like "What's 15% tip on a $85 bill?")
-
Understanding:
- Uses GPT-4 to understand the problem
- Converts the English problem into a query to find the right formula
-
Knowledge Base Lookup:
- Searches through our math knowledge base (stored in math_kb.json)
- Finds the appropriate formula, constant, or conversion needed
-
Code Generation:
- Uses GPT-4 to extract numbers from the problem
- Generates Python code using the formula and numbers
-
Execution:
- Returns the final answer
🧠 STEP 1 - LANGUAGE UNDERSTANDING: Generated KB Query: circle_area
📚 STEP 2 - KNOWLEDGE BASE LOOKUP: Found Formula: math.pi * radius ** 2
⚙️ STEP 3 - CODE GENERATION: Generated Code: result = math.pi * 7 ** 2
🔢 STEP 4 - SYMBOLIC EXECUTION: Final Answer: 153.93804002589985
✅ RESULT: 153.93804002589985
============================================================
🧠 STEP 1 - LANGUAGE UNDERSTANDING: Generated KB Query: tip_calculation
📚 STEP 2 - KNOWLEDGE BASE LOOKUP: KB Results: {'type': 'formula', 'data': {'variables': ['bill', 'tip_percent'], 'formula': 'bill * (tip_percent / 100)'}} Found Formula: bill * (tip_percent / 100)
⚙️ STEP 3 - CODE GENERATION: Generated Code: result = 95 * (18 / 100)
🔢 STEP 4 - SYMBOLIC EXECUTION: Final Answer: 17.099999999999998
✅ RESULT: 17.099999999999998
============================================================
🧠 STEP 1 - LANGUAGE UNDERSTANDING: Generated KB Query: fahrenheit_to_celsius
📚 STEP 2 - KNOWLEDGE BASE LOOKUP: KB Results: {'type': 'formula', 'data': {'variables': ['fahrenheit'], 'formula': '(fahrenheit - 32) * 5 / 9'}} Found Formula: (fahrenheit - 32) * 5 / 9
⚙️ STEP 3 - CODE GENERATION: Generated Code: Code: result = (75 - 32) * 5 / 9
🔢 STEP 4 - SYMBOLIC EXECUTION: Final Answer: Execution Error: name 'result' is not defined
✅ RESULT: Execution Error: name 'result' is not defined
============================================================
🧠 STEP 1 - LANGUAGE UNDERSTANDING: Generated KB Query: sphere_volume
📚 STEP 2 - KNOWLEDGE BASE LOOKUP: KB Results: {'type': 'formula', 'data': {'variables': ['radius'], 'formula': '(4/3) * math.pi * radius ** 3'}} Found Formula: (4/3) * math.pi * radius ** 3
⚙️ STEP 3 - CODE GENERATION: Generated Code: result = (4/3) * math.pi * 4 ** 3
🔢 STEP 4 - SYMBOLIC EXECUTION: Final Answer: 268.082573106329
✅ RESULT: 268.082573106329
============================================================
🧠 STEP 1 - LANGUAGE UNDERSTANDING: Generated KB Query: simple_interest_calculation
📚 STEP 2 - KNOWLEDGE BASE LOOKUP: KB Results: None ❌ No formula found in KB
============================================================
🧠 STEP 1 - LANGUAGE UNDERSTANDING: Generated KB Query: constants.pi
📚 STEP 2 - KNOWLEDGE BASE LOOKUP: KB Results: {'type': 'constant', 'value': 3.14159265359} Found Constant: 3.14159265359
============================================================