-
Notifications
You must be signed in to change notification settings - Fork 346
Description
Describe the bug
Using the latest and passing an instance of ChatCompletionOptions with MaxOutputTokenCount set I get this error with most gpt-5 models except chat.
Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.
If I omit MaxOutputTokenCount simple options work
new ChatCompletionOptions { Temperature = 1, TopP = 1 },
but adding a data source that works with gpt-5-chat fails with gpt-5 or gpt-5-mini, throwing an HTTP 400 error at ChatCompletion chat = await _chatClient.CompleteChatAsync(...
var options = new ChatCompletionOptions()
{
Temperature = (float)0.9,
TopP = (float)0.95
};
#pragma warning disable AOAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
options.AddDataSource(new AzureSearchChatDataSource()
{
AllowPartialResults = true,
Strictness = 3,
TopNDocuments = 5,
InScope = !AllowGeneralKnowledge,
Endpoint = new Uri(AISearchUrl),
IndexName = AISearchIndex,
Authentication = DataSourceAuthentication.FromApiKey(AISearchApiKey), // Add your Azure AI Search admin key here
});
#pragma warning restore AOAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
Steps to reproduce
Use the ChatCompletionOptions object. Set MaxOutputTokenCount or add Tools and a DataSource.
Code snippets
OS
Windows
.NET version
.Net 9.0
Library version
2.5.0