The Gemma 3:4B API provides a comprehensive suite of tools for interacting with the Gemma 3:4B large language model and performing various HR-related tasks. This API is designed to streamline and automate processes such as advanced text generation, document parsing, and candidate evaluation.
The API offers the following key functionalities:
- Text Generation: Generate contextually relevant text based on prompts, with or without accompanying image data.
- Resume Parsing: Extract structured information from resumes in PDF or DOCX format. Employs a robust waterfall text extraction mechanism, including image-based OCR for scanned documents.
- Job Description (JD) Parsing: Parse job descriptions from PDF or DOCX files, extracting key details into a structured format. Also utilizes the waterfall text extraction mechanism.
- Interview Question Generation: Create tailored interview questions based on:
- A job description and a candidate's resume.
- A job description only.
- Candidate-Job Fit Evaluation: Assess the suitability of a candidate for a specific role by comprehensively comparing their resume against the job description.
- VAPI Call Summary Extraction: Extract key information (e.g., salary expectations, notice period) from VAPI (Voice API) call summaries or transcripts.
- Batch Resume Evaluation: Evaluate multiple resumes against a single job description in a batch process, with results sorted by match score.
This section details the available API endpoints, their functionalities, expected request formats, and responses.
- Method:
GET - Path:
/ - Description: Provides a welcome message and a list of all available API endpoints with their descriptions.
- Request Body: None.
- Response: JSON object containing a welcome message and a list of endpoint details.
- Method:
POST - Path:
/generate - Description: Generates a text-based response from the Gemma model based on a given prompt and optional conversation history.
- Request Body:
GenerateRequestmodel.prompt(string, required): The prompt to send to the model.history(string, optional): The conversation history. Defaults to an empty string.
{ "prompt": "Tell me about the future of AI.", "history": "User: What is AI?\nAssistant: AI is artificial intelligence." } - Response: JSON object with the generated text:
{"response": "Generated text from the model."}.
- Method:
POST - Path:
/generate_with_image - Description: Generates a response based on an uploaded image and a text prompt, leveraging multimodal capabilities.
- Request Body: Form data.
file(UploadFile, required): Image file (supported formats: JPG, PNG, GIF, BMP).prompt(string, required): Text prompt related to the image.history(string, optional): Optional conversation history.
- Response: JSON object with the generated text:
{"response": "Generated text based on the image and prompt."}.
- Method:
POST - Path:
/resume - Description: Parses a resume file (PDF or DOCX) and extracts structured information. Uses a waterfall mechanism for text extraction (standard parsing then image-based fallback if needed).
- Request Body:
file(UploadFile, required): Resume file (PDF or DOCX).
- Response:
ResumeResponseJSON object containing comprehensively parsed resume data, including name, contact information, education, skills (differentiated intodirect_skillsandsubjective_skillswith context), experience, projects, certifications, etc., along with aconfidence_scoreandconfidence_details.
- Method:
POST - Path:
/jd_parser - Description: Parses a job description file (PDF or DOCX) and extracts structured information. Uses a waterfall mechanism for text extraction.
- Request Body:
file(UploadFile, required): Job description file (PDF or DOCX).
- Response:
JobDescriptionResponseJSON object containing parsed job description data, including job title, company, location, skills, experience, education, responsibilities, etc., along with aconfidence_score.
- Method:
POST - Path:
/jd - Description: Generates tailored interview questions based on a job description file and resume data.
- Request Body: Form data.
file(UploadFile, required): Job description file (PDF or DOCX).request_data_json(string, required): JSON string containingresume_json(parsed resume data, typically from the/resumeendpoint) and question scales (0-10 for technical, past experience, case study, situation handling, personality test questions). SeeJDQuestionRequestmodel for structure.
{ "resume_json": { "name": "John Doe", "direct_skills": {"Python": "Expert", "Java": "Intermediate"}, "experience": [{"role": "Software Engineer", "duration": "2 years"}] }, "technical_questions": 7, "past_experience_questions": 5, "case_study_questions": 3, "situation_handling_questions": 4, "personality_test_questions": 2 } - Response: JSON object with categorized interview questions (technical, past experience, case study, situation handling, personality test). The number of questions per category is proportional to the provided scale (0-10 maps to 0-5 questions).
- Method:
POST - Path:
/jd_only - Description: Generates interview questions based solely on an uploaded job description file.
- Request Body:
file(UploadFile, required): Job description file (PDF or DOCX).
- Response: JSON object with 5 questions for each category (technical, past experience, case study, situation handling, personality test).
- Method:
POST - Path:
/intervet - Description: Evaluates how well a candidate's resume matches a job description, using JSON inputs for both resume and JD data.
- Request Body:
IntervetRequestmodel.resume_json(object, required): Parsed resume data (typically from the/resumeendpoint).jd_json(object, required): Parsed job description data (typically from the/jd_parserendpoint).
{ "resume_json": { "name": "Jane Doe", "direct_skills": {"Python": "Proficient", "Machine Learning": "Experienced"}, "experience": [{"company_name": "Tech Corp", "role": "Data Scientist", "duration": "3 years"}] }, "jd_json": { "job_title": "Senior Data Scientist", "required_skills": ["Python", "Machine Learning", "Deep Learning"], "required_experience": "5+ years" } } - Response: JSON object containing an overall
total_score(0-100),fit_category(e.g., "Excellent Match"),summaryof the evaluation, detailedscoresfor various criteria (skills, experience, reliability, location, education, certifications), andrationalefor each score.
- Method:
POST - Path:
/intervet2 - Description: Evaluates how well a candidate's resume matches a job description, using direct file uploads for both resume and JD.
- Request Body: Form data.
resume_file(UploadFile, required): Resume file (PDF or DOCX).jd_file(UploadFile, required): Job description file (PDF or DOCX).
- Response: JSON object with evaluation results, similar in structure to the
/intervetendpoint response (includingtotal_score,fit_category,summary,scores, andrationale).
- Method:
POST - Path:
/interfix - Description: Extracts key information from a VAPI (Voice API) call summary or transcript.
- Request Body:
InterfixRequestmodel.summary(string, required): The call summary or transcript text.
{ "summary": "The candidate mentioned a notice period of 1 month and expects a salary around 80,000. They are looking for a new role to grow their skills. Available for an interview next week, preferably in the afternoon." } - Response:
InterfixResponseJSON object with extracted fields:offer_in_hand(float, optional),notice_period(string, optional),expected_salary(float, optional),reason_to_switch(string, optional),preferred_time_for_interview(string, optional), andpreferred_date_for_interview(string, optional).
- Method:
POST - Path:
/bunchtest - Description: Evaluates multiple resume files (PDF or DOCX) against a single job description file (PDF or DOCX) in a batch process.
- Request Body: Form data.
resume_files(List[UploadFile], required): List of resume files.jd_file(UploadFile, required): A single job description file.
- Response: JSON object containing a list of
results(each result is similar to the/intervet2response, includingresume_filename),jd_title,resume_count, and atimestamp. Results are sorted bytotal_scorein descending order.
This section provides a more detailed explanation of the core features offered by the Gemma 3:4B API.
The API provides powerful text generation capabilities leveraging the Gemma model:
/generateEndpoint: This endpoint uses the Gemma model to generate text-based responses. It takes a user-providedpromptand an optionalhistoryof the conversation. The model then continues the conversation or answers the prompt based on this input./generate_with_imageEndpoint: This endpoint extends the text generation capability to multimodal inputs. It accepts an image file (e.g., JPG, PNG) along with apromptand optionalhistory. The Gemma model considers both the visual information from the image and the textual context to generate a relevant response.
- Overall Functionality: The
/resumeendpoint is designed to process resume files (PDF or DOCX) and convert them into structured JSON data. This facilitates the automated extraction of key candidate information for HR systems and analysis. - Key Information Extracted: The service extracts a comprehensive set of fields, including but not limited to:
name,email,phone,location,summaryeducation: (List of entries withdegree,institution,year, etc.)direct_skills: (Dictionary of skills explicitly listed, e.g., in a "Skills" section, with context)subjective_skills: (Dictionary of skills inferred from the text of experience or projects, with context)experience: (List of entries withcompany_name,role,duration,key_responsibilities, etc.)projects: (List of entries withname,description,technologies_used, etc.)certifications,languages,social_media,publications,achievements,volunteer_experience,domain_of_interestconfidence_scoreandconfidence_details.
- Waterfall Text Extraction: To ensure high accuracy in text extraction from various resume formats, the API employs a waterfall mechanism. It first attempts to extract text using standard PDF/DOCX parsing libraries. If the extracted text is insufficient (which can happen with image-based PDFs or scanned documents), it automatically falls back to an image-based extraction method. This fallback treats the document as an image and uses the LLM's vision capabilities to "read" and extract the text content.
- Confidence Score: The
ResumeResponseincludes aconfidence_score(a float between 0.0 and 1.0) andconfidence_details(a dictionary with scores per field). These scores represent the model's assessment of the accuracy and completeness of the extracted information. A higher score indicates greater confidence in the parsed data. This is determined by analyzing factors like the clarity of the resume sections, consistency in formatting, and how well the extracted data aligns with expected patterns for each field.
- Overall Functionality: The
/jd_parserendpoint processes job description files (PDF or DOCX) and transforms their content into a structured JSON format. This is useful for standardizing job postings and enabling programmatic analysis of requirements. - Key Information Extracted: Key fields include:
job_title,company_name,location,job_type,work_mode,summaryresponsibilities: (List of strings)required_skills: (List of strings)preferred_skills: (List of strings)required_experience: (e.g., "3+ years")education_requirements: (List of strings)education_details: (Object withdegree_level,field_of_study, etc.)salary_range,benefitsconfidence_score.
- Waterfall Text Extraction: Similar to resume parsing, this endpoint uses a waterfall approach for text extraction. It starts with standard methods for PDF/DOCX files and can fall back to image-based extraction if the initial attempt does not yield sufficient text, ensuring robust parsing across different JD formats.
- Confidence Score: The
JobDescriptionResponseincludes aconfidence_score(a float). This score reflects the model's confidence in how accurately it has parsed the job description into the structured schema.
The API provides two endpoints for generating interview questions:
/jdEndpoint (Job Description & Resume): This endpoint creates tailored interview questions by analyzing both an uploaded job description file (PDF/DOCX) and provided resume data (as a JSON payload). The request allows users to specifytechnical_questions,past_experience_questions,case_study_questions,situation_handling_questions, andpersonality_test_questionson a scale of 0-10, which then determines the number of questions generated for each category (up to 5 per category)./jd_onlyEndpoint (Job Description Only): When resume data is not available, this endpoint generates interview questions based solely on the content of an uploaded job description file (PDF/DOCX). It typically generates a fixed set of questions (e.g., 5) for each category.- Typical Question Categories:
- Technical Questions
- Past Experience Questions
- Case Study Questions
- Situation Handling Questions
- Personality Test Questions
These endpoints assess how well a candidate's profile aligns with a job's requirements:
/intervetEndpoint: This endpoint requires the resume data and job description data to be provided in JSON format (these are typically the outputs of the/resumeand/jd_parserendpoints, respectively)./intervet2Endpoint: This endpoint offers more convenience by allowing direct file uploads for both the resume (PDF/DOCX) and the job description (PDF/DOCX). The API handles the parsing of these files internally before conducting the evaluation.- Main Evaluation Criteria: The candidate-job fit is determined by evaluating several factors, including:
- Skills Match (both
direct_skillsexplicitly listed andsubjective_skillsinferred from experience/projects) - Years of Experience
- Reliability (assessed from job tenure and frequency of job changes)
- Location Match
- Education Match (comparing academic qualifications against requirements)
- Relevant Certifications
- Skills Match (both
- Output: The evaluation response includes:
- An
total_score(typically 0-100). - A
fit_category(e.g., "Excellent Match", "Strong Match", "Good Match", "Moderate Match", "Weak Match"). - A textual
summaryof the evaluation. - Detailed
scoresandrationalefor each criterion, explaining the basis of the assessment and highlighting specific strengths or gaps.
- An
- Purpose: The
/interfixendpoint is designed to extract structured information from unstructured text summaries or transcripts generated by VAPI (Voice API) call agents, often used in initial HR screening calls. - Key Information Extracted: It aims to pull out key details useful for recruiters, such as
offer_in_hand(candidate's current offer/salary),notice_period,expected_salary,reason_to_switch,preferred_time_for_interview, andpreferred_date_for_interview.
- Purpose: This endpoint facilitates the efficient screening of multiple candidates for a single job opening. Users can upload multiple resume files (PDF or DOCX) along with one job description file (PDF or DOCX).
- Functionality: The API processes each resume individually, performing a comprehensive candidate-job fit evaluation (identical to the
/intervet2endpoint) against the common job description. - Output: The results are returned as a list, where each item represents the detailed evaluation for one resume. Crucially, these results are sorted by the
total_scorein descending order, enabling recruiters to quickly identify the top candidates from the batch. The response also includes the job title from the JD, the number of resumes processed, and a timestamp.
The API utilizes Pydantic models to define the structure of request and response bodies, ensuring data consistency and providing clear specifications. Below is a brief overview of key data models:
-
GenerateRequest: Used for the/generateendpoint. It includesprompt(string, required) for the user's input andhistory(string, optional) for the preceding conversation context. -
ResumeResponse: This is the detailed JSON structure returned by the/resumeendpoint. It encapsulates all parsed information from a resume. Key components include:- Basic candidate details (
name,email,phone,location,summary). - Nested structures for detailed sections like
education(list ofEducationEntry),experience(list ofExperienceEntry), andprojects(list ofProjectEntry). direct_skillsandsubjective_skills(dictionaries mapping skills to their context/rationale).- Lists for
certifications(list ofCertificationEntry),languages(list ofLanguageEntry),social_media,publications,achievements,volunteer_experience, anddomain_of_interest. confidence_score(float) andconfidence_details(dict) for parsing accuracy.- Models like
EducationEntry,ExperienceEntry,ProjectEntry, andCertificationEntrydefine the schema for individual items within these lists, capturing granular details (e.g.,EducationEntryincludesdegree,institution,year).
- Basic candidate details (
-
JobDescriptionResponse: This model defines the JSON structure for the output of the/jd_parserendpoint. It includes:- Core job details (
job_title,company_name,location,job_type,work_mode,summary). - Lists for
responsibilities,required_skills,preferred_skills,education_requirements. - Nested structures like
education_details(object withdegree_level,field_of_study),benefits(list ofBenefitEntry), andrequirements(list ofRequirementEntry). confidence_score(float) for parsing accuracy.
- Core job details (
-
JDQuestionRequest: The request model for the/jdendpoint (generating interview questions with JD and resume). It requires:resume_json(object): The parsed resume data, typically from the/resumeendpoint.- Scales (integer, 0-10) for various question categories:
technical_questions,past_experience_questions,case_study_questions,situation_handling_questions,personality_test_questions.
-
IntervetRequest: Used for the/intervetendpoint (candidate-job fit evaluation with JSON inputs). It contains:resume_json(object): Parsed resume data.jd_json(object): Parsed job description data.
-
InterfixRequest: The request model for the/interfixendpoint (VAPI call summary extraction). It includes:summary(string): The text summary or transcript of the call.
-
InterfixResponse: The response model for the/interfixendpoint. It structures the extracted call information, such asoffer_in_hand(float, optional),notice_period(string, optional),expected_salary(float, optional),reason_to_switch(string, optional),preferred_time_for_interview(string, optional), andpreferred_date_for_interview(string, optional).
These models ensure that data exchanged with the API is well-defined and validated, promoting reliable integrations.