agents
agents copied to clipboard
Issue when using OpenAI LLM endpoint
Hi, I am using Voice assistant example. I am having this issue when receiving streams from the OpenAI LLM endpoints , attaching the traceback of the error
{"message": "Error in _stream_synthesis_task", "level": "ERROR", "name": "livekit.agents.pipeline", "exc_info": "Traceback (most recent call last):\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_transports\default.py", line 72, in map_httpcore_exceptions\n yield\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_transports\default.py", line 377, in handle_async_request\n resp = await self._pool.handle_async_request(req)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_async\connection_pool.py", line 216, in handle_async_request\n raise exc from None\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_async\connection_pool.py", line 196, in handle_async_request\n response = await connection.handle_async_request(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_async\connection.py", line 101, in handle_async_request\n return await self._connection.handle_async_request(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_async\http11.py", line 143, in handle_async_request\n raise exc\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_async\http11.py", line 113, in handle_async_request\n ) = await self._receive_response_headers(**kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_async\http11.py", line 186, in _receive_response_headers\n event = await self._receive_event(timeout=timeout)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_async\http11.py", line 224, in _receive_event\n data = await self._network_stream.read(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_backends\anyio.py", line 32, in read\n with map_exceptions(exc_map):\n File "C:\Users\akash\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in exit\n self.gen.throw(typ, value, traceback)\n File "C:\ENV\agents_updated\Lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions\n raise to_exc(exc) from exc\nhttpcore.ReadTimeout\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1571, in _request\n response = await self._client.send(\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_client.py", line 1674, in send\n response = await self._send_handling_auth(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_client.py", line 1702, in _send_handling_auth\n response = await self._send_handling_redirects(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_client.py", line 1739, in _send_handling_redirects\n response = await self._send_single_request(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_client.py", line 1776, in _send_single_request\n response = await transport.handle_async_request(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_transports\default.py", line 376, in handle_async_request\n with map_httpcore_exceptions():\n File "C:\Users\akash\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in exit\n self.gen.throw(typ, value, traceback)\n File "C:\ENV\agents_updated\Lib\site-packages\httpx\_transports\default.py", line 89, in map_httpcore_exceptions\n raise mapped_exc(message) from exc\nhttpx.ReadTimeout\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "C:\ENV\agents_updated\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs\n return await fn(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\livekit\agents\pipeline\agent_output.py", line 272, in _stream_synthesis_task\n async for seg in tts_source:\n File "C:\ENV\agents_updated\Lib\site-packages\livekit\agents\utils\aio\itertools.py", line 47, in tee_peer\n item = await iterator.anext()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\livekit\agents\pipeline\pipeline_agent.py", line 1831, in _llm_stream_to_str_iterable\n async for chunk in stream:\n File "C:\ENV\agents_updated\Lib\site-packages\livekit\plugins\openai\llm.py", line 478, in anext\n self._oai_stream = await self._awaitable_oai_stream\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\resources\chat\completions.py", line 1490, in create\n return await self._post(\n ^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1838, in post\n return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1532, in request\n return await self._request(\n ^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1580, in _request\n return await self._retry_request(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1665, in _retry_request\n return await self._request(\n ^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1580, in _request\n return await self._retry_request(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1665, in _retry_request\n return await self._request(\n ^^^^^^^^^^^^^^^^^^^^\n File "C:\ENV\agents_updated\Lib\site-packages\openai\_base_client.py", line 1590, in _request\n raise APITimeoutError(request=request) from err\nopenai.APITimeoutError: Request timed out.", "timestamp": "2024-10-15T07:18:54.243673+00:00"}
`