When using AudioTranscription Options, they seem to be getting overwritten with the defaults.
Setting options as:
OpenAiAudioTranscriptionOptions transcriptionOptions = OpenAiAudioTranscriptionOptions.builder()
.withResponseFormat(OpenAiAudioApi.TranscriptResponseFormat.SRT)
.withModel(OpenAiAudioApi.WhisperModel.WHISPER_1.name())
.withTemperature(0f)
.build();
AudioTranscriptionPrompt prompt = new AudioTranscriptionPrompt(file.getResource(), transcriptionOptions);
```
Will always return text, response format is ignored.
HOWEVER,
Setting options at a global level via properties, this works.
Example:
ai: openai: api-key: ${OPENAI_API_KEY} audio: transcription: options: response-format: srt ``` This will produce the srt output properly. Seems the options set via properties are overriding the options set in Java.
I saw this working okay before. I think this commit might be overriding the options.
Comment From: tzolov
@springframeworkguru , can you share which spring ai version are using? I've added a test that verifies the correctness transcription merging behaviour for version 1.0.0-SNAPSHOT.
Comment From: springframeworkguru
Hi @tzolov - I'm using the 0.0.1-SNAPSHOT version. I noticed the issue because I started to always get TEXT back, regardless to what I set the runtime option to.
Comment From: tzolov
Hi @tzolov - I'm using the 0.0.1-SNAPSHOT version. do you mean 1.0.0-SNAPSHOT version?
Comment From: tzolov
It would help if you provide a simple example to reproduce the behaviour.
Comment From: springframeworkguru
Yes, the 1.0.0-SNAPSHOT version.
Please see the branch spring-ai-audio-test
. in this repo.
The test OpenAIServiceImplTest
has two tests one for srt, one for json. Options are set at runtime in the method. Both return plain text.
The test OpebAIServiceImplTestSrt
brings in a profile that sets the default response format to SRT. Both tests now return vaild SRT. Expected behavior of the json test would be to return json, since that is being set as the option in the method being called.
The test OpenAIServiceImplJsonTest
bring in a profile to set to verbose_json. Both tests return text. Same result with using the json format option too. This one made no sense to me, I was expecting it to behave like the SRT test.