When using the function-calling
API with GPT-4-turbo
and GPT-4o
models, redundant characters are removed from the function name in the response. In our current implementation, we use an ID
as the function name, making it unusable. This works with GPT-3.5
and GPT-4
models, but there is an issue with GPT-4-turbo and GPT-4o models.
Request body:
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Get me details of a blog authored by Dennis Ritchie, with title \"Why linux is the best OS\", which is published and is of version 1"
}
],
"max_tokens": 500,
"tools": [
{
"type": "function",
"function": {
"name": "60f092293f56478bb2cf1dbdb7e907cc",
"description": "This is a function which returns details about an blog with given details.\n\"author\": The authors name of the blog (type string, Eg: \"Daniel Ritchie\")\n\"title: The title of the blog (type string, Eg: \"Why windows 10 is better than windows 11\")\n\"published\": If the blog is published or not (type boolean, Eg: false)\n\"version\": Version of the blog (type number, Eg: 1)",
"parameters": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"published": {
"type": "boolean"
},
"title": {
"type": "string"
},
"version": {
"type": "number"
}
},
"required": [
"author",
"published",
"title"
]
}
}
}
]
}
Response Body:
[
{
"index": 0,
"message": {
"role": "assistant",
"tool_calls": [
{
"id": "call_2oSMOmki5buqE77H0p8ua1Fn",
"type": "function",
"function": {
"name": "60f092293f56478bb2cf1db7e907cc",
"arguments": "{\"author\":\"Dennis Ritchie\",\"published\":true,\"title\":\"Why linux is the best OS\",\"version\":1}"
}
}
]
},
"logprobs": null,
"finish_reason": "tool_calls"
}
]
In the request body, the function name is 60f092293f56478bb2cf1dbdb7e907cc
, but in the response, it changes to 60f092293f56478bb2cf1db7e907cc
, with dbdb
being shortened to db
.
Is there a way to fix this issue?