Azure OpenAI Completion API vs Chat Completion API – Demystifying the Differences!
Contents
During OpenAI’s recent DevDay, a smaller but important announcement was JSON mode for GPT-4 and GPT-3.5 models! This means you can strictly tune the outputs from GPT models to produce JSON, pathing the way for structured data scenarios. This allows for capabilities such as, turning chat prompts into formatted orders for e-commerce applications or as I’ll explore today the use of GenAI for Data Science applications such as text analytics.
In this blog post, I’ll explore a hypothetical scenario in which we’ll pass customer customers reviews through the Azure OpenAI service to summarise not just review sentiment, but also recommended improvement steps that both a retailer and manufacturer could take based on the customer feedback. This scenario simply isn’t possible with traditional text models.
I haven’t done any data science work for several years now, but with the advent of GenAI Copilots the barrier to entry and in my case, re-entry has become significantly lower. To create this post, I leveraged the assistance of both ChatGPT and GitHub Copilot to fill gaps in my knowledge and to write and de-bug code. I was genuinely impressed with how much I could achieve with these tools, and I’ll include prompts and examples throughout.
Creating the Reviews
Before we can process reviews, we need to create them first. In a real-world situation, we would import reviews from Google or other aggregators, but for our hypothetical case, we’ll ask ChatGPT to generate some samples for us. I made 9 reviews in total: 3 positive, 3 neutral and 3 negative. I’m showing the prompt that I adjusted each time to produce different sentiments, and an example of a negative review. I then saved these reviews in a TXT file. In hindsight I could have done via the API, but this isn’t the focus step of the project.
The Prompt:
I’m creating sample data to experiment with text analytics capabilities. I would like you to create three positive reviews about a small portable BBQ from the brand Cookup that might show up on the review page of a retail store. Each review should have a comment about the store experience and or the product itself.
And a sample negative review:
“I got the Cookup Portable BBQ from Outdoor Essentials and it’s been a frustrating experience. The BBQ is flimsy, and the ignition system is unreliable. I tried to get assistance at the store, but the staff were dismissive and not helpful. Overall, a waste of money and time. I’ll be looking elsewhere for my outdoor cooking needs.”