From 02fe9e4479527ca9f43d27e228c0c9b015dccbba Mon Sep 17 00:00:00 2001 From: Louis Jordan Date: Tue, 17 Dec 2024 18:49:31 +0000 Subject: [PATCH] chore: point the conversation override type to our generated back-end type --- src/elevenlabs/conversational_ai/conversation.py | 3 ++- tests/e2e_test_convai.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/elevenlabs/conversational_ai/conversation.py b/src/elevenlabs/conversational_ai/conversation.py index 5678e63..d1e8080 100644 --- a/src/elevenlabs/conversational_ai/conversation.py +++ b/src/elevenlabs/conversational_ai/conversation.py @@ -5,6 +5,7 @@ from typing import Callable, Optional, Awaitable, Union, Any import asyncio from concurrent.futures import ThreadPoolExecutor +from ..types import ConversationConfigClientOverrideConfig from websockets.sync.client import connect @@ -168,7 +169,7 @@ class ConversationConfig: def __init__( self, extra_body: Optional[dict] = None, - conversation_config_override: Optional[dict] = None, + conversation_config_override: Optional[ConversationConfigClientOverrideConfig] = None, ): self.extra_body = extra_body or {} self.conversation_config_override = conversation_config_override or {} diff --git a/tests/e2e_test_convai.py b/tests/e2e_test_convai.py index a0e6264..a5940e6 100644 --- a/tests/e2e_test_convai.py +++ b/tests/e2e_test_convai.py @@ -4,7 +4,7 @@ import pytest from elevenlabs import ElevenLabs -from elevenlabs.conversational_ai.conversation import Conversation, ClientTools +from elevenlabs.conversational_ai.conversation import Conversation, ClientTools, ConversationConfig from elevenlabs.conversational_ai.default_audio_interface import DefaultAudioInterface @@ -48,8 +48,22 @@ async def test_async(parameters): client_tools.register("test", test) client_tools.register("test_async", test_async, is_async=True) + conversation_override = { + "agent": { + "prompt": {"prompt": "The customer's bank account balance is."}, + "first_message": "The customer's bank account balance is.", + "language": "en", + }, + "tfts": { + "voice_id": "iP95p4xoKVk53GoZ742B" # Override the voice + }, + } + + config = ConversationConfig(conversation_config_override=conversation_override) + # Initialize conversation conversation = Conversation( + config=config, client=client, agent_id=agent_id, requires_auth=False,