You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll get an error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
Environment
python version 3.12.5
Additional context
complete error message:
C:\Users\hongyihank\OneDrive\doc>py test.py
Traceback (most recent call last):
File "C:\Users\hongyihank\OneDrive\doc\test.py", line 10, in <module>
response = g4f.ChatCompletion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hongyihank\AppData\Local\Programs\Python\Python312\Lib\site-packages\g4f\__init__.py", line 55, in create
return result if stream else ''.join([str(chunk) for chunk in result])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hongyihank\AppData\Local\Programs\Python\Python312\Lib\site-packages\g4f\providers\asyncio.py", line 53, in to_sync_generator
yield loop.run_until_complete(await_callback(gen.__anext__))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hongyihank\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\hongyihank\AppData\Local\Programs\Python\Python312\Lib\site-packages\g4f\providers\asyncio.py", line 38, in await_callback
return await callback()
^^^^^^^^^^^^^^^^
File "C:\Users\hongyihank\AppData\Local\Programs\Python\Python312\Lib\site-packages\g4f\Provider\Airforce.py", line 271, in create_async_generator
async for result in cls.generate_text(model, messages, max_tokens, temperature, top_p, stream, api_key, proxy):
File "C:\Users\hongyihank\AppData\Local\Programs\Python\Python312\Lib\site-packages\g4f\Provider\Airforce.py", line 236, in generate_text
result = await response.json()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hongyihank\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\client_reqrep.py", line 1260, in json
return loads(stripped.decode(encoding))
^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
The text was updated successfully, but these errors were encountered:
I have the same issue with Airforce provider. Similar issue will arise if you will try to use GizAI provider:
response = await client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\g4f\client\__init__.py", line 163, in async_iter_append_model_and_provider
async for chunk in response:
File "\g4f\client\__init__.py", line 118, in async_iter_response
async for chunk in response:
File "\g4f\Provider\GizAI.py", line 73, in create_async_generator
result = await response.json()
^^^^^^^^^^^^^^^^^^^^^
File "\aiohttp\client_reqrep.py", line 1199, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message="Attempt to decode JSON with unexpected mimetype: ', url='https://app.giz.ai/api/data/users/inferenceServer.infer"```
For some reason, response.headers from Airforce always contains this: 'Content-Encoding': 'zstd'
ImHex detects the binary content of response as "Zstandard compressed data format" as well.
Bug description
While I using this code
I'll get an error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
Environment
Additional context
complete error message:
The text was updated successfully, but these errors were encountered: