Skip to content

Async Function Issue in Conversation Class #484

Closed
@OsKrg

Description

@OsKrg

Description

I'm encountering an issue while using the ElevenLabs Python package.

I'm importing the async version:
from elevenlabs.client import AsyncElevenLabs

Then, I initialize the async client:
client = AsyncElevenLabs(api_key=ELEVENLABS_API_KEY)

However, when attempting to use the Conversation class, I noticed a problem in conversation.py, specifically in the session_start function:
ws_url = self._get_signed_url() if self.requires_auth else self._get_wss_url()

This calls _get_signed_url():
def _get_signed_url(self):
response = self.client.conversational_ai.get_signed_url(agent_id=self.agent_id)
return response.signed_url
The issue is that get_signed_url is an async function (in case of Async Elevenlab Client), but it is being called without await, which leads to errors.

As a temporary fix, I patched it like this:
class PatchedConversation(Conversation):
def _get_signed_url(self):
return signed_url_response.signed_url

self.conversation = PatchedConversation(client=client)

This workaround solves the issue for now, but I believe the library may need a proper fix.

Code example

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions