We are introduced to two useful tools for working with OpenAI. The first tool is a model selection tool called GPTTools.com's prompt compare tool.
It allows users to set up two API calls side by side using different models, helping in selecting the right model for a specific task. The lesson demonstrates how the tool compares the results of two different models when asked to describe Picasso's artistic style.
The second tool is the OpenAI Playground, an interactive platform where users can experiment with pre-written examples or create their own prompts. It allows users to see the results highlighted in green and provides the ability to view code snippets in different programming languages.
Using the OpenAI Playground may be more advantageous due to its compactness and the potential to move away from standard fetch requests and utilize the OpenAI dependency. Plan to refactor the fetch requests in the app to use the OpenAI dependency in the next scrim.
[00:00] I want to show you a couple of really useful tools that can help us work with OpenAI. The first one is particularly useful for model selection. This screenshot is from GPTTools.com and this is their prompt compare tool. And of course this slide is a clickable link which will take you through to their site.
[00:19] Now to use this tool you put your API key in right here and then it allows you to set up two API calls side by side using different models. So let's just ask OpenAI for a description of Pablo Picasso's artistic style. And there we are, I've put the same prompt on each side.
[00:39] Now for the first one I'll use the model or engine as they call it here of text DaVinci 003 which is the same as we're using in our app. And for the second one I'll use text Curie 001 which is one of the older models. Now down here underneath we've got plenty of other settings
[00:56] but I'm going to leave them all at their defaults, it will be the same on both sides. So now we can submit and see the results. The first one to come back is the Curie which figures the older simpler models are faster. Then we get back DaVinci. The big thing that we notice is that the texts are vastly differing in length.
[01:16] The newer model the DaVinci gives us way more words though it was slower. And we can actually see the speed difference right here. This one took 5.8 seconds and this one took just 1.1 seconds. Now in our project we are prioritizing language creation ability over speed and cost.
[01:34] So we're going to stick with text DaVinci 003 but it's good to know for future reference that you can do some experimentation with this tool when selecting a model to use. Although this answer is short, the language it provides is actually perfect human standard English.
[01:50] So remember those older models are not just there for legacy, they are actually really useful. Now the second tool I want to show you is back on OpenAI's website and it is the OpenAI Playground. And again this slide is a clickable link. Now the Playground is a really, really cool tool.
[02:10] You can select from some pre-written examples or you can just come in here and write your own prompts. Let's ask about Picasso again and when we click submit we can actually see the results we get highlighted in green. And this will allow you to practice with different models.
[02:25] Again you can change it right here but of course you won't be seeing the results side by side. It also does allow you to play with the various other settings some of which we'll be looking at later in this course. But what I think is the most useful thing here is that anytime you can come up here to where it says view code
[02:42] and get a code snippet including the prompt you're generating right now. It will actually give you that prompt in either Node.js, Python or curl. Now I've selected the Node.js snippet right here. If we look carefully we can see that it's not quite the same as the fetch request that we've already written.
[03:01] If we look at this first line it's using the require keyword to work with a dependency. So at the moment we couldn't just cut and paste this code as it is but we could use lots of it in our JS. We've got for example the prompt right here. But look the neatness and compactness of the API call being made here
[03:19] is definitely making me think that it's time to move away from the standard fetch request we've already written and move towards using the OpenAI dependency. In the long run this is going to save us time and allow us to do less work.
[03:33] In the next scrim let's go back to the app and refactor our fetch request to use the OpenAI dependency. When you're ready for that I'll see you there.