Evaluate responses to make API calls

Hello there. That may be a broader question and forgive me in advance.

But here it goes anyway:
Is there a way to evaluate a response, to turn it into a json request for another backend’s api?

Let’s say for example you send a text with:
Create a reminder for tomorrow 9AM to make a call to Joe

and it will generate a response with
“timestamp”: “03-09-2023 09:00”,
“message”: “Call Joe”

Is this even possible?

Do I have to fine-tune it to reply only in json format?

Is that also possible?

Hi @guiramos

It can if it’s been trained on the API. IIRC the OpenAI plugin for excel used to the same.

You would need to specify the platform/API in the prompt to the model.

Can you please provide some example or link to it?

Sure! Just take a response and parse it to any JSON format you like.

No. You do not need to fine-tune a model to parse data to JSON format.

This is a very basic everyday coding task software developers have been doing long before OpenAI was incorporated…


I know that.

I dont want my users (they are not programmers) to be specific like that 'create json with this and that"

I’d like to them to ask simple questions like “make a reservation for 2 days starting March 10th at Marriot in Miami Beach”
This response should generate a json that will go to a backend to make the necessary api calls behind the scenes.

I’m usually just asking it to return data in the JSON format, and provide an example. Then I execute eval() or JSON.parse() on the response.