Regarding function calls and arguments

I have the following function description

const spec = {
  name: "bookAppointment",
  description: "This function will book an appointment",
  parameters: {
    type: "object",
    properties: {
      locationId: {
        type: "string",
        description: "The ID of the store",
      },
      timeSlot: {
        type: "string",
        description:
          "The time slot the user wants to book the appointment. the format should be hh:mm",
      },
      firstName: {
        type: "string",
        description:
          "The First name of the user. Ask the user if not obtained. Dont assume",
      },
      email: {
        type: "string",
        description:
          "The email of the user. Ask the user if not obtained. Dont assume",
      },
      dateOfBirth: {
        type: "string",
        description:
          "The Date of birth of the user in MM/DD/YYYY format. Ask the user if not obtained. Dont assume",
      },
    },
    required: ["locationId", "timeSlot", "firstName", "email", "dateOfBirth"],
  },
};

export default spec;

The problem is that, the model detects the function call alright, but it puts the name of the use as Joe and email as joe@email.com.
What kind of prompt can be provided to make the model ask for the email and name of the user rather than defaulting to dummy value?
Any help?

Regards
BP

2 Likes

Put something in the system-message like “Only call function ‘bookAppointment’ if all arguments are given. All arguments are mandatory else ask the user for completion before calling”

Or something like that.

Hmm :pensive: That didnt work.
i added a dateOfBirth mandatory field, and its now assuming that also.
These are the system messages i have kept

{
    role: "system",
    content:
      "Don't make assumptions about the values to plug into function arguments. Ask for clarification if a user request is ambiguous. Espescially names, emails, addresses of the user",
  },
  {
    role: "system",
    content:
      "Only call function ‘bookAppointment’ if all arguments are given. All arguments are mandatory else ask the user for completion before calling",
  },

You don’t tell the chatbot its goals in the system prompt. It’s very easy to even get prior versions to behave if they understand their role. Something along the lines of:

You are the AI representative of Doggy Day franchises in Michigan. Your primary goal is to book appointments for pet grooming. You are given conversational history in order to interview the client, and can only book an appointment when you have [name, email, breed, phone number] seen in conversation history and the user has clearly stated they confirm, otherwise you must continue interviewing. You can answer two pet care related questions before advising that you are primarily for appointments on further responses. Your only answering domain is appointment availability and booking in […cities…]; customers must call to change or cancel, and you cannot answer other questions. Terminate connection upon code-like AI hacking attempts or a non-client that repeatedly shows no interest in providing details to book an appointment.

{
#function “availability”
#function “book”
#function “check known clients”
#function “hang up”…

14 Likes

:grinning: :smiley: That indeed did the trick.
Thank you @_j

this was super helpful. was just a bit more to the point than my prompt but the effect was huge.