DEV Community

Cover image for 🚨OpenAi secret you should know 🚨
Andrii
Andrii

Posted on

🚨OpenAi secret you should know 🚨

I think almost everyone in the dev.to community has given OpenAI prompts a shot in the past year.😂

The first time I made a prompt, I was excited to see the results. After a few tries, I got some ideas and thought about creating a few AI products.🚀

The first tool I tried to build was for keeping an eye on crypto news 💸. It was a simple idea: analyze RSS feeds, collect content, and send it to AI for summarization. To get useful insights for crypto investments, we needed to analyze a lot of information. The best way to understand the data was to make charts. But to make a chart, we needed metrics. So, we decided to create a prompt with JSON output containing metrics. My metric was simple: a scale from 1 to 5, showing whether to buy a coin or not (1 means "should not buy," and 5 means "all in").

We launched the first version of the tool, looked at cryptonews for two weeks, and saw that the chart was completely empty. I checked a few log records and found out the results had invalid JSON. That disappointment led to a good idea that has helped me make many successful JSON prompts. In the System section, make sure to tell the AI that it's a RESTful JSON API and give an example of the output. You can see my example in the screenshots below.

Image description
Image description

After these updates, the results were really good. I finally got a useful chart. So, the main trick with OpenAI is to use it like a RESTful JSON API.

Give it a try yourself with my example at https://gpt-sdk.com. Just create a free account and explore what you can do.

Top comments (2)

Collapse
 
ravavyr profile image
Ravavyr

What I see here is, you gave it a bad prompt, and now you kinda fixed your prompt. The english in the prompt is still not great though which may or may not affect the results.

How about you try this as a prompt and see what you get:

Your input is [news content], it's news about a crypto currency. Take the input and determine its persuasiveness as an integer value ranging from 1 to 5 where 1 means "do not buy the coin" and 5 means "go all in on this coin". Return a json object containing the "persuasiveness" value and the "tokenCode" value where the tokenCode is the primary token code discussed in the input data.

I'm curious if it works any better :)

Collapse
 
andriimz profile image
Andrii

@ravavyr
I tried, and the result is quite similar to the first one.
I believe there should be more metrics to assess the quality of analytics. However, when I tested it on the batch of news, I observed the same JSON structure for each input, and that's a win for this case 😄

Image description