diff --git a/docs/legacy.md b/docs/legacy.md index ccd8ab6f..78f3350c 100644 --- a/docs/legacy.md +++ b/docs/legacy.md @@ -113,35 +113,6 @@ for chunk in g4f.ChatCompletion.create( print(chunk.alt) # Print used prompt for image generation ``` -##### Using Browser - -Some providers using a browser to bypass the bot protection. They using the selenium webdriver to control the browser. The browser settings and the login data are saved in a custom directory. If the headless mode is enabled, the browser windows are loaded invisibly. For performance reasons, it is recommended to reuse the browser instances and close them yourself at the end: - -```python -import g4f -from undetected_chromedriver import Chrome, ChromeOptions -from g4f.Provider import ( - Bard, - Poe, - AItianhuSpace, - MyShell, - PerplexityAi, -) - -options = ChromeOptions() -options.add_argument("--incognito"); -webdriver = Chrome(options=options, headless=True) -for idx in range(10): - response = g4f.ChatCompletion.create( - model=g4f.models.default, - provider=g4f.Provider.MyShell, - messages=[{"role": "user", "content": "Suggest me a name."}], - webdriver=webdriver - ) - print(f"{idx}:", response) -webdriver.quit() -``` - ##### Async Support To enhance speed and overall performance, execute providers asynchronously. The total execution time will be determined by the duration of the slowest provider's execution.