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

blob = data["arkose"]["dx"] KeyError: 'dx' #1982

Open
RezaRamezanisani opened this issue May 19, 2024 · 2 comments
Open

blob = data["arkose"]["dx"] KeyError: 'dx' #1982

RezaRamezanisani opened this issue May 19, 2024 · 2 comments
Assignees
Labels
bug Something isn't working stale

Comments

@RezaRamezanisani
Copy link

RezaRamezanisani commented May 19, 2024

this is my code:

import asyncio

from g4f.client import AsyncClient
from g4f.Provider import BingCreateImages, OpenaiChat, Gemini

async def main():
    client = AsyncClient(
        provider=OpenaiChat,
        image_provider=Gemini,
     
    )

    task1 = client.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=[{"role": "user", "content": "Say this is a test"}],
    )
    task2 = client.images.generate(
        model="dall-e-3",
        prompt="a white siamese cat",
    )
    responses = await asyncio.gather(task1, task2)

    print(responses)

asyncio.run(main())

when run this code i see a error:

Traceback (most recent call last):
  File "C:\gpt4\chat.py", line 20, in <module>
    asyncio.run(main())
  File "C:\Users\Gigabyte\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Gigabyte\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Gigabyte\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\gpt4\chat.py", line 16, in main
    responses = await asyncio.gather(task1)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\gpt4\g4f\client\async_client.py", line 63, in iter_append_model_and_provider
    async for chunk in response:
  File "C:\gpt4\g4f\client\async_client.py", line 37, in iter_response
    async for chunk in response:
  File "C:\gpt4\g4f\Provider\needs_auth\OpenaiChat.py", line 421, in create_async_generator
    blob = data["arkose"]["dx"]
           ~~~~~~~~~~~~~~^^^^^^
KeyError: 'dx'

how to fix bug?

@RezaRamezanisani RezaRamezanisani added the bug Something isn't working label May 19, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented May 19, 2024

Hey, your g4f is outdated. You should update it.

Just run this command:

pip install -U g4f

Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants