-
-
Notifications
You must be signed in to change notification settings - Fork 543
Open
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
Description
We have a Blazor Maui Hybrid app that's currently running on Windows, macOS, iOS, and Android. When making a call to OpenAIService.CreateCompletionAsStream() on an iOS device, the following exception occurs:
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Net.Http.HttpClientHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpMessageInvoker.Send(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at OpenAI.GPT3.Extensions.HttpClientExtensions.PostAsStreamAsync(HttpClient client, String uri, Object requestModel, CancellationToken cancellationToken)
at OpenAI.GPT3.Managers.OpenAIService.CreateCompletionAsStream(ChatCompletionCreateRequest chatCompletionCreateRequest, String modelId, CancellationToken cancellationToken)+MoveNext()
at OpenAI.GPT3.Managers.OpenAIService.CreateCompletionAsStream(ChatCompletionCreateRequest chatCompletionCreateRequest, String modelId, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
The problem appears to be that iOS does not support synchronous HTTP operations, so calling return client.Send(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken); in HttpClientExtensions.PostAsStreamAsync() results in an exception.
I'll look into this more deeply when I have a few minutes free, but from a cursor glance it looks like fixing this would require a significant refactor to make this operation truly asynchronous.
- OS: iOS 18.0 (22A5350a)
- Language: C#
- Version: 8.6.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested