Multi-function calls gone wrong

I am trying to emulate multi function calls but the output is not as expected. What am I doing wrong? I used this thread as reference Emulated multi-function calls within one request

Here is my schema:

{
    name: "multiFunctionCalls",
    description: "Call two functions in one call",
    parameters: {
      type: "object",
      properties: {
        extractMeetingLog: {
          name: "extractMeetingLog",
          description:
            "Extract date, names of attendees and summary of the meeting.",
          parameters: {
            type: "object", // specify that the parameter is an object
            properties: {
              date: {
                type: "string", // specify the parameter type as a string
                description: "The date of the meeting, e.g 26 July 2023",
              },
              attendees: {
                type: "string", // specify the parameter type as a string
                description:
                  "Names of attendees in the meeting, ['John', 'Sanjay', 'Mary']",
              },
              summary: {
                type: "string", // specify the parameter type as a string
                description: "Summary of the meeting.",
              },
            },
            required: ["date", "attendees", "summary"],
          },
        },
        extractActionItems: {
          name: "extractActionItems",
          description:
            "Extract a list of action item objects from the meeting notes.",
          parameters: {
            type: "object",
            properties: {
              actionItems: {
                type: "array",
                items: {
                  type: "object",
                  properties: {
                    relatedTo: {
                      type: "string",
                      description:
                        "The name of the person or item the task is related to, e.g John Smith",
                    },
                    assignedTo: {
                      type: "string",
                      description:
                        "The person the task is assigned to, e.g Me, Mary Smith",
                    },
                    dueDate: {
                      type: "string",
                      description:
                        "The date when the task is due, e.g 28 July 2023",
                    },
                    action: {
                      type: "string",
                      description:
                        "The task which needs to be done, e.g Setup onboarding materials",
                    },
                  },
                },
              },
            },
            required: ["actionItems"],
          },
        },
      },
    },
  },

This is the response

{
  extractMeetingLog: {
    text: "Met with John Smith. His wife is Mary, daughter is Sarah, and son Henderson. He's 45 now and wanting to retire by 60. Has 100k in retirement savings. He just changed jobs to work as a Project Manager with IBM. Mary's email address for future reference is mary@gmail.com. As next steps, need to set up John's sample portfolio, and send him a follow-up with a reminder with the onboarding materials by Friday. Separately Mary was interested in learning more about the Soundwaters charity, send her a link to the site tomorrow."
  },
  extractActionItems: {
    text: "As next steps, need to set up John's sample portfolio, and send him a follow-up with a reminder with the onboarding materials by Friday. Separately Mary was interested in learning more about the Soundwaters charity, send her a link to the site tomorrow."
  }
}

And these are the function definitions

function extractMeetingLog({ date, attendees, summary }) {
  return { date: date, attendees: attendees, summary: summary };
}

function extractActionItems([{ relatedTo, assignedTo, dueDate, action }]) {
  return {
    relatedTo: relatedTo,
    assignedTo: assignedTo,
    dueDate: dueDate,
    action: action,
  };
}

function multiFunctionCalls(extractMeetingLog, extractActionItems) {
  const { date, attendees, summary } = extractMeetingLog;
  const { relatedTo, assignedTo, dueDate, action } = extractActionItems;
  const meetingLog = extractMeetingLog({ date, attendees, summary });
  const actionItems = extractActionItems([
    { relatedTo, assignedTo, dueDate, action },
  ]);
  return { log: meetingLog, actions: actionItems };
}

I honestly can’t figure out what I am doing wrong.

I’d like you to look at that function and see if you’d understand how to use it if all of the descriptions above the base un-nested level were deleted.

Because that’s the API: no descriptions of array items of deeper nesting than the first parameters are passed to the AI.

Take the example “weather” function, and go no deeper than the first tier of parameters.

Make the first parameter to be an enum:

  •  "type_of_api_extraction" [ "meeting log" | "action items" ]
    

Make the following parameters specific to the type:

  • meeting_log_date
  • meeting_log_attendee_names
  • …

And frankly - the type of elaborate content the AI would have to supply to one of these functions to make it work is just impractical to have in a chat format.

1 Like

What do you suggest I should do if this content is impractical? I made a few changes and now the api is returning the correct data in the desired format. I’ll change the parameter names. If I make the first parameter to be an enum wouldn’t the API just return one object? like either meeting log or action items? I want both of them to be returned.

The function just doesn’t seem practical. You should clarify the positioning and operation in your workflow.

Dear AI, please, based solely on what a user is writing:
Extract from an unknown list of meeting texts, but the AI has to supply:
All the participants in the meeting,
A summary of the meeting you know nothing about,
A meeting date.
and by the way, this function also does other stuff you should ignore…

That seems more like what should come out of a function than something that should be requested by an AI based on user inputs.