Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: point the Conversation Override type to api-generated type #446

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading