Cloud LLM extraction: stricter prompt + Zod validation + provider abstraction
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- react-native, typescript
- Domain
- ai, mobile, testing-qa
Research direction
Start with CloudAiProvider.ts and the existing JobExtractionResult schema, then inspect the extract screen and its EXPO_PUBLIC_ENABLE_CLOUD_AI gating. Review the proposed extraction prompt location at src/ai/prompts/extraction.ts and the current test setup. Done means malformed output is rejected with a friendly error, logs include prompt version and latency, new prompt and parser tests pass, and all 112 existing tests remain green.
Written by the indexing model from the issue text.
Description
Problem
CloudAiProvider.ts exists and uses Gemini 3.1 Flash Lite (with Gemini 3 Flash Preview fallback), but the integration is rough:
- No Zod validation of the LLM's response (Plan §15.3 requires it)
- Prompt is inline; not reusable / testable
- No latency or token usage logging
- Only one provider; no way to add OpenAI / Anthropic / Azure OpenAI without forking
- No graceful degradation when the API key is missing
Why
- LLM output is not guaranteed to match the expected JSON shape; the app would currently write garbage into the suggestions UI
- The PLAN explicitly says the cloud provider should "validate response with Zod"
- A second provider would be useful for cost/quality comparison
- Telemetry helps debug and tune the prompt
Proposed solution
- Extract the prompt to
src/ai/prompts/extraction.tswith versioning - Validate the Gemini response with the existing
JobExtractionResultZod schema before returning - Log latency, prompt version, token counts (if available)
- Define a generic
CloudLlmAdapterinterface so a second provider (OpenAI gpt-4o-mini) can be added behind a feature flag - Hide the cloud provider from the extract screen when
EXPO_PUBLIC_ENABLE_CLOUD_AI !== "true"(already partially done)
Acceptance
- Malformed LLM output is rejected and surfaces a friendly error
- All 112 existing tests still pass
- New unit tests for the prompt template + Zod parser
- Logs include prompt version + latency in
console.info(or future telemetry)
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Taleef7/JobTrail
-
deployability
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
ci
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
enhancement phase:10
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 58/100
All issues in Taleef7/JobTrail
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·