Error 400 related to size of string

openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “Invalid ‘tools[0].function.name’: string too long. Expected a string with maximum length 64, but got a string with length 102 instead.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘tools[0].function.name’, ‘code’: ‘string_above_max_length’}}

Any suggestions on how this could be resolved?

1 Like

Carefully read the error message. It tells you which parameter, which list element in the parameter, and which property is causing the error message it shows you.

I would look in the list of tools you are sending to the API, find the first tool in the list, look at the first name parameter, and see if it is 102 letters in length, which is longer than allowed.

It is possible that you didn’t properly use matching closing quotes or some other reason why the parsing sees a long string as the function name.

Hey thankyou for your explanation, even I was experiencing that, so is the default name for the action - 64? for me the name of my action was -


get_spacesspaceIdpageslimit1expandspacebodyviewbody-formatstorage

although it is 83 chars but it shows 70 chars error in the backend.

1 Like

also I am not using operation_id in our schema.
openapi: 3.0.3
info:
title: Azure Search Service API
description: API for searching documents using Azure Search Service.
version: 1.0.0
servers:

  • url: https://hiddenForPrivacy.search.windows.net
    paths:
    /indexes/searchindex/docs?api-version=2024-07-01:
    get:
    summary: Search Documents
    parameters:
    - name: api-key
    in: query
    required: true
    description: The API key for authentication.
    schema:
    type: string
    - name: api-version
    in: query
    required: true
    description: The API version to use.
    schema:
    type: string
    example: 2024-07-01
    - name: search
    in: query
    required: true
    description: The search query string.
    schema:
    type: string
    example: ‘*’
    responses:
    ‘200’:
    description: Successful response
    content:
    application/json:
    schema:
    type: object
    properties:
    odata.context:
    type: string
    value:
    type: array
    items:
    type: object
    properties:
    search.score:
    type: number
    id:
    type: string
    ‘401’:
    description: Unauthorized
    ‘404’:
    description: Index not found
    security:
    - apiKeyQuery:
    components:
    securitySchemes:
    apiKeyQuery:
    type: apiKey
    in: query
    name: api-key

Just by the addition of api version issue is occurring. but without it also api is incomplete