Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"[SSL: WRONG_VERSION_NUMBER] wrong version number" #87

Open
desword opened this issue Apr 9, 2024 · 2 comments
Open

"[SSL: WRONG_VERSION_NUMBER] wrong version number" #87

desword opened this issue Apr 9, 2024 · 2 comments

Comments

@desword
Copy link

desword commented Apr 9, 2024

Following the get_bot_response example from the developer documentation returns "[SSL: WRONG_VERSION_NUMBER] wrong version number" for all attempts.

Environment Details:

Python 3.10.12
fastapi_poe 0.0.36
httpx 0.27.0
httpx-sse 0.4.0

Stacktrace:

Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 0 
 SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)')
Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 1 
 SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 459, in stream_request_base
    async for message in ctx.perform_query_request(
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 146, in perform_query_request
    async with httpx_sse.aconnect_sse(
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/dist-packages/httpx_sse/_api.py", line 69, in aconnect_sse
    async with client.stream(method, url, headers=headers, **kwargs) as response:
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1617, in stream
    response = await self.send(
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1661, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1689, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1726, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1763, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 373, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 99, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 76, in handle_async_request
    stream = await self._connect(request)
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 154, in _connect
    stream = await stream.start_tls(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_backends/anyio.py", line 80, in start_tls
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_backends/anyio.py", line 71, in start_tls
    ssl_stream = await anyio.streams.tls.TLSStream.wrap(
  File "/usr/local/lib/python3.10/dist-packages/anyio/streams/tls.py", line 132, in wrap
    await wrapper._call_sslobject_method(ssl_object.do_handshake)
  File "/usr/local/lib/python3.10/dist-packages/anyio/streams/tls.py", line 140, in _call_sslobject_method
    result = func(*args)
  File "/usr/lib/python3.10/ssl.py", line 975, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)

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

Traceback (most recent call last):
  File "/home/access_api_directly.py", line 15, in <module>
    asyncio.run(get_responses(api_key, [message]))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/access_api_directly.py", line 6, in get_responses
    async for partial in fp.get_bot_response(messages=messages, bot_name="GPT-3.5-Turbo", api_key=api_key):
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 330, in stream_request
    async for message in stream_request_base(
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 484, in stream_request_base
    raise BotError(f"Error communicating with bot {bot_name}") from e
fastapi_poe.client.BotError: Error communicating with bot GPT-3.5-Turbo
@JohntheLi
Copy link
Collaborator

Hi @desword . Apologies for the late response. Are you still seeing this issue?

@desword
Copy link
Author

desword commented Sep 12, 2024

@JohntheLi jon, Hi john, Yes, I still see this issue.
Are there any hints to fix the above problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants