Chat completions API fails consistently with a 500 error when using functions in combination with names

Description

When using the /v1/chat/completions endpoint in combination with name properties on each message and functions the endpoint becomes very unstable and after a while consistently returns a 500 internal server error.

Failing request example

The below request consistently fails.

I do a POST call to to the /v1/chat/completions endpoint

I give the following POST body

{
    "model": "gpt-3.5-turbo-16k-0613",
    "messages": [
        {
            "role": "system",
            "content": "You are an assistant called Maia. You are always open for a pleasant conversation. You love using emojies."
        },
        {
            "role": "user",
            "content": "I could actually use a bit of help understanding this Wikipedia page [LINK REDACTED] specifically I want to know more about public works and such he did. Can you help?",
            "name": "John"
        },
        {
            "role": "assistant",
            "content": "During his reign, Al-Walid I financed impressive public works, including:\n\nπŸ•Œ The construction of the Great Mosque of Damascus\nπŸ•Œ The construction of the al-Aqsa Mosque in Jerusalem\nπŸ•Œ The construction of the Prophet's Mosque in Medina\n\nHe also built way-stations and dug wells along the roads in Syria, installed street lighting in the cities, and invested in land reclamation projects. Additionally, he built numerous palaces, fortresses, and other buildings throughout the Umayyad Empire.",
            "name": "Maia"
        },
        {
            "role": "user",
            "content": "Ah thank you!",
            "name": "John"
        }
    ],
    "functions": [
        {
            "name": "QueryWebPage",
            "description": "Queries the giving web page for the requested information.",
            "parameters": {
                "type": "object",
                "properties": {
                    "url": {
                        "type": "string"
                    },
                    "question": {
                        "type": "string",
                        "description": "A human readable sentence describing what information you would like to retrieve from the web page."
                    }
                },
                "required": [
                    "url",
                    "question"
                ]
            }
        },
        {
            "name": "DoWebSearch",
            "description": "Performs a web search and returns a list of URLs fitting the search query.",
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {
                        "type": "string",
                        "description": "The search query."
                    }
                },
                "required": [
                    "query"
                ]
            }
        }
    ],
    "temperature": 0.5
}

What happens

I get a 500 internal server error with the following message: β€œThe server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error.”

However when I remove every name property for each message the request succeeds and I get a proper response.

What I would expect

The request should work with or without messages having a name property set.

3 Likes