From 7ec4b806a61b8af4de785261a00e792b1cfae52b Mon Sep 17 00:00:00 2001 From: siva-mirrapalli <sivamirrappalli@gmail.com> Date: Mon, 3 Mar 2025 17:45:41 +0530 Subject: [PATCH] fine tuning of prompts --- frontend/global.d.ts | 8 ++--- frontend/src/lib/constants/configs.ts | 8 ++--- frontend/src/lib/utils/gemini.ts | 5 +-- frontend/src/lib/utils/prompts.ts | 52 ++++++++++++++++++++++----- 4 files changed, 54 insertions(+), 19 deletions(-) diff --git a/frontend/global.d.ts b/frontend/global.d.ts index 84355e0..78d8d08 100644 --- a/frontend/global.d.ts +++ b/frontend/global.d.ts @@ -1,11 +1,11 @@ declare namespace NodeJS { interface ProcessEnv { NEXT_PUBLIC_API_URL: string; - NEXT_PUBLIC_DAILY_API_KEY: string; - NEXT_PUBLIC_OPEN_AI_KEY: string; + DAILY_API_KEY: string; + OPEN_AI_KEY: string; MONGO_CONNECTION: string; - NEXT_PUBLIC_GEMINI_KEY: string; - NEXT_PUBLIC_GEMINI_MODEL: string; + GEMINI_KEY: string; + GEMINI_MODEL: string; RAG_HOST: string; NEXT_PUBLIC_APP_URL: string; NEXT_PUBLIC_SUB_PATH: string; diff --git a/frontend/src/lib/constants/configs.ts b/frontend/src/lib/constants/configs.ts index 94a7c7a..7ed5f6b 100644 --- a/frontend/src/lib/constants/configs.ts +++ b/frontend/src/lib/constants/configs.ts @@ -1,9 +1,9 @@ export const API_HOST = process.env.NEXT_PUBLIC_API_URL || ""; -export const DAILY_API_KEY = process.env.NEXT_PUBLIC_DAILY_API_KEY || ""; -export const OPEN_AI_API_KEY = process.env.NEXT_PUBLIC_OPEN_AI_KEY || ""; +export const DAILY_API_KEY = process.env.DAILY_API_KEY || ""; +export const OPEN_AI_API_KEY = process.env.OPEN_AI_KEY || ""; export const MONGO_CONNECTION = process.env.MONGO_CONNECTION || ""; -export const GEMINI_KEY = process.env.NEXT_PUBLIC_GEMINI_KEY || ""; -export const GEMINI_MODEL = process.env.NEXT_PUBLIC_GEMINI_MODEL || ""; +export const GEMINI_KEY = process.env.GEMINI_KEY || ""; +export const GEMINI_MODEL = process.env.GEMINI_MODEL || ""; export const RAG_HOST = process.env.RAG_HOST || ""; export const APP_URL = process.env.NEXT_PUBLIC_APP_URL || ""; export const SUB_PATH = process.env.NEXT_PUBLIC_SUB_PATH || ""; diff --git a/frontend/src/lib/utils/gemini.ts b/frontend/src/lib/utils/gemini.ts index ad1a3fa..429b959 100644 --- a/frontend/src/lib/utils/gemini.ts +++ b/frontend/src/lib/utils/gemini.ts @@ -1,10 +1,11 @@ +"use server"; import { GoogleGenerativeAI } from "@google/generative-ai"; import { GEMINI_KEY, GEMINI_MODEL } from "@/lib/constants/configs"; import { Logger } from "@/services/logging"; const genAI = new GoogleGenerativeAI(GEMINI_KEY); -export const getModelWithSystemPrompt = (systemPrompt: string) => { +export const getModelWithSystemPrompt = async (systemPrompt: string) => { const model = genAI.getGenerativeModel({ model: GEMINI_MODEL, // generationConfig: { @@ -19,7 +20,7 @@ export const getGeminiResponse = async ( systemPrompt: string, userPrompt: string, ) => { - const model = getModelWithSystemPrompt(systemPrompt); + const model = await getModelWithSystemPrompt(systemPrompt); const result = await model.generateContent(userPrompt); Logger.log(result.response.text()); return result.response.text(); diff --git a/frontend/src/lib/utils/prompts.ts b/frontend/src/lib/utils/prompts.ts index baa0511..18448af 100644 --- a/frontend/src/lib/utils/prompts.ts +++ b/frontend/src/lib/utils/prompts.ts @@ -11,15 +11,49 @@ export const getQuestionsPrompt = (technology: string) => { export const getProfilePrompt = () => { const prompt = ` - Based on the following resume text, please give output in json format following and get only higher education as string - 1)experience -> array of objects { jobTitle, startDate, companyName, endDate, designation, noticePeriod, projectDomain, projectMonths, techStack} - 2)overallTechStack -> An array of unique strings representing all the skills, technologies, and tools mentioned in the resume, ensuring no duplicates allowed also include tools like android studio, jupyter notebook if you see them in resume. - 3)email-> string - 4)basicDetails -> object {email, mobileNumber, languages, firstName, lastName, gender, nationality, currentLocation, dob, presentDesignation} - 5)additionalInfo-> object { resumeSummary, linkedInProfile, higherEducation, portfolioUrl} - 6)experienceDuration -> object { years, months } example 2 years , 3 months - 7)overallExperience -> number in months - `; + Please extract the following information from the provided resume text and output the data in JSON format: + + 1) **experience**: An array of objects, each object representing a job experience with the following fields: + - **jobTitle**: String (Title of the job) + - **startDate**: String + - **endDate**: String + - **companyName**: String (Company name where the job was held) + - **designation**: String (Role/Position held during this job) + - **noticePeriod**: String (Notice period in months) + - **projectDomain**: String (Field or industry of the project) + - **projectMonths**: Number (Duration of the project in months) + - **techStack**: Array of Strings (Technologies/Tools used during this job) + + 2) **overallTechStack**: An array of unique strings representing all skills, technologies, and tools mentioned in the resume and his previous projects, ensuring no duplicates. + + 3) **email**: String (Primary email address) + + 4) **basicDetails**: An object containing the following fields: + - **email**: String (Primary email address) + - **mobileNumber**: String (Contact number) + - **languages**: Array of Strings (Languages spoken) + - **firstName**: String (First name) + - **lastName**: String (Last name) + - **gender**: String (Gender) + - **nationality**: String (Nationality) + - **currentLocation**: String (Current city or location) + - **dob**: String + - **presentDesignation**: String (Current job title or designation) + + 5) **additionalInfo**: An object containing the following fields: + - **resumeSummary**: String (A short summary of the resume or professional background) + - **linkedInProfile**: String (LinkedIn profile URL) + - **higherEducation**: String (Highest degree or qualification achieved) + - **portfolioUrl**: String (Link to portfolio or personal website) + + 6) **experienceDuration**: An object with the following fields: + - **years**: Number (Total number of years of work experience) + - **months**: Number (Total number of months of work experience beyond full years) + + 7) **overallExperience**: Number (Total experience in months, including part-time or internships) + + Please ensure the extracted data is formatted accurately, with no incorrect values. + `; return prompt; }; -- GitLab