Logo

azure-openai

#10474

pattern_mismatch_error

The function name does not match the expected pattern. Ensure it only includes letters, numbers, underscores, or hyphens.

This error has been identified and solved.

Reason

The 400 status error in the Azure OpenAI API, specifically the error message "Invalid 'messages.tool_calls.function.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'," is occurring due to the following reasons:

Invalid Function Name

The function.name field in the tool_calls array does not conform to the expected pattern. The pattern requires the string to consist only of letters (both uppercase and lowercase), numbers, underscores, and hyphens (^[a-zA-Z0-9_-]+$).

Request Validation

The API is strictly validating the input parameters, and any deviation from the expected format results in a 400 Bad Request error. This includes ensuring that the function name does not contain spaces, special characters, or non-Latin characters.

Solution

To fix the 400 status error in the Azure OpenAI API due to the invalid function.name pattern, you need to ensure the function name complies with the specified format. Here are the key actions to take:

  • Check and correct the function.name field to only include letters (both uppercase and lowercase), numbers, underscores, and hyphens.

  • Remove any spaces, special characters, or non-Latin characters from the function name.

  • Verify that the function name matches the pattern ^[a-zA-Z0-9_-]+$.

By ensuring the function name adheres to these guidelines, you can resolve the error and successfully submit your API request.

Original Error Message

Raw

The function name does not match the expected pattern. Ensure it only includes letters, numbers, underscores, or hyphens.

Original Error Message

Raw

The function name does not match the expected pattern. Ensure it only includes letters, numbers, underscores, or hyphens.

© 2024 Portkey, Inc. All rights reserved

HIPAA

COMPLIANT

GDPR

Transform Your AI app prototypes to be production-ready

Talk to us →