Merge pull request #11 from cgooding-va/fix-g711-audio-format-constants

Fix G711 AudioFormat constants
This commit is contained in:
Qiying Wang
2024-12-04 11:43:41 +08:00
committed by GitHub
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -72,7 +72,7 @@ func TestSessionUpdateEvent(t *testing.T) {
"instructions": "test-instructions",
"voice": "alloy",
"input_audio_format": "pcm16",
"output_audio_format": "g711-ulaw",
"output_audio_format": "g711_ulaw",
"input_audio_transcription": {
"model": "whisper-1"
},
@@ -126,7 +126,7 @@ func TestSessionUpdateEvent(t *testing.T) {
"instructions": "test-instructions",
"voice": "alloy",
"input_audio_format": "pcm16",
"output_audio_format": "g711-ulaw",
"output_audio_format": "g711_ulaw",
"input_audio_transcription": {
"model": "whisper-1"
},
@@ -196,7 +196,7 @@ func TestSessionUpdateEventSimple(t *testing.T) {
"instructions": "test-instructions",
"voice": "alloy",
"input_audio_format": "pcm16",
"output_audio_format": "g711-ulaw",
"output_audio_format": "g711_ulaw",
"turn_detection": null,
"temperature": 0.5,
"max_response_output_tokens": 100
@@ -380,7 +380,7 @@ func TestResponseCreateEvent(t *testing.T) {
],
"instructions": "test-instructions",
"voice": "alloy",
"output_audio_format": "g711-ulaw",
"output_audio_format": "g711_ulaw",
"tool_choice": "auto",
"max_output_tokens": 100
},
@@ -392,7 +392,7 @@ func TestResponseCreateEvent(t *testing.T) {
message.Response.MaxOutputTokens = openairt.Inf
data, err = json.Marshal(message)
require.NoError(t, err)
expected = `{"event_id":"test-id","response":{"modalities":["text","audio"],"instructions":"test-instructions","voice":"alloy","output_audio_format":"g711-ulaw","tool_choice":"auto","max_output_tokens":"inf"},"type":"response.create"}`
expected = `{"event_id":"test-id","response":{"modalities":["text","audio"],"instructions":"test-instructions","voice":"alloy","output_audio_format":"g711_ulaw","tool_choice":"auto","max_output_tokens":"inf"},"type":"response.create"}`
require.JSONEq(t, expected, string(data))
}
+2 -2
View File
@@ -21,8 +21,8 @@ type AudioFormat string
const (
AudioFormatPcm16 AudioFormat = "pcm16"
AudioFormatG711Ulaw AudioFormat = "g711-ulaw"
AudioFormatG711Alaw AudioFormat = "g711-alaw"
AudioFormatG711Ulaw AudioFormat = "g711_ulaw"
AudioFormatG711Alaw AudioFormat = "g711_alaw"
)
type Modality string