@@ -199,6 +199,16 @@ def run(
199199 return {"replies" : [ChatMessage .from_assistant (response .output_text )]}
200200
201201
202+ EMAIL_INTRO = """\
203+ Hello,
204+
205+ Here is your personalized report with resources your case manager recommends to support your goals.
206+ You've already taken a great first step by exploring these options.
207+
208+ **Your next step**: Look over the resources to see contact info and details about how to get started.
209+ """
210+
211+
202212@component
203213class EmailResult :
204214 """
@@ -210,7 +220,7 @@ def run(self, email: str, json_dict: dict) -> dict:
210220 logger .info ("Emailing result to %s" , email )
211221 logger .debug ("JSON content:\n %s" , json .dumps (json_dict , indent = 2 ))
212222 formatted_resources = self .format_resources (json_dict .get ("resources" , []))
213- message = f"Here are the resources you requested: \n \n { formatted_resources } "
223+ message = f"{ EMAIL_INTRO } \n { formatted_resources } "
214224
215225 # Send email via AWS SES
216226 subject = "Your Requested Resources"
@@ -225,14 +235,13 @@ def format_resources(self, resources: list[dict]) -> str:
225235 def format_resource (self , resource : dict ) -> str :
226236 return "\n " .join (
227237 [
228- f"{ resource .get ('name' , 'Unnamed Resource' )} " ,
238+ f"### { resource .get ('name' , 'Unnamed Resource' )} " ,
229239 f"- Referral Type: { resource .get ('referral_type' , 'None' )} " ,
230240 f"- Description: { resource .get ('description' , 'None' )} " ,
231241 f"- Website: { resource .get ('website' , 'None' )} " ,
232242 f"- Phone: { ', ' .join (resource .get ('phones' , ['None' ]))} " ,
233243 f"- Email: { ', ' .join (resource .get ('emails' , ['None' ]))} " ,
234244 f"- Addresses: { ', ' .join (resource .get ('addresses' , ['None' ]))} " ,
235- f"- Justification: { resource .get ('justification' , 'None' )} " ,
236245 ]
237246 )
238247
0 commit comments