Try this function
{
name: 'get_weather',
description: 'Get weather from given locations and datetimes',
parameters: {
type: 'object',
properties: {
locations: {
type: 'array',
items: {
type: "object",
properties: {
name: { type: "string", description: "Name of location, e.g. San Francisco, CA" },
datetime: { type: "string", description: "Date or time, e.g. today, tomorrow, 2023-06-29" },
}
}
}
},
required: ['locations']
}
}
Using your sample inquiry, "What's the weather like in Boston, and what's the weather in Houston?"
, will get you:
{
role: 'assistant',
content: null,
function_call: {
name: 'get_weather',
arguments: '{\n' +
' "locations": [\n' +
' {\n' +
' "name": "Boston",\n' +
' "datetime": "2022-01-01T12:00:00"\n' +
' },\n' +
' {\n' +
' "name": "Houston",\n' +
' "datetime": "2022-01-01T12:00:00"\n' +
' }\n' +
' ]\n' +
'}'
}
}
If we modify the inquiry by adding time, "What's the weather like in Boston today, and what's the weather in Houston tomorrow?"
, will get you:
{
role: 'assistant',
content: null,
function_call: {
name: 'get_weather',
arguments: '{\n' +
' "locations": [\n' +
' {\n' +
' "name": "Boston",\n' +
' "datetime": "today"\n' +
' },\n' +
' {\n' +
' "name": "Houston",\n' +
' "datetime": "tomorrow"\n' +
' }\n' +
' ]\n' +
'}'
}
}