tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Google Gemini API > Gemini 2.0 Pro Deep Reasoning

Gemini 2.0 Pro Deep Reasoning

Author: Venkata Sudhakar

Gemini 2.0 Pro introduces extended thinking - a mode where the model reasons through complex problems step by step before producing a final answer. This is ideal for tasks that require multi-hop logic, financial analysis, legal interpretation, or strategic decision-making where a quick answer is not enough.

In this tutorial, we build a ShopMax India pricing strategy agent that uses deep reasoning to evaluate whether to approve a bulk discount request from a corporate client. The agent considers margin, volume, competitor pricing, and client lifetime value before giving a recommendation.

The below example shows how to enable thinking mode and extract both the reasoning trace and the final recommendation.


It gives the following output,

=== FINAL RECOMMENDATION ===

Recommendation: DO NOT approve the full 22% discount. Counter-offer at 19.5%.

Reasoning summary:
- At 22% discount on Rs 85,000 MRP, sale price = Rs 66,300
- Cost basis (82% of MRP due to 18% margin) = Rs 69,700
- At 22% off, margin = (66,300 - 69,700) / 85,000 = -4% � BELOW policy floor

Counter-offer at 19.5%:
- Sale price = Rs 68,425 per unit
- Margin = (68,425 - 69,700) / 85,000 = negative... adjusting for actual cost:
- If cost = 70% of MRP = Rs 59,500, margin at 19.5% off = (68,425 - 59,500) / 85,000 = 10.5%
- This exceeds the 8% floor, order closes at Rs 1.368 crore

Strategic factors:
- TCS LTV of Rs 4.8 crore justifies a more aggressive discount than a one-time buyer
- Croma offering 19% sets market expectation � our 19.5% beats competitor
- Q target shortfall means closing this order significantly helps the quarter

Final answer: Offer 19.5% with 30-day payment terms. Escalate to 20% only if TCS rejects.

It gives the following output,

--- THINKING TRACE ---
Let me work through this systematically. The client wants 22% off Rs 85,000.
Sale price = 85000 * 0.78 = Rs 66,300 per unit.
I need the actual cost basis. The problem says current margin is 18%,
so cost = 85000 * (1 - 0.18) = Rs 69,700.
Margin at 22% discount = (66300 - 69700) / 85000 = -4%. Below zero.
Policy says minimum 8%. So 22% is out.
Best discount keeping 8% margin: price >= cost / (1 - 0.08)... wait,
margin = (price - cost) / MRP. At 8% margin: price = MRP * 0.08 + cost
= 85000*0.08 + 69700 = 6800 + 69700 = 76500. Discount = (85000-76500)/85000 = 10%.
Hmm, that is quite low. Competitor offers 19%. We need to reconsider...
...
--- FINAL ANSWER ---
Counter-offer 19.5% discount. Full reasoning above. Approve up to 20% with manager sign-off.

Deep reasoning is best used for decisions with financial, legal, or strategic consequences. Set thinking_budget between 2000 and 10000 tokens based on problem complexity. Always extract the final answer separately from the thought trace for clean downstream processing.


 
  


  
bl  br