Gemini AI & Prompt Engineering
Installation
SKILL.md
Gemini AI & Prompt Engineering Skill
This skill governs all AI-related logic within the TalentFilter platform, specifically focusing on the AIService in the backend.
1. Google Gemini API Integration
- Model Versioning: Always use the most capable version (
gemini-2.5-flash). - Safety Settings: Configure AI safety settings via the
google-genaiSDK to ensure the AI doesn't refuse valid recruitment/screening tasks while maintaining professional boundaries. - Async Execution: AI calls are high-latency; always use
awaitand ensure they are proxied through the FastAPI backend to avoid blocking the main thread.
2. Structured Output (JSON Mode)
- Strict Schema: Every AI call must use a Pydantic model to define its response structure.
- JSON Request: Set the
response_mime_typetoapplication/jsonin the Gemini config. - Validation: Always wrap the AI parsing logic in a try-except block. If parsing fails, implement a retry mechanism or return a structured error response.
- Language Awareness: Every prompt must explicitly specify the output language based on the user's
locale. - Dynamic Scope: Avoid hardcoding question counts. Instruct the AI to determine the optimal depth (e.g., "Generate as many questions as needed to thoroughly vet this specific role").