diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-01-29 20:37:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 20:37:59 +0100 |
commit | 280ddf57b0f54d1805f1ee26aa699469019e731f (patch) | |
tree | cabcbf5fa9a5dbf75a223377dbf032cfeb3e1027 /README.md | |
parent | Merge pull request #1523 from u66u/which-webdriver (diff) | |
parent | Improve readme / unittests (diff) | |
download | gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.gz gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.bz2 gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.lz gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.xz gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.zst gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.zip |
Diffstat (limited to '')
-rw-r--r-- | README.md | 59 |
1 files changed, 56 insertions, 3 deletions
@@ -99,8 +99,33 @@ or set the api base in your client to: [http://localhost:1337/v1](http://localho ##### Install using pypi: +Install all supported tools / all used packages: ``` -pip install -U "g4f[all]" +pip install -U g4f[all] +``` +Install required packages for the OpenaiChat provider: +``` +pip install -U g4f[openai] +``` +Install required packages for the interference api: +``` +pip install -U g4f[api] +``` +Install required packages for the web interface: +``` +pip install -U g4f[gui] +``` +Install required packages for uploading / generating images: +``` +pip install -U g4f[image] +``` +Install required packages for providers with webdriver: +``` +pip install -U g4f[webdriver] +``` +Install required packages for proxy support: +``` +pip install -U aiohttp_socks ``` ##### or: @@ -202,8 +227,9 @@ docker-compose down ### The Web UI -To use it in the web interface, type the following codes in the command line. -```python3 +To start the web interface, type the following codes in the command line. + +```python from g4f.gui import run_gui run_gui() ``` @@ -283,6 +309,33 @@ for message in response: print(message) ``` +##### Cookies / Access Token + +For generating images with Bing and for the OpenAi Chat you need cookies or a token from your browser session. From Bing you need the "_U" cookie and from OpenAI you need the "access_token". You can pass the cookies / the access token in the create function or you use the `set_cookies` setter: + +```python +from g4f import set_cookies + +set_cookies(".bing", { + "_U": "cookie value" +}) +set_cookies("chat.openai.com", { + "access_token": "token value" +}) + +from g4f.gui import run_gui +run_gui() +``` + +Alternatively, g4f reads the cookies with “browser_cookie3” from your browser +or it starts a browser instance with selenium "webdriver" for logging in. +If you use the pip package, you have to install “browser_cookie3” or "webdriver" by yourself. + +```bash +pip install browser_cookie3 +pip install g4f[webdriver] +``` + ##### 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: |