logo
Menu
How to make AI News Summary Subscription Service

How to make AI News Summary Subscription Service

Provides customized news to customers by summarizing the news using the antique model.

Hyunjoong Shin
Amazon Employee
Published May 13, 2024

Purpose of development of AI News Summary Subscription Service

So much news is being generated in real time. Users want to receive news that they are interested in quickly and only important information. Therefore, to address this, users click on the categories they want to subscribe to directly and receive newsletters summarized in AI for related news.

Architecture Description

Image preview
1. In Streamlit, insert User Data, include email, category
2. Set up the Cron expression on EventBridge to run Lambda at a specific time.
3. When a certain time is triggered, DynamoDB gets information about users.
4. Use Bedrock to summarize the news information received from the external API.
5. We select and send only news that fits the category selected by the customer.

Prerequisites

- The AWS CLI must be credentialed (in the current example, use AdministratorAccess permissions)
- You must create a table in DynamoDB with Email as the key value.
- The IAM role used for AWS lambda must include DynamoDB Full Access, Bedrock Full Access, and SES Full Access.
- Email entering DynamoDB must be SES credentialed.

Step1. Setting Front

- You can put your email address and category in the form below.
- Install Streamlit from Python IDE to use Streamlit.
- Create a file called NewsFront.py from Python IDE and enter the code below.
- Install the following and bot3 to put the email address in DynamoDB and enter the code below
- Code to put your email address and options on the table. Please enter your own table. (NewsFront.py)
- Add a code that checks for duplication before inserting an email.

Step2. Setting Backend

- Generates the function from AWS Lambda function to the latest version of Python.
- In this case, the Lambda function must be created by attaching the IAM Role mentioned in the prerequisite. (DynamoDBFullAccess, BedrockFullAccess,SESFullAccess)
- After the AWS Lambda function is generated, modify the code as below: (Lambda function: Send_news)
- A code that receives the input of the prompt and outputs the result using clade-v2.
- Code that format documents to send to users in html format.
- Code that uses AWS SES to send an email to an account with SES credentials.
- Code that returns users' information (emails, categories) stored in DynamoDB.
- In the get_news function, data must be retrieved using the news API.
(Note: There is no news API service provided by Amazon, so this part needs to be set up personally.)

Step3. To set up a trigger

- Set the trigger using the cron expression.
- In the current example, the trigger is set to occur starting at 12:00 p.m. every day.

Step4. Test

- At a certain time, the news for the category selected by the user is summarized and emailed.

 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments