Repository navigation
|
In the Transcription API documentation, under the Basic Service Example section, the TranscriptionService class contains a transcribeWithOptions method that explicitly creates an AudioTranscriptionPrompt and invokes transcriptionModel.call(prompt). I noticed that TranscriptionModel also provides a convenience method: transcriptionModel.transcribe(audioFile, options). Since both approaches appear to return the transcription as a String, I was wondering: is the use of call() intentional, perhaps to demonstrate the lower-level API, or could this be simplified by using transcribe(audioFile, options) directly? I just wanted to clarify whether this is intentional or if it might be worth simplifying the example. |
Replies: 2 comments 2 replies
|
The two are equivalent for that example. The only difference on current versions is that I checked it against spring-ai-model 1.1.2, 2.0.2 and 2.1.0-RC1 with a stub So public String transcribeWithOptions(Resource audioFile, AudioTranscriptionOptions options) {
return transcriptionModel.transcribe(audioFile, options);
}
AudioTranscriptionResponse response =
transcriptionModel.call(new AudioTranscriptionPrompt(audioFile, options));
String text = response.getResult().getOutput();
var metadata = response.getMetadata();The page doesn't say the example is meant to show the lower-level API, and the example doesn't use anything from the response besides the text. If you want to change it, a small docs PR that uses The interface excerpt at the top of the same page is also slightly behind the source (it doesn't show the null handling), which could be fixed in the same PR. |
Thanks for the quick fix! I was actually planning to open a PR for this myself, but you got there first 😊.
I checked the changes in #7351 and they address exactly the issue I had noticed.