Update app.py
Browse files
app.py
CHANGED
|
@@ -80,8 +80,10 @@ class Agent:
|
|
| 80 |
company_info = fetch_company_info(self.user_data['company_url'])
|
| 81 |
return linkedin_info, company_info
|
| 82 |
elif self.name == "Email Generation Agent":
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
| 85 |
email_content = generate_email_content(OPENAI_API_KEY, prompt)
|
| 86 |
return email_content
|
| 87 |
|
|
@@ -122,8 +124,15 @@ def run_agent(name, email, phone, linkedin_url, company_url, role):
|
|
| 122 |
if isinstance(linkedin_info, str): # If an error message is returned
|
| 123 |
return linkedin_info
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
# Pass the collected data to the Email Generation Agent
|
| 126 |
-
email_agent = Agent("Email Generation Agent", "Generate the email content",
|
| 127 |
email_content = email_agent.act()
|
| 128 |
|
| 129 |
# Validate and refine the email using a ReAct pattern with a maximum of 3 iterations
|
|
|
|
| 80 |
company_info = fetch_company_info(self.user_data['company_url'])
|
| 81 |
return linkedin_info, company_info
|
| 82 |
elif self.name == "Email Generation Agent":
|
| 83 |
+
user_data = self.user_data['user_data']
|
| 84 |
+
linkedin_info = self.user_data['linkedin_info']
|
| 85 |
+
company_info = self.user_data['company_info']
|
| 86 |
+
prompt = structure_email(user_data, linkedin_info, company_info)
|
| 87 |
email_content = generate_email_content(OPENAI_API_KEY, prompt)
|
| 88 |
return email_content
|
| 89 |
|
|
|
|
| 124 |
if isinstance(linkedin_info, str): # If an error message is returned
|
| 125 |
return linkedin_info
|
| 126 |
|
| 127 |
+
# Create a structured dictionary for the Email Generation Agent
|
| 128 |
+
agent_data = {
|
| 129 |
+
"user_data": user_data,
|
| 130 |
+
"linkedin_info": linkedin_info,
|
| 131 |
+
"company_info": company_info
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
# Pass the collected data to the Email Generation Agent
|
| 135 |
+
email_agent = Agent("Email Generation Agent", "Generate the email content", agent_data)
|
| 136 |
email_content = email_agent.act()
|
| 137 |
|
| 138 |
# Validate and refine the email using a ReAct pattern with a maximum of 3 iterations
|