How It Works
Input Format
The diagnostic service accepts four parameters:Analysis Process
The service performs keyword-based symptom analysis:Symptom Patterns
Power Issues
Time: 3-5 hours
Labor Cost: 850.00
Mechanical Issues
Time: 2-3 hours
Labor Cost: 700.00
Fluid Leaks
Time: 1-2 hours
Labor Cost: 600.00
Default Fallback
When no patterns match:app/Services/AiDiagnosticService.php:7-69
Output Format
Complete Response Structure
Parts Cost Calculation
Token Usage Tracking
Estimation Before Analysis
Before sending the diagnostic request, the system estimates token usage:Actual Usage Recording
After receiving the response:app/Services/OrderCreationService.php:64-115
Plan-Based Limits
- Enterprise Plan
- Developer Test Plan
- Starter Plan
Monthly Limits:
- Query limit: 200 requests
- Token limit: 120,000 tokens
app/Services/AiPlanPolicyService.php:6-34
Usage Validation
Pre-Request Validation
Plan Support Check
Plan Support Check
Query Quota Check
Query Quota Check
Token Quota Check
Token Quota Check
Post-Response Validation
After getting the actual response, verify token usage again:app/Services/AiUsageService.php:37-45
Usage Recording
Success Record
When diagnostics complete successfully:Blocked Record
When requests are blocked (quota exceeded, plan limitation):app/Services/AiUsageService.php:62-115
Monthly Usage Calculation
Get current month’s usage for a company:app/Services/AiUsageService.php:47-60