[BUG] Java OpenAI EmbeddingsOptions requires setUser be called with non-null value
Describe the bug The Java OpenAI Sample would not work https://github.com/Azure/azure-sdk-for-java/blob/azure-ai-openai_1.0.0-beta.6/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetEmbeddingsSample.java
Exception or Stack Trace An exception occurred while executing the Java class. Status code 400, "{ [ERROR] "error": { [ERROR] "message": "None is not of type 'string' - 'user'", [ERROR] "type": "invalid_request_error", [ERROR] "param": null, [ERROR] "code": null [ERROR] } [ERROR] }
To Reproduce
Run the sample as is. To fix add .setUser("some-string") when creating EmbeddingsOptions
Code Snippet
EmbeddingsOptions embeddingsOptions = new EmbeddingsOptions(Arrays.asList("Your text string goes here"));
Embeddings embeddings = client.getEmbeddings(deploymentOrModelId, embeddingsOptions);
for (EmbeddingItem item : embeddings.getData()) {
System.out.printf("Index: %d.%n", item.getPromptIndex());
for (Double embedding : item.getEmbedding()) {
System.out.printf("%f;", embedding);
}
}
Expected behavior
Should be able to use without calling .setUser
Thanks for filing this @mattgotteiner.
@mssfang could you fix this sample.
Hi, @mattgotteiner
What model are you using? I won't be able to reproduce the error with model "text-embedding-ada-002" in both of Azure OpenAI and OpenAI clients
Hi @mattgotteiner. 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.
Hi @mattgotteiner, 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!