Adds support for audio captioning with Whisper (#267)

* Add speech to text example in docs

* Add caption formats for audio transcription

* Add caption example to README

* Address sanity check errors

* Add tests for decodeResponse

* Use typechecker for audio response format

* Decoding response refactors
This commit is contained in:
Hoani Bryson
2023-04-21 01:07:04 +12:00
committed by GitHub
parent d6ab1b3a4f
commit ecdea45b67
5 changed files with 129 additions and 8 deletions

View File

@@ -112,6 +112,7 @@ func TestAudioWithOptionalArgs(t *testing.T) {
Prompt: "用简体中文",
Temperature: 0.5,
Language: "zh",
Format: AudioResponseFormatSRT,
}
_, err = tc.createFn(ctx, req)
checks.NoError(t, err, "audio API error")
@@ -179,6 +180,7 @@ func TestAudioWithFailingFormBuilder(t *testing.T) {
Prompt: "test",
Temperature: 0.5,
Language: "en",
Format: AudioResponseFormatSRT,
}
mockFailedErr := fmt.Errorf("mock form builder fail")
@@ -202,7 +204,7 @@ func TestAudioWithFailingFormBuilder(t *testing.T) {
return nil
}
failOn := []string{"model", "prompt", "temperature", "language"}
failOn := []string{"model", "prompt", "temperature", "language", "response_format"}
for _, failingField := range failOn {
failForField = failingField
mockFailedErr = fmt.Errorf("mock form builder fail on field %s", failingField)