Add streaming support for OpenAI audio transcription model#6514
Add streaming support for OpenAI audio transcription model#6514guanxuc wants to merge 4 commits into
Conversation
54b3d63 to
67c730c
Compare
|
Hi @ericbottard @ilayaperumalg , Could you please take a look, thanks! |
67c730c to
e22ddd7
Compare
e22ddd7 to
d95137a
Compare
| * @since 1.0.0 | ||
| */ | ||
| public interface TranscriptionModel extends Model<AudioTranscriptionPrompt, AudioTranscriptionResponse> { | ||
| public interface TranscriptionModel |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
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"));
}
}d95137a to
22f7a92
Compare
|
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. |
# 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>
22f7a92 to
a805e2b
Compare
Summary
Introduce
StreamingTranscriptionModelinterface and implement streaming audio transcription inOpenAiAudioTranscriptionModelusing the async OpenAI clientChanges
StreamingTranscriptionModelinterface with stream methodsOpenAiAudioTranscriptionModelviaOpenAIClientAsyncOpenAIClientAsyncinOpenAiAudioTranscriptionAutoConfiguration