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

Selecting "gpt-4o" as a model opens you.com automated browser window every 3-4 requests, doesn't run in headless mode #1968

Closed
augusto-rehfeldt-2 opened this issue May 17, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@augusto-rehfeldt-2
Copy link

augusto-rehfeldt-2 commented May 17, 2024

Bug description
When using "gpt-4o" as the model in the chat.completions.create method, the webdriver opens and closes a window to you.com. This is a nuissance and should run in the background.

Console throws this, don't know if it's related, but the request works nevertheless and the provider returns a response.

 Proactor event loop does not implement add_reader family of methods required.
    Registering an additional selector thread for add_reader support.
    To avoid this warning use:
        asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

  warnings.warn(PROACTOR_WARNING, RuntimeWarning)

ex.

  1. Follow the text generation example
from g4f.client import Client

client = Client()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
    ...
)
print(response.choices[0].message.content)
  1. Run and wait for a browser window to open and close immediately.
  2. Notice unwanted behaviour.

Environment

  • 3.11
  • Argentina

Thanks!

@augusto-rehfeldt-2 augusto-rehfeldt-2 added the bug Something isn't working label May 17, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented May 17, 2024

Hey, you'll need to make an account for you.com. It creates an account every five requests using the browser. Don't worry about the warning.

@augusto-rehfeldt-2
Copy link
Author

Hey, you'll need to make an account for you.com. It creates an account every five requests using the browser. Don't worry about the warning.

Thanks! But could it do so in --headless mode, so it doesn't just pop in?

@hlohaus
Copy link
Collaborator

hlohaus commented May 18, 2024

It doesn't works in headless mode. But you can use the docker image to hide it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants