Function calling, mutiple argument

Hello,

I am currently developing a service similar to Airbnb. I have some questions regarding integrating external services using OpenAI function calling.

  1. OpenAI does not recognize the word “currently.” For example, in Korea, today is March 10, 2025. However, when I ask OpenAI, “What’s today’s date?” it responds with an incorrect answer, such as “October 11, 2023.”
    To solve this, I implemented a function calling logic that provides today’s date. However, I later realized that function calling only allows a single function to be invoked per call, which prevents another function (for searching accommodations) from being executed.
  2. When I input the sentence:
    3.*“Find me a room for 2 ppl, 2 weeks from now for a month near NY university”**
    I want OpenAI to extract the arguments: now, 2 weeks, 2 ppl, and NY university.
    In this case, how should I structure multiple function calls to handle this properly?

I need to invoke both get_today and get_airbnb_api functions simultaneously—one to provide OpenAI with today’s date and the other to process the extracted arguments through function calling on the server. However, I am struggling to figure out how to implement this.

Thank you for reading.

Hi!

It’s pretty common practice to insert the call’s date (and perhaps time) dynamically into the system prompt or something.

Regarding multiple functions:

I guess we need to distinguish between parallel and sequential function calling.

There’s nothing inherently preventing multiple function calls being sent off in one go. If you use a more limited function interface, you might need to make use of the command/dispatcher pattern, but there’s nothing really stopping you.

But if the result of one function is needed as the input of another function, you can’t call stuff in parallel.

But there’s also nothing stopping you from having functions called in sequence. If you insert the function response into your chat, assuming proper prompting, the model will then call the next logical function in your workflow.

3.*“Find me a room for 2 ppl, 2 weeks from now for a month near NY university”**

I don’t know if you need multiple function calls for this.

If your function signature looks like

{
   start: string, // accepts "MMMM D, YYYY", "x days from today"
   duration?: string, // accepts "x days", "x weeks", must be set if end isn't set
   end?: string, // accepts "MMMM D, YYYY", "x days from today", must be set if duration isn't set
   location: string // where the user wants to go
}

you can just pluck the details apart in your program. The model should just be instructed to gather all necessary information before sending it off.

Does that help?

2 Likes

thank you for answer. and very helpful

umm… this is my function

{
“name”: “get_today”,
“description”: “Check the current date or provide specific date information. If the word “tomorrow” is entered, calculate and provide the information based on today’s date”,
“parameters”: {
“type”: “object”,
“properties”: {
“day”: {
“type”: “string”,
“description”: “The specific date to check. If empty, return today’s date. Example formats: ‘YYYY-MM-DD’, ‘today’, ‘tomorrow’, ‘yesterday’.”
}
},
“required”: [
“day”
]
}
}

“get_enkor_airbnb”: {
“name”: “get_enkor_airbnb”,
“description”: “Provide information if words such as “accommodation,” “lodging,” “reservation,” or “hotel search” are included”,
“parameters”: {
“type”: “object”,
“properties”: {
“livingType”: {
“type”: “string”,
“description”: “ex. private, coliving, both”
},
“houseType”: {
“type”: “string”,
“description”: “ex. studio, flat, enkorplex, hotel, communityLiving”
},
“checkInDate”: {
“type”: “string”,
“description”: “ex. 2024-12-05”
},
“checkOutDate”: {
“type”: “string”,
“description”: “ex. 2025-01-14”
},
“universities”: {
“type”: “string”,
“description”: “ex. yonsei, ewha”
},
“subway”: {
“type”: “string”,
“description”: “ex. 4122, 2735”
},
“guest”: {
“type”: “integer”,
“description”: “guest”
},
“enGu”: {
“type”: “string”,
“description”: “ex. Gwanak-gu, Gwangjin-gu”
}
},
“required”:
}
}
}

get_today is a function I created because OpenAI does not properly recognize words like “today,” “tomorrow,” “now,” etc., so it provides the correct date information.

get_airbnb is a function that retrieves accommodation information.

For example, if I ask OpenAI Assistant what today’s date is, it responds with an incorrect date.

That’s why I thought multiple function calls would be necessary.

I don’t think this logic can be handled with a single function call.

Am I wrong in thinking this?

:thinking:

1 Like

I already know that and have tried it before.

But there’s a problem.

When I ask for today’s date, it correctly responds with September 77th, 2187.

However, when I ask the same question the next day, it still responds with September 77th, 2187.

OpenAI doesn’t recognize that time has passed.

well yes, you have to swap out the system message with every request (or at least if the conversation goes stale)

2 Likes

To avoid modifying the system message with every request, I created a function called get_today on the application server and designed the assistant to respond with the time using function calling.

However, after implementing this, other functions are not being called, so I’m considering multiple function calling, but it’s proving to be more challenging than I expected.

Thanks for your response!

Echoing @diet, it’s much simpler, faster, and more economical to have a system message with the current datetime than having the model call a function to fetch it.

3 Likes

So, does that mean it’s more economical and faster to update the system message every day when the date changes?

I should look for a way to automate that.

Thanks for your input!

1 Like

You can update the system message with the current datetime just before making a chat completion call. There’s no need to complicate things.

3 Likes

Thank you for your feedback. As you mentioned, updating the system message for each chat completion request is the way to go.

1 Like