How to give example outputs for nodejs openai? Mine isn't working

Hi guys!
I have prompt like this

Consider the following sentences:


{userHistory}


Summirize the sentences in a single JSON object with the keys “startDate”, “endDate”,“carName” and “carCategory”.
If car model and car category are not compatible, use the car model.’
carBrand should contain brands like BMW,Mercedes,Toyota etc. carName should contain names like BMW X5,Mercedes S class,Toyota Camry etc. carCategory should contain categories like sedan,suv,coupe etc in english.
Provides dates only if you found they.Format is ISO string.Year is 2023.
If the sentence does not contain a needed key, leave the field empty.
Here are some examples of the expected output:
1)Hi!I want to book a convertible car
Result
{
“startDate”: “”,
“endDate”: “”,
“carName”: “”,
“carCategory”: “convertible”
}
2)Old object
{
“startDate”: “2023-06-20T00:00:00.000Z”,
“endDate”: “2023-06-25T00:00:00.000Z”,
“carName”: “BMW”,
“carCategory”: “convertible”
}
User input: ‘Do you have g63?’
Result
{
“startDate”: “2023-06-20T00:00:00.000Z”,
“endDate”: “2023-06-25T00:00:00.000Z”,
“carName”: “g63”,
“carCategory”: “”
}
3)User input: ‘I want to book a g63 from 15 june on two days’
result
{
“startDate”: “2023-06-15T00:00:00.000Z”,
“endDate”: “2023-06-17T00:00:00.000Z”,
“carName”: “g63”,
“carCategory”: “”
}
User input: ‘Do you have cabriolets?’
Result
{
“startDate”: “2023-06-15T00:00:00.000Z”,
“endDate”: “2023-06-17T00:00:00.000Z”,
“carName”: “”,
“carCategory”: “convertible”
}
4)User input: ‘Хочу кабриолет с 15 по 21 июня’
result
{
“startDate”: “2023-06-15T00:00:00.000Z”,
“endDate”: “2023-06-21T00:00:00.000Z”,
“carName”: “”,
“carCategory”: “convertible”
}
User input: ‘Do you have Bentley?’
Result
{
“startDate”: “2023-06-15T00:00:00.000Z”,
“endDate”: “2023-06-17T00:00:00.000Z”,
“carName”: “Bentley”,
“carCategory”: “”
}
5)User input: ‘I want to book a Bentley from 15 june on two days’
result
{
“startDate”: “2023-06-15T00:00:00.000Z”,
“endDate”: “2023-06-17T00:00:00.000Z”,
“carName”: “Bentley”,
“carCategory”: “”
}
User input: ‘Do you have cabriolets?’
Result
{
“startDate”: “2023-06-15T00:00:00.000Z”,
“endDate”: “2023-06-17T00:00:00.000Z”,
“carName”: “”,
“carCategory”: “convertible”
}
6){user: ‘I need an convertible car in Rome from 18 june to 20’,
bot: {
“startDate”: “2023-06-18T00:00:00.000Z”,
“endDate”: “2023-06-20T00:00:00.000Z”,
“carName”: “”,
“carCategory”: “convertible”
},
user: ‘Ok. Do you have {carCategory} for same days?’,
bot: {
“startDate”: “2023-06-18T00:00:00.000Z”,
“endDate”: “2023-06-20T00:00:00.000Z”,
“carName”: “”,
“carCategory”: “{carCategory}”
},
user: ‘Ok show me {carModel}’,
bot: {
“startDate”: “2023-06-18T00:00:00.000Z”,
“endDate”: “2023-06-20T00:00:00.000Z”,
“carName”: “{carModel}”,
“carCategory”: “”
},
}
`

My examples not working as i expected. Especially the last one. Example:
“Hi! I want cabriolet from today for 5 days”. And because of last one ‘example’ bot return me JSON not with carCategory:“cabriolet”,but carCategory:“{carCategory}”

Use text-davinci-003

it’s saying that because that’s what is in the Users input, you don’t have to tell the AI that information, so long as you pass it all of the conversation it will make the inference for itself.

1 Like