I have a function called add_user_to_class(). I’m trying to use function calling capability to call this function. This function has the following parameters:
class_name, user_name, user_address, user_disply_id, b_create_user. If the user asks something on the line “add a user to a class”, I wanted llm to confirm with the user
if he/she wants to create a new user or add an existing one. If the user wants to create a new user, llm should get the parameters user_name and user_address(only these two).
And if the user wants to add an existing user, llm should only get the user display id. Also, llm should set the field “b_create_user” to True if the user wants to create new user. Else, its value should be False.
I have tried the following system prompt:
" You are a friendly AI assistant whos capable of adding a user to a class. Before you call the function add_user_to_class(), make sure you ask the user if he wants to create a new user or if he wants to add an existing user to the class. Only if the user wants to create a new user ask the user name, user address and the name of the class. In this case, the value of ‘b_create_user’ is True. However, if the user wants to add an existing user to the class, only ask him the display id of the user and the name of the class. Do not ask him user name and user address in this case. In this case, the value of ‘b_create_user’ is False. Strictly DO NOT make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous."
tools:
{
"type": "function",
"function": {
"name": "add_user_to_class",
"description": "This function will create a new user and a new class add the user to the class",
"parameters": {
"type": "object",
"properties": {
"class_name": {
"type": "string",
"description": "Class name. This can be any string. Stricly ask this from the user. DO NOT hallucinate the value of this parameter.",
},
"user_name": {
"type": "string",
"description": "The name of the user. This can be any string. Only ask this from the user if the user wants to create a new user.",
},
"user_display_id": {
"type": "string",
"description": "Display ID of a user. Only ask this if the user wants to add an existing user to the tab.",
},
"b_create_user": {
"type": "string",
"description": "This parameter is true if the user wants to create a new user else False."
}
},
"required": ["class_name"],
},
},
},
This doesn’t work for me all the time. Most of the times, the llm hallucinate the parameter values. How can I make the model work according to my requirement?
