fix: override modality for elevenlabs on response.create (#7269)

override modality for 11l on response.create

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Sebastián Estévez 2025-03-25 17:10:05 -04:00 committed by GitHub
commit 6c4828b72e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -613,6 +613,11 @@ async def flow_as_tool_websocket(
log_event(event, "")
if voice_config.barge_in_enabled:
await vad_queue.put(base64_data)
elif msg.get("type") == "response.create":
if voice_config.use_elevenlabs:
response = msg.setdefault("response", {})
response["modalities"] = ["text"]
await openai_ws.send(json.dumps(msg))
elif msg.get("type") == "input_audio_buffer.commit":
if num_audio_samples > AUDIO_SAMPLE_THRESHOLD:
await openai_ws.send(message_text)