1) Open API appends quotation marks on function arguments 2) Open API don't utilize function calls 3) How to force multiple function calls?

I have three issues:

  1. When I force one function call, gpt seems to append quotes around the function arguments, even if I have specified how to input the arguments in the schema and toll it explicitly in the prompt to not include anything like this:
  role: 'assistant',
  content: null,
  function_call: {
    name: 'fetchAvailableURLs',
    arguments: '{"domains": ["NamingConnect.com", "DomainDwellers.com", "NameNavigator.com", "BrandingBeacon.com", "TrademarkTitan.com", "NameGnomes.com", "DomainDen.com", "DistinguishedDynamics.com", "BrandingBrigade.com", "SignatureSynergy.com"]}'

Results in the following error

Error in handleUserQuery: OpenAIError: Unexpected end of JSON input

This is how I’ve set up the schema

const runner = client.beta.chat.completions
        model: "gpt-4",
        messages: messages,
        functions: [
            function: fetchAvailableEndings,
            parameters: { type: "object", properties: {} },
            function: fetchAvailableURLs,
            parameters: {
              type: "object",
              properties: {
                domains: {
                  type: "array",
                    "Takes in an object with the key 'domains' containing an array of domains and will return which one of these domains that are available for purchase.",
                  items: {
                    type: "string",
              required: ["domains"],
        // function_call: "auto"
        // function_call: {'name': "fetchAvailableEndings"},

      .on("message", (message) => console.log(message));
  1. When I don’t force any of the functions, none of them seem to be called. It just tells me it’s going to use the functions in the response, but never actually do the call. It only do the function call if I specify it under “function_call”.
       'STEP 2: \n' +
    "Now, let's list the potential URL endings and check which ones are available.\n" +
    'Function call: functions.fetchAvailableEndings()\n' +
    '\n' +
  1. Would it be possible to force both function calls? As it only seems to call the functions when included in function_call, would it be possible to include more than one function call here?