Update app.py
Browse files
app.py
CHANGED
@@ -69,7 +69,7 @@ class AutonomousEmailAgent:
|
|
69 |
- Candidate's Skills: {', '.join(self.skills)}
|
70 |
- Candidate's Experiences: {', '.join([exp['title'] for exp in self.experiences])}
|
71 |
|
72 |
-
Generate the email using this structure and ensure it is within {self.word_limit} words.
|
73 |
"""
|
74 |
|
75 |
return self.send_request_to_llm(reasoning_prompt)
|
@@ -116,11 +116,13 @@ class AutonomousEmailAgent:
|
|
116 |
paragraphs = [line.strip() for line in llm_response.split("\n") if line.strip()]
|
117 |
formatted_email = "\n\n".join(paragraphs)
|
118 |
|
119 |
-
#
|
120 |
words = formatted_email.split()
|
121 |
if len(words) > self.word_limit:
|
122 |
truncated_email = " ".join(words[:self.word_limit])
|
123 |
-
|
|
|
|
|
124 |
|
125 |
# Add the closing section with a call to action
|
126 |
closing_section = (
|
@@ -138,7 +140,7 @@ class AutonomousEmailAgent:
|
|
138 |
f"LinkedIn: {self.linkedin}"
|
139 |
)
|
140 |
|
141 |
-
# Ensure
|
142 |
if "Best regards" in formatted_email:
|
143 |
formatted_email = formatted_email.split("Best regards")[0].strip()
|
144 |
|
|
|
69 |
- Candidate's Skills: {', '.join(self.skills)}
|
70 |
- Candidate's Experiences: {', '.join([exp['title'] for exp in self.experiences])}
|
71 |
|
72 |
+
Generate the email using this structure and ensure it is within {self.word_limit} words, but complete the email logically.
|
73 |
"""
|
74 |
|
75 |
return self.send_request_to_llm(reasoning_prompt)
|
|
|
116 |
paragraphs = [line.strip() for line in llm_response.split("\n") if line.strip()]
|
117 |
formatted_email = "\n\n".join(paragraphs)
|
118 |
|
119 |
+
# Ensure the email stays within the word limit and retains logical coherence
|
120 |
words = formatted_email.split()
|
121 |
if len(words) > self.word_limit:
|
122 |
truncated_email = " ".join(words[:self.word_limit])
|
123 |
+
if not truncated_email.endswith((".", "!", "?")):
|
124 |
+
truncated_email += "..."
|
125 |
+
formatted_email = truncated_email
|
126 |
|
127 |
# Add the closing section with a call to action
|
128 |
closing_section = (
|
|
|
140 |
f"LinkedIn: {self.linkedin}"
|
141 |
)
|
142 |
|
143 |
+
# Ensure only one "Best regards" section and remove any duplicate signatures
|
144 |
if "Best regards" in formatted_email:
|
145 |
formatted_email = formatted_email.split("Best regards")[0].strip()
|
146 |
|