Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: iOS - Content is null - 400 error #7221

Closed
jerry2007 opened this issue Jul 12, 2024 · 5 comments
Closed

Bug: iOS - Content is null - 400 error #7221

jerry2007 opened this issue Jul 12, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@jerry2007
Copy link

Describe the bug
When I call one of method InvokePromptAsync/GetChatMessageContentsAsync/GetStreamingChatMessageContentsAsync on iOS. The error is raised.

Microsoft.SemanticKernel.HttpOperationException
Invalid value for 'content': expected a string, got null.
Status: 400 (model_error)

Content:
{
"error": {
"message": "Invalid value for 'content': expected a string, got null.",
"type": "invalid_request_error",
"param": "messages.[0].content",
"code": null
}
}

Headers:
x-ms-region: REDACTED
apim-request-id: REDACTED
x-ratelimit-remaining-requests: REDACTED
x-ms-rai-invoked: REDACTED
X-Request-ID: REDACTED
ms-azureml-model-error-reason: REDACTED
ms-azureml-model-error-statuscode: REDACTED
Strict-Transport-Security: REDACTED
azureml-model-session: REDACTED
X-Content-Type-Options: REDACTED
x-envoy-upstream-service-time: REDACTED
x-ms-client-request-id: 7f2d2543-dde4-45fc-87c3-934a33753cee
x-ratelimit-remaining-tokens: REDACTED
Date: Fri, 12 Jul 2024 07:42:46 GMT
Content-Length: 187
Content-Type: application/json

To Reproduce
Steps to reproduce the behavior:

  1. In Maui iOS call InvokePromptAsync/GetChatMessageContentsAsync/GetStreamingChatMessageContentsAsync
  2. See error

Expected behavior
Can call these methods with no error

Platform

  • OS: iOS
  • IDE: Visual Studio
  • Language: C#
  • Source: NuGet package version 1.15.1
@jerry2007 jerry2007 added the bug Something isn't working label Jul 12, 2024
@alliscode
Copy link
Member

Hi @jerry2007 and thanks for filing this issue. Would you be able to share a snippet of the code that replicates this issue for us?

@jerry2007
Copy link
Author

` _history.AddUserMessage(question);
OpenAIPromptExecutionSettings openAIPromptExecutionSettings = new()
{
ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions,
Temperature = 0.2
};

var answer = "";
await foreach (var result in _chatCompletionService.GetStreamingChatMessageContentsAsync(
_history,
executionSettings: openAIPromptExecutionSettings,
kernel: _kernel,
CancellationToken.None))
{
answer += result?.Content;
yield return result?.Content;
}`

this code crash on line with foreach....

@jerry2007
Copy link
Author

this is related:
#6993

@jerry2007
Copy link
Author

I found out that downgrade nuget Azure.AI.OpneAI to version 1.0.0-beta.15 in semnatic kernel project Connectors.OpenAI works correctly.

Azure/azure-sdk-for-net#44174

@arafattehsin
Copy link
Contributor

Unfortunately, this issue not resolved in the latest versions. We use Structured Outputs which is not supported in earlier versions. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants