Skip to content

Commit

Permalink
chore: point the conversation override type to our generated back-end…
Browse files Browse the repository at this point in the history
… type
  • Loading branch information
louisjoecodes committed Dec 17, 2024
1 parent 57f85b6 commit 02fe9e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/elevenlabs/conversational_ai/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {}
Expand Down
16 changes: 15 additions & 1 deletion tests/e2e_test_convai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 02fe9e4

Please sign in to comment.