Skip to content

Error with MEAI 9.4.0-preview.1.25175.4 #6196

@JamesNK

Description

@JamesNK

Description

I tried out 9.4.0-preview.1.25175.4 and I got this error:

fail: Microsoft.Extensions.AI.LoggingChatClient[1784604714]
      GetStreamingResponseAsync failed.
      System.ClientModel.ClientResultException: HTTP 400 (invalid_request_error: invalid_function_parameters)
      Parameter: tools[3].function.parameters

      Invalid schema for function 'GetLogs': In context=('properties', 'name'), 'default' is not permitted.
         at OpenAI.ClientPipelineExtensions.ProcessMessageAsync(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
         at OpenAI.Chat.ChatClient.CompleteChatAsync(BinaryContent content, RequestOptions options)
         at OpenAI.Chat.ChatClient.<>c__DisplayClass10_0.<<CompleteChatStreamingAsync>b__0>d.MoveNext()
      --- End of stack trace from previous location ---
         at OpenAI.AsyncSseUpdateCollection`1.GetRawPagesAsync()+MoveNext()
         at OpenAI.AsyncSseUpdateCollection`1.GetRawPagesAsync()+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
         at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
         at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
         at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
         at Microsoft.Extensions.AI.OpenAIModelMappers.FromOpenAIStreamingChatCompletionAsync(IAsyncEnumerable`1 updates, CancellationToken cancellationToken)+MoveNext()
         at Microsoft.Extensions.AI.OpenAIModelMappers.FromOpenAIStreamingChatCompletionAsync(IAsyncEnumerable`1 updates, CancellationToken cancellationToken)+MoveNext()
         at Microsoft.Extensions.AI.OpenAIModelMappers.FromOpenAIStreamingChatCompletionAsync(IAsyncEnumerable`1 updates, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
         at Microsoft.Extensions.AI.LoggingChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)+MoveNext()

GetLogs is a function with a name parameter and it allows null.

[Description("Get logs.")]
private async Task<string?> GetLogs(
    [Description("The name. Optional.")]
    string? name = null,
    CancellationToken cancellationToken = default)
{
}

I haven't made any changes to my code other than updating to 9.4.0-preview.1.25175.4.

Endpoint is https://api.openai.com/v1

Reproduction Steps

Call GetStreamingResponseAsync

Expected behavior

AI response returned

Actual behavior

See error above.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Labels

area-aiMicrosoft.Extensions.AI librariesbugThis issue describes a behavior which is not expected - a bug.work in progress 🚧

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions