When I say everyone’s talking about ChatGPT, I mean everyone is talking about ChatGPT and everyone’s talking about prompting and how to get the most out of the model. But here at Make Data Useful, we’re all about making the data useful, solving problems, and automating tasks. And that’s where the ChatGPT API really shines. So let’s log into the OpenAI Playground and explore how we can use the API to clean up messy addresses.
In the OpenAI Playground, you’ll see a system message and a user message on the right-hand side. We’ll provide an input address in valid JSON format and instruct ChatGPT to take on the role of an address cleaner. We’ll test it with a real-world example: 242 Exhibition Street, Melbourne. The expected output is the street number, street name, city, state, postcode, and country.
The response from ChatGPT is a JSON object with the message, role, and content. We can extract the content and convert it into a dictionary using the JSON module in Python. This allows us to easily access the output address fields.
Using the ChatGPT API, we can automate the cleaning of thousands of messy addresses by providing the input address and receiving a structured JSON payload with the cleaned address fields. This saves time and effort, leaving only a few addresses to be manually reviewed.
To implement this in Python, we can use the provided code in the OpenAI Playground and modify it to fit our needs. By creating a Python API, we can automate the address cleaning process and scale it to handle large volumes of data.
In conclusion, the ChatGPT API is a powerful tool for automating tasks like address cleaning. By leveraging the API, we can save time and effort in cleaning messy addresses and obtain structured and accurate address information. With the ability to scale the process using Python, we can handle thousands of addresses efficiently. Try it out and see how it can make your data more useful!