Hello,
I am building an Assistant API V2 with function calling and have encountered an issue where, given a user message, the assistant calls a function but experiences the following problems:
- The function is called twice.
- The thread gets stuck in the function and never ends.
I’ve provided the prompt, the function, and some test cases below.
Prompt:
You are an assistant tasked with obtaining contact details from user input. Note that the user may provide first and last names; in such cases, remove the last names before calling the function.
Follow these rules:
- Use `get_contacts_list` when the user first inputs a request to retrieve a list of contacts and select the one that best matches the user's message. If no results are found, create the object with the "create" flag set to true. If you are given a list, select the name that is closest to the one provided.
- Call the function only once at a time.
Function:
{
"name": "get_contacts_list",
"description": "Get the list of user's contacts. Use this function to retrieve a list of contacts and choose the one that best matches the user's input.",
"strict": false,
"parameters": {
"type": "object",
"properties": {
"firstname": {
"type": "string",
"description": "The name of the contact"
}
},
"required": [
"firstname"
]
}
}
User Message:
I've just talked with John Doe, and he is fine.
Tool Output:
[
{
"id": "123",
"firstname": "John",
"lastname": null,
"email": null
},
{
"id": "1234",
"firstname": "John",
"lastname": "Doe",
"email": "j_doe@icloud.com"
},
{
"id": "1",
"firstname": "John",
"lastname": "D.",
"email": null
},
{
"id": "2",
"firstname": "John",
"lastname": "Doe",
"email": "johndoe@gmail.com"
},
{
"id": "3",
"firstname": "John",
"lastname": "Smith",
"email": "johnsmith@example.com"
}
]
Regards,
Diego