Update app.py
Browse files
app.py
CHANGED
@@ -25,9 +25,7 @@ class AutonomousEmailAgent:
|
|
25 |
proxycurl_api_key = os.getenv("PROXYCURL_API_KEY")
|
26 |
if not self.linkedin_url:
|
27 |
print("Action: No LinkedIn URL provided, using default bio.")
|
28 |
-
self.
|
29 |
-
self.skills = ["Adaptable", "Hardworking"]
|
30 |
-
self.experiences = ["Worked across various industries"]
|
31 |
else:
|
32 |
print("Action: Fetching LinkedIn data via Proxycurl.")
|
33 |
headers = {"Authorization": f"Bearer {proxycurl_api_key}"}
|
@@ -57,10 +55,10 @@ class AutonomousEmailAgent:
|
|
57 |
print("Autonomous Reasoning: Letting the LLM fully reason and act on available data...")
|
58 |
|
59 |
reasoning_prompt = f"""
|
60 |
-
You are an AI agent tasked with generating a job application email using Simon Sinek's Start with Why model.
|
61 |
-
The email must
|
62 |
experience align with the company and role, and finally describe specific achievements that demonstrate their
|
63 |
-
capabilities.
|
64 |
|
65 |
Here’s the current data:
|
66 |
- LinkedIn profile: {self.linkedin_url}
|
@@ -70,7 +68,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 |
"""
|
75 |
|
76 |
return self.send_request_to_llm(reasoning_prompt)
|
@@ -142,20 +140,17 @@ class AutonomousEmailAgent:
|
|
142 |
truncated_email = " ".join(words[:self.word_limit]) + "..."
|
143 |
formatted_email = truncated_email
|
144 |
|
145 |
-
# Add
|
146 |
closing_section = (
|
147 |
-
"\n\nI would
|
148 |
-
"
|
149 |
-
"Thank you for considering my application. I look forward to
|
150 |
)
|
151 |
|
152 |
# Prepare the signature
|
153 |
signature = (
|
154 |
-
f"Best regards,\n"
|
155 |
-
f"{self.
|
156 |
-
f"Email: {self.email}\n"
|
157 |
-
f"Phone: {self.phone}\n"
|
158 |
-
f"LinkedIn: {self.linkedin}"
|
159 |
)
|
160 |
|
161 |
# Ensure only one "Best regards" section and remove any duplicate signatures
|
@@ -165,12 +160,14 @@ class AutonomousEmailAgent:
|
|
165 |
return f"{formatted_email}{closing_section}\n{signature}"
|
166 |
|
167 |
def generate_fallback_email(self):
|
168 |
-
# Generate a
|
169 |
return f"""Subject: Application for {self.role} at {self.company_name}
|
170 |
|
171 |
Dear Hiring Manager,
|
172 |
|
173 |
-
I am excited to apply for the {self.role} position at {self.company_name}. My experience and
|
|
|
|
|
174 |
|
175 |
Best regards,
|
176 |
{self.user_name}
|
|
|
25 |
proxycurl_api_key = os.getenv("PROXYCURL_API_KEY")
|
26 |
if not self.linkedin_url:
|
27 |
print("Action: No LinkedIn URL provided, using default bio.")
|
28 |
+
self.use_default_profile()
|
|
|
|
|
29 |
else:
|
30 |
print("Action: Fetching LinkedIn data via Proxycurl.")
|
31 |
headers = {"Authorization": f"Bearer {proxycurl_api_key}"}
|
|
|
55 |
print("Autonomous Reasoning: Letting the LLM fully reason and act on available data...")
|
56 |
|
57 |
reasoning_prompt = f"""
|
58 |
+
You are an AI agent tasked with generating a professional job application email using Simon Sinek's Start with Why model.
|
59 |
+
The email must start with why the candidate is passionate about the role, then explain how their skills and
|
60 |
experience align with the company and role, and finally describe specific achievements that demonstrate their
|
61 |
+
capabilities. Make sure the email encourages the employer to engage further and ends on a positive note.
|
62 |
|
63 |
Here’s the current data:
|
64 |
- LinkedIn profile: {self.linkedin_url}
|
|
|
68 |
- Candidate's Skills: {', '.join(self.skills)}
|
69 |
- Candidate's Experiences: {', '.join([exp['title'] for exp in self.experiences])}
|
70 |
|
71 |
+
Ensure the email is formatted correctly and adheres to a maximum of {self.word_limit} words.
|
72 |
"""
|
73 |
|
74 |
return self.send_request_to_llm(reasoning_prompt)
|
|
|
140 |
truncated_email = " ".join(words[:self.word_limit]) + "..."
|
141 |
formatted_email = truncated_email
|
142 |
|
143 |
+
# Add a call to action in the closing section
|
144 |
closing_section = (
|
145 |
+
"\n\nI would love the opportunity to discuss how my background and skills align with the goals of "
|
146 |
+
f"{self.company_name}. I am eager to contribute and support the mission of your organization.\n\n"
|
147 |
+
"Thank you for considering my application. I look forward to hearing from you.\n"
|
148 |
)
|
149 |
|
150 |
# Prepare the signature
|
151 |
signature = (
|
152 |
+
f"Best regards,\n{self.user_name}\n"
|
153 |
+
f"Email: {self.email}\nPhone: {self.phone}\nLinkedIn: {self.linkedin}"
|
|
|
|
|
|
|
154 |
)
|
155 |
|
156 |
# Ensure only one "Best regards" section and remove any duplicate signatures
|
|
|
160 |
return f"{formatted_email}{closing_section}\n{signature}"
|
161 |
|
162 |
def generate_fallback_email(self):
|
163 |
+
# Generate a more impactful fallback email if max attempts are reached
|
164 |
return f"""Subject: Application for {self.role} at {self.company_name}
|
165 |
|
166 |
Dear Hiring Manager,
|
167 |
|
168 |
+
I am excited to apply for the {self.role} position at {self.company_name}. My experience in business development and leadership has prepared me to make a significant impact in this role. I have led global marketing efforts, managed international teams, and developed strategic initiatives that align closely with the goals of your organization.
|
169 |
+
|
170 |
+
I would appreciate the opportunity to discuss how my skills can contribute to {self.company_name}'s mission and success. Please feel free to contact me at your earliest convenience.
|
171 |
|
172 |
Best regards,
|
173 |
{self.user_name}
|