Skip to content

Add streaming support for OpenAI audio transcription model#6514

Open
guanxuc wants to merge 4 commits into
spring-projects:mainfrom
guanxuc:openai-audio-stream
Open

Add streaming support for OpenAI audio transcription model#6514
guanxuc wants to merge 4 commits into
spring-projects:mainfrom
guanxuc:openai-audio-stream

Conversation

@guanxuc

@guanxuc guanxuc commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduce StreamingTranscriptionModel interface and implement streaming audio transcription in OpenAiAudioTranscriptionModel using the async OpenAI client

Changes

  • Add StreamingTranscriptionModel interface with stream methods
  • Implement stream method in OpenAiAudioTranscriptionModel via OpenAIClientAsync
  • Register OpenAIClientAsync in OpenAiAudioTranscriptionAutoConfiguration
  • Add unit and integration tests for streaming transcription

@guanxuc guanxuc force-pushed the openai-audio-stream branch 4 times, most recently from 54b3d63 to 67c730c Compare July 3, 2026 02:26
@guanxuc

guanxuc commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Hi @ericbottard @ilayaperumalg ,

Could you please take a look, thanks!

@guanxuc guanxuc force-pushed the openai-audio-stream branch from 67c730c to e22ddd7 Compare July 6, 2026 11:14
@ilayaperumalg ilayaperumalg self-assigned this Jul 6, 2026
@ilayaperumalg ilayaperumalg added this to the 2.0.1 milestone Jul 6, 2026
@guanxuc guanxuc force-pushed the openai-audio-stream branch from e22ddd7 to d95137a Compare July 7, 2026 01:31
* @since 1.0.0
*/
public interface TranscriptionModel extends Model<AudioTranscriptionPrompt, AudioTranscriptionResponse> {
public interface TranscriptionModel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would break the existing TranscriptionModel implementations (if there are custom ones). Hence, I suggest to keep TranscriptionModel independent by having the OpenAiAudioTranscriptionModel implementing TranscriptionModel along with StreamingTranscriptionModel. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! However, this would lead to inconsistencies with the existing implementations of ChatModel and TextToSpeechModel, which could also cause confusion for users. Could we maintain consistency across the codebase and document this as a breaking change in upgrade-notes.adoc?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guanxuc I understand your perspective to bring in consistency. But, I am sorry that we can't bring breaking changes to 2.0.1. Thanks for the understanding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ilayaperumal,

Thanks for the feedback! Could we add a default stream method to maintain consistency and avoid bringing breaking changes as shown below? Please let me know if this approach is acceptable. If not, I'd be more than happy to implement your previous excellent suggestions instead.

public interface StreamingTranscriptionModel
		extends StreamingModel<AudioTranscriptionPrompt, AudioTranscriptionResponse> {

	default Flux<AudioTranscriptionResponse> stream(AudioTranscriptionPrompt transcriptionPrompt) {
		return Flux.error(new UnsupportedOperationException("Streaming transcription is not supported"));
	}

}

@guanxuc guanxuc force-pushed the openai-audio-stream branch from d95137a to 22f7a92 Compare July 9, 2026 05:24
@guanxuc

guanxuc commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Hi Ilayaperumal,

Thanks for your review and the great suggestions! I've addressed your comments. Could you please take another look? Feel free to reach out if you have any further questions.

guanxuc added 4 commits July 10, 2026 22:33
# Summary
Introduce StreamingTranscriptionModel interface and implement streaming audio transcription in OpenAiAudioTranscriptionModel using the async OpenAI client

# Changes
 - Add StreamingTranscriptionModel interface with stream methods
 - Implement stream method in OpenAiAudioTranscriptionModel via OpenAIClientAsync
 - Register OpenAIClientAsync in OpenAiAudioTranscriptionAutoConfiguration
 - Add unit and integration tests for streaming transcription

Signed-off-by: guanxu <1510424541@qq.com>
Signed-off-by: guanxu <1510424541@qq.com>
…ionModel`

Signed-off-by: guanxu <1510424541@qq.com>
Signed-off-by: guanxu <1510424541@qq.com>
@guanxuc guanxuc force-pushed the openai-audio-stream branch from 22f7a92 to a805e2b Compare July 10, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants