Spaces:
Sleeping
Sleeping
Update resume_tools.py
Browse files- resume_tools.py +254 -254
resume_tools.py
CHANGED
|
@@ -1,255 +1,255 @@
|
|
| 1 |
-
from smolagents import CodeAgent, LiteLLMModel, tool
|
| 2 |
-
from pypdf import PdfReader
|
| 3 |
-
import google.generativeai as genai
|
| 4 |
-
import os
|
| 5 |
-
from typing import List
|
| 6 |
-
from utils import CURRENT_RESUME_LATEX
|
| 7 |
-
import os
|
| 8 |
-
import json
|
| 9 |
-
|
| 10 |
-
config = json.load(open("config.json"))
|
| 11 |
-
os.environ["GOOGLE_API_KEY"] = config["GOOGLE_API_KEY"]
|
| 12 |
-
|
| 13 |
-
@tool
|
| 14 |
-
def header_details(name: str, mobile_number: str, email_id: str, linkedin_profile_link : str, github_link: str) -> str:
|
| 15 |
-
"""
|
| 16 |
-
Generates header details of the person. It will display the name, mobile_number, email_id, linkedin profile and github profile
|
| 17 |
-
|
| 18 |
-
Args:
|
| 19 |
-
name(str): Name of the candidate
|
| 20 |
-
mobile_number(str): Mobile number of the candidate
|
| 21 |
-
email_id(str): email_id
|
| 22 |
-
linkedin_profile_link(str): Linkedin profile link of the candidate.
|
| 23 |
-
github_link(str): github link of the candidate.
|
| 24 |
-
|
| 25 |
-
Returns:
|
| 26 |
-
str: Instruction for the next steps
|
| 27 |
-
"""
|
| 28 |
-
|
| 29 |
-
header_latex = r"""
|
| 30 |
-
|
| 31 |
-
\begin{center}
|
| 32 |
-
\textbf{\Huge \scshape """
|
| 33 |
-
header_latex+= name + r"""} \\ \vspace{1pt}
|
| 34 |
-
\small""" + mobile_number + r""" $|$ \href{mailto:x@x.com}{\underline{"""
|
| 35 |
-
header_latex+= email_id + r"""}} $|$
|
| 36 |
-
\href{https://linkedin.com/in/...}{\underline{"""
|
| 37 |
-
header_latex+=linkedin_profile_link + r"""}} $|$
|
| 38 |
-
\href{https://github.com/...}{\underline{"""
|
| 39 |
-
header_latex+=github_link + r"""}}
|
| 40 |
-
\end{center}
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
"""
|
| 44 |
-
global CURRENT_RESUME_LATEX
|
| 45 |
-
CURRENT_RESUME_LATEX += header_latex
|
| 46 |
-
response_message = "Now call professional_summary_tool"
|
| 47 |
-
return response_message
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
@tool
|
| 51 |
-
def professional_summary(summary: str) -> str:
|
| 52 |
-
"""
|
| 53 |
-
Creates a Professional Experience summary section of the candidate.
|
| 54 |
-
|
| 55 |
-
Args:
|
| 56 |
-
summary (str): The generated summary should be in less than 4 lines. It should follow the STAR method while generating the summary. It should speak about the experience and the role he is applying for.
|
| 57 |
-
(e.g: Accomplished Gen AI Specialist with expertise in machine learning (ML), deep learning (DL), generative AI, and AI Agents, proficient in end-to end development from design to deployment. Skilled in problem-solving, data structures and algorithms (DSA), strong analytical abilities, and debugging complex systems. Passionate about optimizing ML model performance to deliver efficient, high-impact AI solutions. Adept at leveraging the full AI stack to drive innovation and achieve business objectives in fast-paced, technology-focused environments)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
Returns:
|
| 61 |
-
str: Instruction for the next steps
|
| 62 |
-
"""
|
| 63 |
-
|
| 64 |
-
summary_latex = """
|
| 65 |
-
|
| 66 |
-
\section{Professional Summary}
|
| 67 |
-
"""
|
| 68 |
-
summary_latex += rf"""
|
| 69 |
-
{{{summary}}}
|
| 70 |
-
"""
|
| 71 |
-
summary_latex = summary_latex.replace("%","\%")
|
| 72 |
-
global CURRENT_RESUME_LATEX
|
| 73 |
-
CURRENT_RESUME_LATEX += summary_latex
|
| 74 |
-
response_message = "Now call the professional_experience_tool"
|
| 75 |
-
return response_message
|
| 76 |
-
|
| 77 |
-
@tool
|
| 78 |
-
def professional_experience(experiences: List[dict]) -> str:
|
| 79 |
-
"""
|
| 80 |
-
Creates an Experience section for a user.Processes the user work experiences across different companies and generates a string in latex form which will be used in further steps
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
Args:
|
| 84 |
-
experiences (list of dict): A list where each dict contains:
|
| 85 |
-
- company_name (required) (str): Name of the company.
|
| 86 |
-
- place (Optional) (str): Location of the company. If not mentioned in the resume then keep it as empty string "".
|
| 87 |
-
- period (required) (str): Employment duration (e.g., "Jan 2020 - Dec 2022").
|
| 88 |
-
- role (required) (str): Title or designation.
|
| 89 |
-
- bullet_points (required) (list of str): Key achievements/responsibilities. These points must be in ATS friendly format, quantifying things and following the STAR method(situation, task , action and result)(eg. reduced latency by 5ms, improved accuracy by 50%).
|
| 90 |
-
|
| 91 |
-
Returns:
|
| 92 |
-
str: Instruction for the next steps
|
| 93 |
-
"""
|
| 94 |
-
Experience_latex = r"""
|
| 95 |
-
|
| 96 |
-
\section{Professional Experience}
|
| 97 |
-
\resumeSubHeadingListStart
|
| 98 |
-
"""
|
| 99 |
-
for exp in experiences:
|
| 100 |
-
company = exp['company_name']
|
| 101 |
-
period = exp['period']
|
| 102 |
-
place = exp['place']
|
| 103 |
-
role = exp['role']
|
| 104 |
-
bullet_points = exp['bullet_points']
|
| 105 |
-
Experience_latex += rf"""
|
| 106 |
-
\resumeSubheading
|
| 107 |
-
{{{role}}}{{{period}}}
|
| 108 |
-
{{{company}}}{{{place}}}
|
| 109 |
-
\resumeItemListStart
|
| 110 |
-
|
| 111 |
-
"""
|
| 112 |
-
for item in bullet_points:
|
| 113 |
-
Experience_latex += rf"""
|
| 114 |
-
\resumeItem{{{item}}}
|
| 115 |
-
"""
|
| 116 |
-
Experience_latex += r"""
|
| 117 |
-
\resumeItemListEnd
|
| 118 |
-
|
| 119 |
-
\resumeSubHeadingListEnd
|
| 120 |
-
"""
|
| 121 |
-
Experience_latex = Experience_latex.replace("%","\%")
|
| 122 |
-
global CURRENT_RESUME_LATEX
|
| 123 |
-
CURRENT_RESUME_LATEX += Experience_latex
|
| 124 |
-
response_message = "Now call the projects tool"
|
| 125 |
-
return response_message
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
@tool
|
| 129 |
-
def projects(projects: List[dict]) -> str :
|
| 130 |
-
"""
|
| 131 |
-
Creates an projects section for a user. Processes the projects and generates a string in latex form which will be used in further steps
|
| 132 |
-
|
| 133 |
-
Args:
|
| 134 |
-
projects (list of dict): A list where each dict contains:
|
| 135 |
-
- project_name (required) (str): Name of the project.
|
| 136 |
-
- tools_used (required)(list[str]): Tools and technologies used in the project (eg Python, Flask, React, PostgreSQL, Docker). It is a list of strings.
|
| 137 |
-
- period (required)(str): Employment duration (e.g., "Jan 2020 - Dec 2022").
|
| 138 |
-
- bullet_points (required) (list of str): Key achievements/responsibilities.These points must be in ATS friendly format, quantifying things and following the STAR method(situation, task , action and result)(eg. reduced latency by 5ms, improved accuracy by 50%).
|
| 139 |
-
|
| 140 |
-
Returns:
|
| 141 |
-
str: Instruction for the next steps
|
| 142 |
-
"""
|
| 143 |
-
Projects_latex = r"""
|
| 144 |
-
|
| 145 |
-
\section{Projects}
|
| 146 |
-
\resumeSubHeadingListStart
|
| 147 |
-
"""
|
| 148 |
-
for project in projects:
|
| 149 |
-
project_name = project['project_name']
|
| 150 |
-
period = project['period']
|
| 151 |
-
tools = ", ".join(project['tools_used'])
|
| 152 |
-
bullet_points = project['bullet_points']
|
| 153 |
-
|
| 154 |
-
Projects_latex += rf"""
|
| 155 |
-
\resumeProjectHeading
|
| 156 |
-
{{\textbf{{{project_name}}} \textit{{| {tools}}}}}{{}}
|
| 157 |
-
\resumeItemListStart"""
|
| 158 |
-
|
| 159 |
-
for item in bullet_points:
|
| 160 |
-
Projects_latex += rf"""\resumeItem{{{item}}}"""
|
| 161 |
-
|
| 162 |
-
Projects_latex += r"""\resumeItemListEnd"""
|
| 163 |
-
|
| 164 |
-
Projects_latex += r"""\resumeSubHeadingListEnd"""
|
| 165 |
-
Projects_latex = Projects_latex.replace("%","\%")
|
| 166 |
-
|
| 167 |
-
global CURRENT_RESUME_LATEX
|
| 168 |
-
CURRENT_RESUME_LATEX += Projects_latex
|
| 169 |
-
response_message = "Now call the skills tool"
|
| 170 |
-
return response_message
|
| 171 |
-
|
| 172 |
-
@tool
|
| 173 |
-
def Education(education : List[dict]) -> str:
|
| 174 |
-
"""
|
| 175 |
-
Generates an Education section for the candidate. It generates a string which will be processed in the further steps.
|
| 176 |
-
|
| 177 |
-
Args:
|
| 178 |
-
education (list of dict): A list where each dict contains:
|
| 179 |
-
- Institute (required) (str): Name of the Institute.
|
| 180 |
-
- place (required)(str): Location of the Institute.
|
| 181 |
-
- period (required)(str): Education duration (e.g., "Jan 2020 - Dec 2022").
|
| 182 |
-
- specialization (required) (str): Specialization of education (e.g., "Bachelors in computer science", "Intermediate", "High School")
|
| 183 |
-
|
| 184 |
-
Returns:
|
| 185 |
-
str: Instruction for the next steps
|
| 186 |
-
"""
|
| 187 |
-
Education_latex = r"""
|
| 188 |
-
|
| 189 |
-
\section{Education}
|
| 190 |
-
\resumeSubHeadingListStart
|
| 191 |
-
"""
|
| 192 |
-
for edu in education:
|
| 193 |
-
institute_name = edu["Institute"]
|
| 194 |
-
place = edu["place"]
|
| 195 |
-
period = edu["period"]
|
| 196 |
-
specialization = edu["specialization"]
|
| 197 |
-
studies = rf"""
|
| 198 |
-
\resumeSubheading
|
| 199 |
-
{{{institute_name}}}{{{place}}}
|
| 200 |
-
{{{specialization}}}{{{period}}}
|
| 201 |
-
"""
|
| 202 |
-
Education_latex+=studies
|
| 203 |
-
Education_latex = Education_latex.replace("%","\%")
|
| 204 |
-
global CURRENT_RESUME_LATEX
|
| 205 |
-
CURRENT_RESUME_LATEX += Education_latex
|
| 206 |
-
response_message = "Now call the achievements tool"
|
| 207 |
-
return response_message
|
| 208 |
-
|
| 209 |
-
@tool
|
| 210 |
-
def achievements(achievements : List[str]) -> str:
|
| 211 |
-
"""
|
| 212 |
-
Generates an achievements section for the candidate's resume in LaTeX format.
|
| 213 |
-
|
| 214 |
-
Args:
|
| 215 |
-
achievements (List[str]): List of achievement strings to be included in the resume
|
| 216 |
-
|
| 217 |
-
Returns:
|
| 218 |
-
str: Instruction for the next steps
|
| 219 |
-
"""
|
| 220 |
-
achievements_latex = r"""
|
| 221 |
-
|
| 222 |
-
\section{Achievements}
|
| 223 |
-
\resumeItemListStart"""
|
| 224 |
-
|
| 225 |
-
for achievement in achievements:
|
| 226 |
-
achievements_latex += rf"""
|
| 227 |
-
\resumeItem{{{achievement}}}"""
|
| 228 |
-
|
| 229 |
-
achievements_latex += r"""
|
| 230 |
-
\resumeItemListEnd
|
| 231 |
-
|
| 232 |
-
\end{document}
|
| 233 |
-
"""
|
| 234 |
-
achievements_latex = achievements_latex.replace("%","\%")
|
| 235 |
-
global CURRENT_RESUME_LATEX
|
| 236 |
-
CURRENT_RESUME_LATEX += achievements_latex
|
| 237 |
-
response_message = "Created a file in your pc"
|
| 238 |
-
return response_message
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
def create_resume_agent(prompt: str):
|
| 242 |
-
try:
|
| 243 |
-
model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-exp",
|
| 244 |
-
api_key=os.getenv("GOOGLE_API_KEY"))
|
| 245 |
-
resume_agent =CodeAgent(
|
| 246 |
-
tools = [header_details,professional_summary,professional_experience,projects,skills,Education,achievements],
|
| 247 |
-
model = model
|
| 248 |
-
)
|
| 249 |
-
print(resume_agent)
|
| 250 |
-
resume_agent.run(prompt)
|
| 251 |
-
global CURRENT_RESUME_LATEX
|
| 252 |
-
print(CURRENT_RESUME_LATEX)
|
| 253 |
-
return CURRENT_RESUME_LATEX
|
| 254 |
-
except Exception as e:
|
| 255 |
return e
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, LiteLLMModel, tool
|
| 2 |
+
from pypdf import PdfReader
|
| 3 |
+
import google.generativeai as genai
|
| 4 |
+
import os
|
| 5 |
+
from typing import List
|
| 6 |
+
from utils import CURRENT_RESUME_LATEX
|
| 7 |
+
import os
|
| 8 |
+
import json
|
| 9 |
+
|
| 10 |
+
# config = json.load(open("config.json"))
|
| 11 |
+
# os.environ["GOOGLE_API_KEY"] = config["GOOGLE_API_KEY"]
|
| 12 |
+
|
| 13 |
+
@tool
|
| 14 |
+
def header_details(name: str, mobile_number: str, email_id: str, linkedin_profile_link : str, github_link: str) -> str:
|
| 15 |
+
"""
|
| 16 |
+
Generates header details of the person. It will display the name, mobile_number, email_id, linkedin profile and github profile
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
name(str): Name of the candidate
|
| 20 |
+
mobile_number(str): Mobile number of the candidate
|
| 21 |
+
email_id(str): email_id
|
| 22 |
+
linkedin_profile_link(str): Linkedin profile link of the candidate.
|
| 23 |
+
github_link(str): github link of the candidate.
|
| 24 |
+
|
| 25 |
+
Returns:
|
| 26 |
+
str: Instruction for the next steps
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
header_latex = r"""
|
| 30 |
+
|
| 31 |
+
\begin{center}
|
| 32 |
+
\textbf{\Huge \scshape """
|
| 33 |
+
header_latex+= name + r"""} \\ \vspace{1pt}
|
| 34 |
+
\small""" + mobile_number + r""" $|$ \href{mailto:x@x.com}{\underline{"""
|
| 35 |
+
header_latex+= email_id + r"""}} $|$
|
| 36 |
+
\href{https://linkedin.com/in/...}{\underline{"""
|
| 37 |
+
header_latex+=linkedin_profile_link + r"""}} $|$
|
| 38 |
+
\href{https://github.com/...}{\underline{"""
|
| 39 |
+
header_latex+=github_link + r"""}}
|
| 40 |
+
\end{center}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
"""
|
| 44 |
+
global CURRENT_RESUME_LATEX
|
| 45 |
+
CURRENT_RESUME_LATEX += header_latex
|
| 46 |
+
response_message = "Now call professional_summary_tool"
|
| 47 |
+
return response_message
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
@tool
|
| 51 |
+
def professional_summary(summary: str) -> str:
|
| 52 |
+
"""
|
| 53 |
+
Creates a Professional Experience summary section of the candidate.
|
| 54 |
+
|
| 55 |
+
Args:
|
| 56 |
+
summary (str): The generated summary should be in less than 4 lines. It should follow the STAR method while generating the summary. It should speak about the experience and the role he is applying for.
|
| 57 |
+
(e.g: Accomplished Gen AI Specialist with expertise in machine learning (ML), deep learning (DL), generative AI, and AI Agents, proficient in end-to end development from design to deployment. Skilled in problem-solving, data structures and algorithms (DSA), strong analytical abilities, and debugging complex systems. Passionate about optimizing ML model performance to deliver efficient, high-impact AI solutions. Adept at leveraging the full AI stack to drive innovation and achieve business objectives in fast-paced, technology-focused environments)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
Returns:
|
| 61 |
+
str: Instruction for the next steps
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
summary_latex = """
|
| 65 |
+
|
| 66 |
+
\section{Professional Summary}
|
| 67 |
+
"""
|
| 68 |
+
summary_latex += rf"""
|
| 69 |
+
{{{summary}}}
|
| 70 |
+
"""
|
| 71 |
+
summary_latex = summary_latex.replace("%","\%")
|
| 72 |
+
global CURRENT_RESUME_LATEX
|
| 73 |
+
CURRENT_RESUME_LATEX += summary_latex
|
| 74 |
+
response_message = "Now call the professional_experience_tool"
|
| 75 |
+
return response_message
|
| 76 |
+
|
| 77 |
+
@tool
|
| 78 |
+
def professional_experience(experiences: List[dict]) -> str:
|
| 79 |
+
"""
|
| 80 |
+
Creates an Experience section for a user.Processes the user work experiences across different companies and generates a string in latex form which will be used in further steps
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
Args:
|
| 84 |
+
experiences (list of dict): A list where each dict contains:
|
| 85 |
+
- company_name (required) (str): Name of the company.
|
| 86 |
+
- place (Optional) (str): Location of the company. If not mentioned in the resume then keep it as empty string "".
|
| 87 |
+
- period (required) (str): Employment duration (e.g., "Jan 2020 - Dec 2022").
|
| 88 |
+
- role (required) (str): Title or designation.
|
| 89 |
+
- bullet_points (required) (list of str): Key achievements/responsibilities. These points must be in ATS friendly format, quantifying things and following the STAR method(situation, task , action and result)(eg. reduced latency by 5ms, improved accuracy by 50%).
|
| 90 |
+
|
| 91 |
+
Returns:
|
| 92 |
+
str: Instruction for the next steps
|
| 93 |
+
"""
|
| 94 |
+
Experience_latex = r"""
|
| 95 |
+
|
| 96 |
+
\section{Professional Experience}
|
| 97 |
+
\resumeSubHeadingListStart
|
| 98 |
+
"""
|
| 99 |
+
for exp in experiences:
|
| 100 |
+
company = exp['company_name']
|
| 101 |
+
period = exp['period']
|
| 102 |
+
place = exp['place']
|
| 103 |
+
role = exp['role']
|
| 104 |
+
bullet_points = exp['bullet_points']
|
| 105 |
+
Experience_latex += rf"""
|
| 106 |
+
\resumeSubheading
|
| 107 |
+
{{{role}}}{{{period}}}
|
| 108 |
+
{{{company}}}{{{place}}}
|
| 109 |
+
\resumeItemListStart
|
| 110 |
+
|
| 111 |
+
"""
|
| 112 |
+
for item in bullet_points:
|
| 113 |
+
Experience_latex += rf"""
|
| 114 |
+
\resumeItem{{{item}}}
|
| 115 |
+
"""
|
| 116 |
+
Experience_latex += r"""
|
| 117 |
+
\resumeItemListEnd
|
| 118 |
+
|
| 119 |
+
\resumeSubHeadingListEnd
|
| 120 |
+
"""
|
| 121 |
+
Experience_latex = Experience_latex.replace("%","\%")
|
| 122 |
+
global CURRENT_RESUME_LATEX
|
| 123 |
+
CURRENT_RESUME_LATEX += Experience_latex
|
| 124 |
+
response_message = "Now call the projects tool"
|
| 125 |
+
return response_message
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@tool
|
| 129 |
+
def projects(projects: List[dict]) -> str :
|
| 130 |
+
"""
|
| 131 |
+
Creates an projects section for a user. Processes the projects and generates a string in latex form which will be used in further steps
|
| 132 |
+
|
| 133 |
+
Args:
|
| 134 |
+
projects (list of dict): A list where each dict contains:
|
| 135 |
+
- project_name (required) (str): Name of the project.
|
| 136 |
+
- tools_used (required)(list[str]): Tools and technologies used in the project (eg Python, Flask, React, PostgreSQL, Docker). It is a list of strings.
|
| 137 |
+
- period (required)(str): Employment duration (e.g., "Jan 2020 - Dec 2022").
|
| 138 |
+
- bullet_points (required) (list of str): Key achievements/responsibilities.These points must be in ATS friendly format, quantifying things and following the STAR method(situation, task , action and result)(eg. reduced latency by 5ms, improved accuracy by 50%).
|
| 139 |
+
|
| 140 |
+
Returns:
|
| 141 |
+
str: Instruction for the next steps
|
| 142 |
+
"""
|
| 143 |
+
Projects_latex = r"""
|
| 144 |
+
|
| 145 |
+
\section{Projects}
|
| 146 |
+
\resumeSubHeadingListStart
|
| 147 |
+
"""
|
| 148 |
+
for project in projects:
|
| 149 |
+
project_name = project['project_name']
|
| 150 |
+
period = project['period']
|
| 151 |
+
tools = ", ".join(project['tools_used'])
|
| 152 |
+
bullet_points = project['bullet_points']
|
| 153 |
+
|
| 154 |
+
Projects_latex += rf"""
|
| 155 |
+
\resumeProjectHeading
|
| 156 |
+
{{\textbf{{{project_name}}} \textit{{| {tools}}}}}{{}}
|
| 157 |
+
\resumeItemListStart"""
|
| 158 |
+
|
| 159 |
+
for item in bullet_points:
|
| 160 |
+
Projects_latex += rf"""\resumeItem{{{item}}}"""
|
| 161 |
+
|
| 162 |
+
Projects_latex += r"""\resumeItemListEnd"""
|
| 163 |
+
|
| 164 |
+
Projects_latex += r"""\resumeSubHeadingListEnd"""
|
| 165 |
+
Projects_latex = Projects_latex.replace("%","\%")
|
| 166 |
+
|
| 167 |
+
global CURRENT_RESUME_LATEX
|
| 168 |
+
CURRENT_RESUME_LATEX += Projects_latex
|
| 169 |
+
response_message = "Now call the skills tool"
|
| 170 |
+
return response_message
|
| 171 |
+
|
| 172 |
+
@tool
|
| 173 |
+
def Education(education : List[dict]) -> str:
|
| 174 |
+
"""
|
| 175 |
+
Generates an Education section for the candidate. It generates a string which will be processed in the further steps.
|
| 176 |
+
|
| 177 |
+
Args:
|
| 178 |
+
education (list of dict): A list where each dict contains:
|
| 179 |
+
- Institute (required) (str): Name of the Institute.
|
| 180 |
+
- place (required)(str): Location of the Institute.
|
| 181 |
+
- period (required)(str): Education duration (e.g., "Jan 2020 - Dec 2022").
|
| 182 |
+
- specialization (required) (str): Specialization of education (e.g., "Bachelors in computer science", "Intermediate", "High School")
|
| 183 |
+
|
| 184 |
+
Returns:
|
| 185 |
+
str: Instruction for the next steps
|
| 186 |
+
"""
|
| 187 |
+
Education_latex = r"""
|
| 188 |
+
|
| 189 |
+
\section{Education}
|
| 190 |
+
\resumeSubHeadingListStart
|
| 191 |
+
"""
|
| 192 |
+
for edu in education:
|
| 193 |
+
institute_name = edu["Institute"]
|
| 194 |
+
place = edu["place"]
|
| 195 |
+
period = edu["period"]
|
| 196 |
+
specialization = edu["specialization"]
|
| 197 |
+
studies = rf"""
|
| 198 |
+
\resumeSubheading
|
| 199 |
+
{{{institute_name}}}{{{place}}}
|
| 200 |
+
{{{specialization}}}{{{period}}}
|
| 201 |
+
"""
|
| 202 |
+
Education_latex+=studies
|
| 203 |
+
Education_latex = Education_latex.replace("%","\%")
|
| 204 |
+
global CURRENT_RESUME_LATEX
|
| 205 |
+
CURRENT_RESUME_LATEX += Education_latex
|
| 206 |
+
response_message = "Now call the achievements tool"
|
| 207 |
+
return response_message
|
| 208 |
+
|
| 209 |
+
@tool
|
| 210 |
+
def achievements(achievements : List[str]) -> str:
|
| 211 |
+
"""
|
| 212 |
+
Generates an achievements section for the candidate's resume in LaTeX format.
|
| 213 |
+
|
| 214 |
+
Args:
|
| 215 |
+
achievements (List[str]): List of achievement strings to be included in the resume
|
| 216 |
+
|
| 217 |
+
Returns:
|
| 218 |
+
str: Instruction for the next steps
|
| 219 |
+
"""
|
| 220 |
+
achievements_latex = r"""
|
| 221 |
+
|
| 222 |
+
\section{Achievements}
|
| 223 |
+
\resumeItemListStart"""
|
| 224 |
+
|
| 225 |
+
for achievement in achievements:
|
| 226 |
+
achievements_latex += rf"""
|
| 227 |
+
\resumeItem{{{achievement}}}"""
|
| 228 |
+
|
| 229 |
+
achievements_latex += r"""
|
| 230 |
+
\resumeItemListEnd
|
| 231 |
+
|
| 232 |
+
\end{document}
|
| 233 |
+
"""
|
| 234 |
+
achievements_latex = achievements_latex.replace("%","\%")
|
| 235 |
+
global CURRENT_RESUME_LATEX
|
| 236 |
+
CURRENT_RESUME_LATEX += achievements_latex
|
| 237 |
+
response_message = "Created a file in your pc"
|
| 238 |
+
return response_message
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
def create_resume_agent(prompt: str):
|
| 242 |
+
try:
|
| 243 |
+
model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-exp",
|
| 244 |
+
api_key=os.getenv("GOOGLE_API_KEY"))
|
| 245 |
+
resume_agent =CodeAgent(
|
| 246 |
+
tools = [header_details,professional_summary,professional_experience,projects,skills,Education,achievements],
|
| 247 |
+
model = model
|
| 248 |
+
)
|
| 249 |
+
print(resume_agent)
|
| 250 |
+
resume_agent.run(prompt)
|
| 251 |
+
global CURRENT_RESUME_LATEX
|
| 252 |
+
print(CURRENT_RESUME_LATEX)
|
| 253 |
+
return CURRENT_RESUME_LATEX
|
| 254 |
+
except Exception as e:
|
| 255 |
return e
|