Open
Description
Describe the bug
When streaming a completion, the results are still all aggregated and arrive sequentially instead of "streamed".
Exception or Stack Trace
No stacktrace
To Reproduce
Make a streaming call with Spring AI version 1.0.0 and observe the nature of the call is wrong, as the chunks are "blocked" somewhere deep in the Azure SDK code.
Code Snippet
@ServiceMethod(returns = ReturnType.COLLECTION)
public IterableStream<ChatCompletions> getChatCompletionsStream(String deploymentOrModelName,
ChatCompletionsOptions chatCompletionsOptions) {
chatCompletionsOptions.setStream(true);
RequestOptions requestOptions = new RequestOptions();
Flux<ByteBuffer> responseStream = getChatCompletionsWithResponse(deploymentOrModelName,
BinaryData.fromObject(chatCompletionsOptions), requestOptions).getValue().toFluxByteBuffer();
OpenAIServerSentEvents<ChatCompletions> chatCompletionsStream
= new OpenAIServerSentEvents<>(responseStream, ChatCompletions.class);
return new IterableStream<>(chatCompletionsStream.getEvents());
}
Class: OpenAIClient.java
Expected behavior
The response needs to be streamed instead of arriving all at once
Setup (please complete the following information):
- OS: MacOS
- IDE: IntelliJ IDEA 2024.1.2 (Ultimate Edition)
- Library/Libraries: azure-ai-openai-1.0.0-beta.8.jar
- Java version: 21
- App Server/Environment: Standard Springboot setup
- Frameworks: Spring Boot
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
- [ X ] Bug Description Added
- [ X ] Repro Steps Added
- [ X ] Setup information Added
Metadata
Metadata
Assignees
Labels
This issue points to a problem in the data-plane of the library.Issues that are reported by GitHub users external to the Azure organization.Workflow: More information is needed from author to address the issue.There has been no recent activity on this issue.The issue doesn't require a change to the product in order to be resolved. Most issues start as that