Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/elevenlabs/conversational_ai/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def _create_initiation_message(self):
"source": "python_sdk",
"version": __version__,
},
**({"user_id": self.config.user_id} if self.config.user_id else {}),
**({"user_id": self.user_id} if self.user_id else {}),
}
)

Expand Down
7 changes: 3 additions & 4 deletions tests/test_async_convai.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,11 @@ async def test_async_conversation_basic_flow():
agent_response_callback = AsyncMock()
test_user_id = "test_user_123"

# Setup the conversation
config = ConversationInitiationData(user_id=test_user_id)
# Setup the conversation with user_id passed directly to the constructor
conversation = AsyncConversation(
client=mock_client,
agent_id=TEST_AGENT_ID,
config=config,
user_id=test_user_id,
requires_auth=False,
audio_interface=MockAsyncAudioInterface(),
callback_agent_response=agent_response_callback,
Expand Down Expand Up @@ -109,7 +108,7 @@ async def test_async_conversation_basic_flow():
assert init_message["user_id"] == test_user_id
agent_response_callback.assert_called_once_with("Hello there!")
assert conversation._conversation_id == TEST_CONVERSATION_ID
assert conversation.config.user_id == test_user_id
assert conversation.user_id == test_user_id


@pytest.mark.asyncio
Expand Down
7 changes: 3 additions & 4 deletions tests/test_convai.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ def test_conversation_basic_flow():
agent_response_callback = MagicMock()
test_user_id = "test_user_123"

# Setup the conversation
config = ConversationInitiationData(user_id=test_user_id)
# Setup the conversation with user_id passed directly to the constructor
conversation = Conversation(
client=mock_client,
agent_id=TEST_AGENT_ID,
config=config,
user_id=test_user_id,
requires_auth=False,
audio_interface=MockAudioInterface(),
callback_agent_response=agent_response_callback,
Expand Down Expand Up @@ -99,7 +98,7 @@ def test_conversation_basic_flow():
assert init_message["user_id"] == test_user_id
agent_response_callback.assert_called_once_with("Hello there!")
assert conversation._conversation_id == TEST_CONVERSATION_ID
assert conversation.config.user_id == test_user_id
assert conversation.user_id == test_user_id


def test_conversation_with_auth():
Expand Down