Reduce the number of function_calling

Hi, I need some help. I’m using an assistant configured with “Function Calling,” and the goal is to ask questions about various institute programs and receive the relevant information in return.

My problem is that instead of making a single call to the get_data function with all the programs (and their codes) and all the requested data, the assistant splits the request into multiple calls, which slows down the response process.

For example, I need a single call like this:
get_data({"programs": "IL, IME, II", "search": "description, duration, campus"})

But instead, the assistant makes multiple separate calls, such as: get_data({"programs": "IL", "search": "description, duration, campus"})
get_data({"programs": "IME", "search": "description, duration, campus"})
get_data({"programs": "II", "search": "description, duration, campus"})

Or it may do something like this:
get_data({"programs": "IL, IME, II", "search": "description"})
get_data({"programs": "IL, IME, II", "search": "duration"})
get_data({"programs": "IL, IME, II", "search": "campus"})

This repetition of calls is slowing down my system.

Is there a way to limit the number of calls the assistant makes to the same function? (I have other functions that can be called in parallel without any issue).

make programs and search properties into array. it probably have a difficulty outputting items delimited with comma. if you need multiple items, always use array. in your case, either make both as arrays or make an array of object { programs, search }.

Try changing your programs param from str to list[str] then in the request body set parallel_tool_calls to False.

I’ve used a function call definition like this to allow ChatGPT to pass me multiple items in a single function call, and it works great.

{"name":"MyFunctionName","description":"My function description.","parameters":{"type":"object","properties":{"firstNames":{"type":"array","description":"An array of first names like \"Don\" or \"James\" or \"Tom\".","items":{"type":"object","properties":{"firstName":{"type":"string","description":"A person's first name like \"Don\" or \"James\" or \"Tom\"."}}},"required":["firstName"]}},"required":["firstNames"]}}