I performed this project on behalf of the recall alerts company Consumer Safety Service, LLC. Consumer Safety Service aggregates recall information collected from several sources to better inform consumers of recall events. Since inception, this company has wanted to create a weekly newsletter that summarizes recall reports, but has not done so due to concerns associated with hiring a writer. With the advent of accessible ChatGPT API, this ambition became conceivable.
To extract recalls from Consumer Safety Service, translate the data into an object in Python, and utilize the ChatGPT API to summarize these recalls. Once summarized, to store these recalls in a location for later access. Then use ChatGPT API again to create a weekly news article, stored in another location for later access.
Consumer Safety Service offers an export method for their database recalls as a CSV file. After approval, I downloaded this CSV file, and selected a few samples to use for demonstration and testing purposes. Within the CSV file, a column exists that contains links which indicate where the recall alert originated from.
Using the pandas library in Python, I extracted the links within the column and assigned them to a dictionary. I accessed each website and stored the content as a database object using the requests library. Then I used both the BeautifulSoup and regular expressions libraries to clean the scraped content.
Following which, I utilized the ChatGPT API to summarize each recall which was subsequently stored in CSV files for every row, entitled “demo_summaries.” Although storing the information in the CSV file could be skipped, the summary of each individual recall may prove valuable for debugging purposes or analysis.
Then, I used the pandas library to store the “demo_summaries” CSV file as an object, summarized the content using ChatGPT API, similarly to before, and formatted the file into a PDF using the reportlab library entitled “demo_newspaper.”
Despite significant prompt-engineering with ChatGPT, the GPT3.5 Turbo engine does not appear to understand particular suggestions. For instance, despite several attempts to discourage ChatGPT from claiming that it lacks information or cannot access something, it occasionally continues to do so. Furthermore, ChatGPT often discusses incidents related to user health despite explicit instruction not to do so. I speculate this error arises in part due to the command to remain objective and unbiased; however, these particular commands should not be removed from the prompt.
Additionally, the database referenced particular websites that did not contain substantial information about the individual recall. Consequently, ChatGPT appropriately summarized that not a lot of information existed. Unfortunately, substantial alteration of the recall alert generation code and database falls outside the scope of this project.
Although any visitors to this website can download the code, it was meant for Consumer Safety Service and will require alteration to fit a different use case.
In consideration of unanticipated hurdles surrounding ChatGPT summation capacity, integration to Consumer Safety Service itself will require additional time due to legal concerns. Simply put, the summaries often contain problematic extrapolative information that have not been successfully removed with different prompts.
Once resolved, Consumer Safety Service has a preexisting scheduler that releases recall alerts periodically. By importing the code that I created, Consumer Safety Service can generate the newspaper at the same time as the recalls are stored to the database.
A demonstration of the code and a sample newspaper can be located at the following link:
Consumer Safety Service, LLC
I used assets authorized by Consumer Safety Service, LLC, and modified some of these assets, with permission, to create a demo file for proof of concept.
Open AI
I generated components of this project in part with GPT-3.5 Turbo, OpenAI's large-scale language-generation model. I reviewed the API output and take responsibility for said output insofar as no further modifications to the code occur. I further reviewed ChatGPT code suggestions for debugging purposes and implemented modified versions of these suggestions using my individual discretion. Components of this specific message were modified from Open AI's publicly accessible publication policy.
I do not condone the usage of these files to perpetuate misinformation. I do not take responsibility for the modification of these files. OpenAI has not endorsed or promoted this program in any capacity.
Copyright © 2023 Alexander Troisi - All Rights Reserved.
Powered by GoDaddy Website Builder