Try this:
{
name: 'UpdateRoles',
description: 'This function updates the roles of users. It accepts an array of objects. Each object should include a role name, an email address, and an action that specifies whether the role should be added or removed.',
parameters: {
type: 'object',
properties: {
role_users: {
type: 'array',
items: {
type: 'object',
properties: {
rolename: {
type: 'string',
enum: ['role1','role2','admin'],
description: 'The name of the role to be updated.',
},
email: {
type: 'string',
description: 'The email address of the user whose role is being updated.',
},
action: {
type: 'string',
enum: ['add', 'remove'],
description: "The action to be performed. 'add' to assign the role to the user, 'remove' to remove the role from the user.",
},
},
required: ['rolename', 'email', 'action'],
},
}
},
required: ['role_users'],
},
}
It returns like this:
{
role: 'assistant',
content: null,
function_call: {
name: 'UpdateRoles',
arguments: '{\n' +
' "role_users": [\n' +
' {\n' +
' "rolename": "role1",\n' +
' "email": "test@email",\n' +
' "action": "add"\n' +
' },\n' +
' {\n' +
' "rolename": "admin",\n' +
' "email": "mike@email",\n' +
' "action": "remove"\n' +
' }\n' +
' ]\n' +
'}'
}
}