GPT4 API call to return JSON then use it in second Call

Hey everyone,

Im using GPT 4 to recommend books, basically, the user inputs a book title, i then need it to do this:

recommend 3 books in json format, title, author.

I then want to pass these 3 books into another call to write a summary about how they all are themeatically related.

ive been using the ChatGPT/LLM Toolkit Plugin, its works a charm. Im limited in my knowledge as at the moment all i can get it to do is write the summary about the books together, but then i need the json to create another object from later.

so in short:
1-user input
2-3 books recommended in json
3a–write summary about books
3b–use json objects in step to create another object, individual book blurb

thanks in advance

Once you have the json for the three recommended books you pass that data into the new call. Request on that new message that it returns the summary in a json format {BookTittle1, Summary},{BookTitle2,Sumary},etc…

I have personally tried similar requests and it works like a charm

Its just a matter of figuring out the best way to get a consistent answer from GPT.

You can also use the ResponseFormat=Json in the API, still request on your message the json format response, but adding that tag in the api will ensure you get only json in the response

Then you can use a plugin like “Read JSON and Get Value by Key” which will help you get Summary of each book