Assistant which has multiple functions in one, returns the output in a couple of requests instead of one

Hey, I’m building an assistant for a couple of days now, i tried building it step by step because the end product should be big.
earlier i had 2 functions as one and it worked great giving me the output as one long JSON,
I’ve added another function today which caused me some trouble but once switching from GPT-4o-mini to GPT-4o everything worked great when still outputting the result as one big json
now I added the fourth function and it outputs a json for each function seperately, in 4 different requests it seems.

my schema looks something like this( its a shortened version because my descriptions for each function are quite long, and work great):

{
   name: get_user_inquiry,
   description: Get four labels from the user's prompt,
   strict: true,
   parameters: {
      type: string,
      properties: {
         metric: {
            type: string,
            description: Get the metric from the user. Call this whenever you need to know the metric, for example......
            enum: [profit, revenue, roi]
         },
         media: {
            type: string,
            description: Get the media from the user. Call this whenever you need to know the media, for example......
            enum: [facebook, instagram, tiktok]
         },
         date: {
            type: string,
            description: Get the date from the user. Call this whenever you need to know the date, for example......
            enum: [this_month, this_week, today]
         },
         filter: {
            type: string,
            description: Return from the user's input, an array of json's that I can use to get the key, condition, and value the user want to filter, you have to use the following attributes: KEY, CONDITION, VALUE for each json ........
         }
      },
      params: {
         type: array,
         items: {
            type: string
         }
      },
      required: [metric, date, media, filters],
      additionalProperties: false
   }
}

before adding the filters function, the output was good and all the functions wokred great and i got one json in one request that contains the answers to all the functions.
Now i get a json for the first function in one request then immediately a new request with a json for the next function etc…

1 Like

SOLVED:
I added the following line to the system instructions

you have to use your given functions to classify what the user is asking for, based on the labels given to you and return ONE JSON ready to be parsed