Here is a sample function calling
implementation of your use case.
A quick and dirty function definition:
{
name: 'get_inquiry',
description: 'Extract criteria from user text',
parameters: {
type: 'object',
properties: {
inquiries: {
type: 'array',
items: {
type: 'object',
properties: {
city: {
type: 'string',
description: 'Place or city, e.g. New York City'
},
criteria: {
type: 'string',
description: 'Criteria, e.g. age, gender',
enum: [
'age',
'gender'
]
},
condition: {
type: 'string',
description: 'Condition of criteria, e.g. =, >, >=, <=, <',
enum: [
'=',
'>',
'>=',
'<=',
'<'
]
}
}
}
}
},
required: ['inquiries']
}
}
Using your input:
All the people whose city is New York City and age ranges within 30 and 40 years
Response is:
{
role: 'assistant',
content: null,
function_call: {
name: 'get_inquiry',
arguments: '{\n' +
' "inquiries": [\n' +
' {\n' +
' "city": "New York City",\n' +
' "criteria": "age",\n' +
' "condition": ">=",\n' +
' "value": 30\n' +
' },\n' +
' {\n' +
' "city": "New York City",\n' +
' "criteria": "age",\n' +
' "condition": "<=",\n' +
' "value": 40\n' +
' }\n' +
' ]\n' +
'}'
}
}