jesuscopado / samantha-os1

Samantha OS1 is a conversational AI assistant powered by the Realtime API from OpenAI
91 stars 48 forks source link

Not sure whats going on could use some help #1

Open davtin19 opened 2 weeks ago

davtin19 commented 2 weeks ago

I keep running into this error and im not sure whats the issue all my api keys and url should be correct i double checked

I keep getting this error when i try running it ╭─    ~/samantha-os1/app    main = !1  ╰─ chainlit run samantha.py ─╯ 2024-11-02 13:02:15 - Your app is available at http://localhost:8000 2024-11-02 13:02:17 - Translated markdown file for en-US not found. Defaulting to chainlit.md. 2024-11-02 13:02:37 - Translation file for en-CA not found. Using default translation en-US. 2024-11-02 13:02:37 - Translated markdown file for en-CA not found. Defaulting to chainlit.md. Traceback (most recent call last): File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 656, in __await_impl__ await protocol.handshake( File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 322, in handshake raise InvalidStatusCode(status_code, response_headers) websockets.legacy.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 400

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 670, in await_impl__ await protocol.wait_closed() File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 799, in wait_closed await asyncio.shield(self.connection_lost_waiter) File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/futures.py", line 287, in await__ yield self # This tells Task to wait for completion. ^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup future.result() File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/futures.py", line 198, in result raise exc asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/davidtingey/samantha-os1/app/samantha.py", line 94, in on_audio_start await openai_realtime.connect() File "/Users/davidtingey/samantha-os1/app/realtime/init.py", line 582, in connect await self.realtime.connect() File "/Users/davidtingey/samantha-os1/app/realtime/init.py", line 132, in connect self.ws = await websockets.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 652, in await_impl__ async with asyncio_timeout(self.open_timeout): File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/timeouts.py", line 115, in aexit__ raise TimeoutError from exc_val TimeoutError

Traceback (most recent call last): File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 656, in __await_impl__ await protocol.handshake( File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 322, in handshake raise InvalidStatusCode(status_code, response_headers) websockets.legacy.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 400

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 670, in await_impl__ await protocol.wait_closed() File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 799, in wait_closed await asyncio.shield(self.connection_lost_waiter) File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/futures.py", line 287, in await__ yield self # This tells Task to wait for completion. ^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup future.result() File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/futures.py", line 198, in result raise exc asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/davidtingey/samantha-os1/app/samantha.py", line 94, in on_audio_start await openai_realtime.connect() File "/Users/davidtingey/samantha-os1/app/realtime/init.py", line 582, in connect await self.realtime.connect() File "/Users/davidtingey/samantha-os1/app/realtime/init.py", line 132, in connect self.ws = await websockets.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/davidtingey/samantha-os1/.venv/lib/python3.12/site-packages/websockets/legacy/client.py", line 652, in await_impl__ async with asyncio_timeout(self.open_timeout): File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/timeouts.py", line 115, in aexit__ raise TimeoutError from exc_val TimeoutError

davtin19 commented 2 weeks ago

Also the error only whens when I press P to activate voice mode and the bot says this

Failed to connect to OpenAI realtime:

sbusso commented 2 weeks ago

I got a similar issue due to the Azure OpenAI URL. It should refer to only the domain AZURE_OPENAI_URL='endpoint-name.openai.azure.com'