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.