How do you use RAG in the REST API with GPT-5?

Ronald Wyman 76 Reputation points
2025-09-28T15:55:50.0566667+00:00

I have added an Azure Search Service index with the options for semantic configuration and a Vector Profile. When I execute the following REST request. The following error is raised. Does anyone have some insight into this result?

[Error Message] An error occurred when calling Azure OpenAI: Server responded with status 400. Error message: {

"error": {

"message": "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.",

"type": "invalid_request_error",

"param": "max_tokens",

"code": "unsupported_parameter"

}

}

As you can see, I make no reference to max_tokens. When I add max_completion_tokens, reasoning_effort, or verbosity, an error is raised indicating that these options are not supported.

My JSON Request
{

"messages": [

{

  "role": "system",

  "content": "My prompt here"

},

{

  "role": "user",

  "content": "show a bar chart"

}

],

"stop": null,

"stream": false,

"frequency_penalty": 0,

"presence_penalty": 0,

"temperature": 1,

"data_sources": [

{

  "type": "azure_search",

  "parameters": {

    "endpoint": "https:\/\/....search.windows.net",

    "index_name": "aisearch-indexset-42984f3678dd446fa51ee376e792c125",

    "query_type": "semantic",

    "semantic_configuration": "semantic-config",

    "strictness": 3,

    "top_n_documents": 10,

    "in_scope": true,

    "filter": "search.ismatch('LIB00000000000000*', 'dbdefid')",

    "fields_mapping": {

      "content_fields_separator": "\\n",

      "content_fields": [

        "content"

      ],

      "filepath_field": "dxlink",

      "title_field": "exportfilename",

      "url_field": "dxlink",

      "vector_fields": [

        "vector_content"

      ]

    },

    "authentication": {

      "type": "api_key",

      "key": "...."

    }

  }

}

]

}

Thank you in advance.
Ron

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
0 comments No comments
{count} vote

7 answers

Sort by: Most helpful
  1. Ronald Wyman 76 Reputation points
    2025-09-30T15:34:07.1233333+00:00

    Noted. We have also used this parameter and others and were sent errors that those parameters were not accepted either.

    We are only guessing here but I need to confirm that GPT-5 supports RAG.

    Thx

    Ron


  2. Ronald Wyman 76 Reputation points
    2025-10-15T12:23:40.44+00:00

    My original questions was never answered. If your unable to provide an answer you can close the request.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.