Context
Every analysis call hits Groq fresh with no caching — repeated requests for the same cover letter re-run inference.
What needs to be done
-
Structured output — return typed JSON:
```ts
interface CoverLetterAnalysis {
relevance_score: number; // 0-100
communication_clarity: number; // 0-100
timeline_feasibility: number; // 0-100
red_flags: string[];
summary: string; // ≤ 100 words
}
```
Use Groq's `response_format: { type: 'json_object' }`.
-
Cache in Supabase — SHA-256(cover_letter + job_id) → store result, expire after 24h
-
Graceful degradation — if Groq down, return partial response, not 500
Acceptance criteria
Context
Every analysis call hits Groq fresh with no caching — repeated requests for the same cover letter re-run inference.
What needs to be done
Structured output — return typed JSON:
```ts
interface CoverLetterAnalysis {
relevance_score: number; // 0-100
communication_clarity: number; // 0-100
timeline_feasibility: number; // 0-100
red_flags: string[];
summary: string; // ≤ 100 words
}
```
Use Groq's `response_format: { type: 'json_object' }`.
Cache in Supabase — SHA-256(cover_letter + job_id) → store result, expire after 24h
Graceful degradation — if Groq down, return partial response, not 500
Acceptance criteria