Spaces:
Runtime error
Runtime error
Remove QUICK_START.md and reorganize documentation structure; add detailed deployment guide for Hugging Face Spaces and performance optimization documentation for agent mode.
7002c4d Word Problem Handling Strategy
Overview
meeTARA Agent handles word problems differently based on their complexity and type:
Three Types of Word Problems
1. Simple Math Word Problems β Calculator β
Examples:
- "What's 15% of 340?" β Extracted as
0.15 * 340β Calculator calculates - "Find 25 * 48" β Calculator handles directly
- "Calculate tan(45)" β Scientific function β Calculator
Why Calculator:
- Clear mathematical expression can be extracted via pattern matching
- Calculator ensures 100% accuracy
- Fast and efficient
2. Complex Word Problems β Model Directly β
Examples:
- "If John has 5 apples and gives 2 away, how many does he have left?"
- "A train travels 60 miles in 2 hours. What's its speed?"
- "Sarah buys 3 books at $10 each and 2 pens at $5 each. How much did she spend?"
- "If a rectangle has length 6 cm and width 4 cm, what's its area?" (geometry - has keywords)
Why Model Directly:
- Requires understanding relationships between entities (John, apples, gives away)
- Need to extract formula from context (speed = distance/time)
- Need to combine multiple operations (3 books Γ $10 + 2 pens Γ $5)
- Model can understand natural language relationships and extract math
- Calculator would need perfect extraction, which is hard for complex relationships
Detection:
- Uses
word_problem_keywordsfrom config: "if", "has", "gives", "travels", "buys", "costs", etc. - Strategy:
model_direct(configurable inagent_config.json) - Skips calculator if complex word problem detected β Sends directly to model
3. Word Problems About Current Events/Data β Web Search + Model β
Examples:
- "What's the current unemployment rate in the US?"
- "What's the current price of Bitcoin?"
- "What's today's stock market performance?"
Why Web Search:
- Requires up-to-date information beyond training data
- Real-time data that changes frequently
- Web search provides current data β Model structures response
Configuration
All word problem handling is configurable in config/agent_config.json:
{
"calculator": {
"word_problem_keywords": [
"if", "when", "has", "gives", "receives", "buys", "sells",
"travels", "drives", "costs", "price", "total", "spends",
"left", "remaining", "more than", "less than", "times"
],
"word_problem_strategy": "model_direct",
"word_problem_explanation": "Simple word problems handled by calculator. Complex word problems go to model. Current events go to web search."
}
}
Decision Flow
User Query: Word Problem
β
Check if contains word_problem_keywords (if, has, gives, etc.)
β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Is it about current events/data? β
β β Contains "current", "today", "latest", etc. β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
YES β Web Search β Model
NO β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Can math be extracted via patterns? β
β β "15% of 340" β 0.15 * 340 β β
β β "tan(45)" β tan(45) β β
β β "25 * 48" β 25 * 48 β β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
YES β Calculator β Model
NO β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Is it a complex word problem? β
β β Contains relationship keywords β
β β No clear math expression extractable β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
YES β Model Directly (skip calculator)
NO β Model Directly (fallback)
Examples
Example 1: Simple β Calculator
Query: "What's 15% of 340?"
- Detection: Percentage pattern matched
- Extraction:
0.15 * 340 - Calculator:
51 - Model: Structures response with steps
Example 2: Complex β Model Directly
Query: "If John has 5 apples and gives 2 away, how many does he have left?"
- Detection: Contains word_problem_keywords ("if", "has", "gives", "left")
- Complex word problem: Yes (requires understanding relationships)
- Calculator: Skipped (no clear expression to extract)
- Model: Understands relationship β Extracts: 5 - 2 = 3 β Responds
Example 3: Current Events β Web Search
Query: "What's the current unemployment rate?"
- Detection: Contains "current" β Web search keyword
- Web Search: Fetches current data
- Model: Structures response with current data
Example 4: Geometry β Full Query to Model
Query: "Find the surface area of a rectangular prism with dimensions: length = 6 cm, width = 4 cm, height = 5 cm"
- Detection: Geometry keywords ("surface area", "rectangular prism")
- Calculator: Receives full query (not just numbers)
- Calculator: Detects geometry β Returns context message
- Model: Calculates using formula 2(lw + lh + wh) = 148 cmΒ²
Recommendations
- Simple Math β Calculator (100% accurate, fast)
- Complex Word Problems β Model (understands relationships, extracts math)
- Current Events β Web Search (up-to-date data)
- Geometry β Full query to calculator/model (needs formula context)
Why This Strategy Works
- Calculator = Perfect for clear math expressions (ensures accuracy)
- Model = Perfect for understanding relationships and extracting formulas
- Web Search = Perfect for current/realtime data
- Combination = Best of all worlds (tool precision + model understanding + current data)