Update app.py
Browse files
app.py
CHANGED
@@ -88,6 +88,7 @@ def generate_email_content(api_key, prompt):
|
|
88 |
if hasattr(response, 'choices') and len(response.choices) > 0:
|
89 |
email_content = response.choices[0].message.content
|
90 |
logging.info("Email content generated successfully.")
|
|
|
91 |
return email_content
|
92 |
else:
|
93 |
logging.error("Error: No choices found in the response.")
|
@@ -98,7 +99,18 @@ def generate_email_content(api_key, prompt):
|
|
98 |
|
99 |
# Function to validate the generated email for professional tone and completeness
|
100 |
def validate_email(email_content):
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
# Custom Agent class to simulate behavior similar to OpenAI's Swarm framework
|
104 |
class Agent:
|
|
|
88 |
if hasattr(response, 'choices') and len(response.choices) > 0:
|
89 |
email_content = response.choices[0].message.content
|
90 |
logging.info("Email content generated successfully.")
|
91 |
+
logging.info(f"Generated Email Content: {email_content}")
|
92 |
return email_content
|
93 |
else:
|
94 |
logging.error("Error: No choices found in the response.")
|
|
|
99 |
|
100 |
# Function to validate the generated email for professional tone and completeness
|
101 |
def validate_email(email_content):
|
102 |
+
logging.info("Validating email content...")
|
103 |
+
logging.info(f"Email Content for Validation: {email_content}")
|
104 |
+
|
105 |
+
# Adjust validation to check for structure rather than exact keywords
|
106 |
+
if ("passionate" in email_content and
|
107 |
+
"skills" in email_content and
|
108 |
+
"experience" in email_content):
|
109 |
+
logging.info("Email content validation passed.")
|
110 |
+
return True
|
111 |
+
else:
|
112 |
+
logging.info("Email content validation failed.")
|
113 |
+
return False
|
114 |
|
115 |
# Custom Agent class to simulate behavior similar to OpenAI's Swarm framework
|
116 |
class Agent:
|