Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.29k stars 1.96k forks source link

[BUG] ChatRequestUserMessage content is binaryData #40730

Closed BorangaziyevA closed 4 weeks ago

BorangaziyevA commented 2 months ago

There is a bug where ChatRequestSystemMessage.content is a String, while ChatRequestUserMessage.content is binaryData. Due to this, OpenAI cannot decode text in UTF-8 when sending ChatRequestUserMessage with russian or kazakh languages.

Response from OpenAi: I am sorry, but I cannot recognize your message. Please describe your question in Russian or Kazakh so that I can help you.

To Reproduce Give non-English text in ChatRequestUserMessage to OpenAi

Expected behavior I expected both ChatRequestSystemMessage and ChatRequestUserMessage contents to be interpreted as String, allowing OpenAI to correctly process text in Russian or Kazakh.

Code Snippet:

        chatMessages.add(new ChatRequestSystemMessage("You're an assistant who helps answer user questions. Decode the user's message. The user writes questions in Russian or Kazakh, answer in the language in which the user wrote. "));
        chatMessages.add(new ChatRequestUserMessage("Как у тебя дела?"));

Setup: OS: macOS IDE: IntelliJ Library/Libraries: azure-ai-openai:1.0.0-beta.9 Java version: 17 App Server/Environment: Tomcat Frameworks: Spring Boot 3.2.0

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

mssfang commented 1 month ago

@BorangaziyevA Can you upgrade the version to beta.10 and try out? We have a fix for this issue.

github-actions[bot] commented 1 month ago

Hi @BorangaziyevA. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] commented 1 month ago

Hi @BorangaziyevA, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!