Update app.py
Browse files
app.py
CHANGED
@@ -60,8 +60,11 @@ class AutonomousEmailAgent:
|
|
60 |
print("Autonomous Reasoning: Letting the LLM fully reason and act on available data...")
|
61 |
|
62 |
reasoning_prompt = f"""
|
63 |
-
You are an
|
64 |
-
|
|
|
|
|
|
|
65 |
Here’s the current data:
|
66 |
- LinkedIn profile: {self.linkedin_url}
|
67 |
- Company Name: {self.company_name}
|
@@ -70,11 +73,7 @@ class AutonomousEmailAgent:
|
|
70 |
- Candidate's Skills: {', '.join(self.skills)}
|
71 |
- Candidate's Experiences: {', '.join([exp['title'] for exp in self.experiences])}
|
72 |
|
73 |
-
|
74 |
-
1. "generate_email" to proceed with the email generation using available data.
|
75 |
-
2. "fallback" to use default values.
|
76 |
-
|
77 |
-
After generating the email, reflect on whether the content aligns with the role and company and whether any improvements are needed. Respond clearly with one of the above options.
|
78 |
"""
|
79 |
|
80 |
return self.send_request_to_llm(reasoning_prompt)
|
@@ -106,7 +105,7 @@ class AutonomousEmailAgent:
|
|
106 |
if choices and "message" in choices[0]:
|
107 |
content = choices[0]["message"]["content"]
|
108 |
print(f"Content: {content}")
|
109 |
-
return self.
|
110 |
else:
|
111 |
print("Error: Unrecognized format in LLM response.")
|
112 |
return "Error: Unrecognized response format."
|
@@ -117,33 +116,11 @@ class AutonomousEmailAgent:
|
|
117 |
print(f"Error: Unable to connect to Groq Cloud LLM. Status Code: {response.status_code}")
|
118 |
return "Error: Unable to generate response."
|
119 |
|
120 |
-
#
|
121 |
-
def
|
122 |
-
print(
|
123 |
-
instruction = reasoning_output.lower().strip()
|
124 |
-
|
125 |
-
if "generate_email" in instruction:
|
126 |
-
return self.generate_email()
|
127 |
-
|
128 |
-
elif "fallback" in instruction:
|
129 |
-
print("Action: Using fallback values for missing data.")
|
130 |
-
return self.generate_email()
|
131 |
-
|
132 |
-
else:
|
133 |
-
print("Error: Unrecognized instruction from LLM. Proceeding with available data.")
|
134 |
-
return self.generate_email()
|
135 |
-
|
136 |
-
# Generate email based on the collected data
|
137 |
-
def generate_email(self):
|
138 |
-
print("Generating email based on the provided and/or fallback data...")
|
139 |
email_content = f"""
|
140 |
-
|
141 |
-
|
142 |
-
Dear Hiring Manager,
|
143 |
-
|
144 |
-
I am excited to apply for the {self.role} role at {self.company_name}. With a strong background in {self.bio}, I believe my skills in {', '.join(self.skills)} would make me a valuable addition to your team.
|
145 |
-
|
146 |
-
Please find my LinkedIn profile for more details: {self.linkedin}
|
147 |
|
148 |
Best regards,
|
149 |
{self.user_name}
|
|
|
60 |
print("Autonomous Reasoning: Letting the LLM fully reason and act on available data...")
|
61 |
|
62 |
reasoning_prompt = f"""
|
63 |
+
You are an AI agent tasked with generating a job application email using Simon Sinek's Start with Why model.
|
64 |
+
The email must begin with why the candidate is passionate about the role, then explain how their skills and
|
65 |
+
experience align with the company and role, and finally describe specific achievements that demonstrate their
|
66 |
+
capabilities.
|
67 |
+
|
68 |
Here’s the current data:
|
69 |
- LinkedIn profile: {self.linkedin_url}
|
70 |
- Company Name: {self.company_name}
|
|
|
73 |
- Candidate's Skills: {', '.join(self.skills)}
|
74 |
- Candidate's Experiences: {', '.join([exp['title'] for exp in self.experiences])}
|
75 |
|
76 |
+
Generate the email using this structure and make it compelling and tailored to the company and role.
|
|
|
|
|
|
|
|
|
77 |
"""
|
78 |
|
79 |
return self.send_request_to_llm(reasoning_prompt)
|
|
|
105 |
if choices and "message" in choices[0]:
|
106 |
content = choices[0]["message"]["content"]
|
107 |
print(f"Content: {content}")
|
108 |
+
return self.generate_email(content)
|
109 |
else:
|
110 |
print("Error: Unrecognized format in LLM response.")
|
111 |
return "Error: Unrecognized response format."
|
|
|
116 |
print(f"Error: Unable to connect to Groq Cloud LLM. Status Code: {response.status_code}")
|
117 |
return "Error: Unable to generate response."
|
118 |
|
119 |
+
# Generate email based on the structured response
|
120 |
+
def generate_email(self, llm_response):
|
121 |
+
print("Generating email based on the structured response...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
email_content = f"""
|
123 |
+
{llm_response}
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
Best regards,
|
126 |
{self.user_name}
|