-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Milestone
Description
Bug description
Flux flow response doesn't seem to work as expected.
Environment
Spring AI 1.0.0-SNAPSHOT
Java version 21
Windows 10
Steps to reproduce
I Tried OpenAI completions API, it replied SSE content
But the following examples replied nothing.
@PostMapping(value = "/ai/openai/completions", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
Flux<OpenAiApi.ChatCompletionChunk> aiChat(@RequestBody OpenAiApi.ChatCompletionRequest chatRequest) {
final OpenAiApi openAiApi = new OpenAiApi(openaiBaseUrl, openaiApiKey);
return openAiApi.chatCompletionStream(chatRequest);
}
That's the same
@GetMapping(value = "/ai/generateStream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<ChatResponse> generateStream(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) {
Prompt prompt = new Prompt(new UserMessage(message));
return chatModel.stream(prompt);
}