Skip to content

Commit 78af163

Browse files
committed
fix
1 parent 73d9ee4 commit 78af163

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/elevenlabs/conversational_ai/conversation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ async def _execute_and_callback():
278278

279279
self._schedule_coroutine(_execute_and_callback())
280280

281-
282281
def _schedule_coroutine(self, coro):
283282
"""Schedule a coroutine on the appropriate event loop."""
284283
if self._custom_loop is not None:
@@ -780,7 +779,7 @@ async def start_session(self):
780779
Will run in background task until `end_session` is called.
781780
"""
782781
ws_url = self._get_signed_url() if self.requires_auth else self._get_wss_url()
783-
self._task = self._schedule_coroutine(self._run(ws_url))
782+
self._task = asyncio.create_task(self._run(ws_url))
784783

785784
async def end_session(self):
786785
"""Ends the conversation session and cleans up resources."""
@@ -946,7 +945,7 @@ async def handle_latency_measurement(self, latency):
946945
def handle_client_tool_call(self, tool_name, parameters):
947946
def send_response(response):
948947
if not self.conversation._should_stop.is_set():
949-
self.conversation._schedule_coroutine(self.ws.send(json.dumps(response)))
948+
asyncio.create_task(self.ws.send(json.dumps(response)))
950949

951950
self.conversation.client_tools.execute_tool(tool_name, parameters, send_response)
952951

0 commit comments

Comments
 (0)