XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Improve readme, add smartphone guide

79535603
Heiner Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

11 个文件 +152 -86
Modified README.md +48 -41
@@ -19,10 +19,10 @@ pip install -U g4f
19 19 docker pull hlohaus789/g4f
20 20 ```
21 21
22 ## 🆕 What's New
22 ## 🆕 What's New 🚀
23 - How do I use my smartphone📱 to run g4f? [/docs/guides/phone](/docs/guides/phone.md)
23 24 - Join our Telegram Channel: [t.me/g4f_channel](https://telegram.me/g4f_channel)
24 25 - Join our Discord Group: [discord.gg/XfybzPXPH5](https://discord.gg/XfybzPXPH5)
25 - Explore the g4f Documentation (unfinished): [g4f.mintlify.app](https://g4f.mintlify.app) | Contribute to the docs via: [github.com/xtekky/gpt4free-docs](https://github.com/xtekky/gpt4free-docs)
26 26
27 27 ## Site Takedown
28 28 Is your site on this repository and you want to take it down ? email takedown@g4f.ai with proof it is yours and it will be removed as fast as possible. - to prevent reproduction please secure your api ; )
@@ -34,13 +34,13 @@ You can always leave some feedback here: https://forms.gle/FeWV9RLEedfdkmFN6
34 34 As per the survey, here is a list of improvements to come
35 35 - [x] update the repository to include the new openai library syntax (ex: `Openai()` class) | completed, use `g4f.client.Client`
36 36 - [ ] golang implementation
37 - [ ] Improve Documentation (on g4f.mintlify.app) & Do video tutorials
38 - [ ] Improve the provider status list & updates
37 - [ ] 🚧 Improve Documentation (in /docs & Guides, Howtos, & Do video tutorials
38 - [x] Improve the provider status list & updates
39 39 - [ ] Tutorials on how to reverse sites to write your own wrapper (PoC only ofc)
40 40 - [ ] Improve the Bing wrapper. (might write a new wrapper in golang as it is very fast)
41 41 - [ ] Write a standard provider performance test to improve the stability
42 42 - [ ] Potential support and development of local models
43 - [ ] improve compatibility and error handling
43 - [ ] 🚧 improve compatibility and error handling
44 44
45 45 ## 📚 Table of Contents
46 46
@@ -49,22 +49,17 @@ As per the survey, here is a list of improvements to come
49 49 - [🛠️ Getting Started](#-getting-started)
50 50 + [Docker container](#docker-container)
51 51 - [Quick start](#quick-start)
52 + [Use python package](#use-python-package)
52 + [Use python](#use-python)
53 53 - [Prerequisites](#prerequisites)
54 - [Install using pypi](#install-using-pypi)
55 + [Docker for Developers](#docker-for-developers)
54 - [Install using PyPI package:](#install-using-pypi-package-)
55 - [Install from source:](#install-from-source-)
56 - [Install using Docker:](#install-using-docker-)
56 57 - [💡 Usage](#-usage)
57 58 * [The Web UI](#the-web-ui)
58 * [The `g4f` Package](#the-g4f-package)
59 + [ChatCompletion](#chatcompletion)
60 - [Completion](#completion)
61 - [Providers](#providers)
62 - [Using Browser](#using-browser)
63 - [Async Support](#async-support)
64 - [Proxy and Timeout Support](#proxy-and-timeout-support)
65 * [Interference openai-proxy API](#interference-openai-proxy-api-use-with-openai-python-package-)
66 + [Run interference API from PyPi package](#run-interference-api-from-pypi-package)
67 + [Run interference API from repo](#run-interference-api-from-repo)
59 * [Text Generation](#text-generation)
60 * [Image Generation](#text-generation)
61 * [Interference API](#interference-api)
62 * [Configuration](#configuration)
68 63 - [🚀 Providers and Models](#-providers-and-models)
69 64 * [GPT-4](#gpt-4)
70 65 * [GPT-3.5](#gpt-35)
@@ -96,6 +91,11 @@ docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f
96 91 or set the api base in your client to: [http://localhost:1337/v1](http://localhost:1337/v1)
97 92 4. (Optional) If you need to log in to a provider, you can view the desktop from the container here: http://localhost:7900/?autoconnect=1&resize=scale&password=secret.
98 93
94 ##### Use your smartphone:
95
96 Run the Web UI on Your Smartphone:
97 - [/docs/guides/phone](/docs/guides/phone.md)
98
99 99 #### Use python
100 100
101 101 ##### Prerequisites:
@@ -109,18 +109,19 @@ or set the api base in your client to: [http://localhost:1337/v1](http://localho
109 109 pip install -U g4f[all]
110 110 ```
111 111
112 Or use partial requirements.
113
114 See: [/docs/requirements](/docs/requirements.md)
112 How do I install only parts or do disable parts?
113 Use partial requirements: [/docs/requirements](/docs/requirements.md)
115 114
116 ##### Install from source using git:
115 ##### Install from source:
117 116
118 See: [/docs/git](/docs/git.md)
117 How do I load the project using git and installing the project requirements?
118 Read this tutorial and follow it step by step: [/docs/git](/docs/git.md)
119 119
120 120
121 ##### Install using Docker for Developers:
121 ##### Install using Docker:
122 122
123 See: [/docs/docker](/docs/docker.md)
123 How do I build and run composer image from source?
124 Use docker-compose: [/docs/docker](/docs/docker.md)
124 125
125 126
126 127 ## 💡 Usage
@@ -139,6 +140,10 @@ response = client.chat.completions.create(
139 140 print(response.choices[0].message.content)
140 141 ```
141 142
143 ```
144 Hello! How can I assist you today?
145 ```
146
142 147 #### Image Generation
143 148
144 149 ```python
@@ -159,8 +164,8 @@ image_url = response.data[0].url
159 164
160 165 **See also:**
161 166
162 - Documentation for the new Client: [/docs/client](/docs/client.md)
163 - Documentation for the leagcy API: [docs/leagcy](/docs/leagcy.md)
167 - Documentation for the new Client API: [/docs/client](/docs/client.md)
168 - Documentation for the leagcy API: [/docs/leagcy](/docs/leagcy.md)
164 169
165 170
166 171 #### Web UI
@@ -228,11 +233,10 @@ set G4F_PROXY=http://host:port
228 233 | Website | Provider | GPT-3.5 | GPT-4 | Stream | Status | Auth |
229 234 | ------ | ------- | ------- | ----- | ------ | ------ | ---- |
230 235 | [bing.com](https://bing.com/chat) | `g4f.Provider.Bing` | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
231 | [free.chatgpt.org.uk](https://free.chatgpt.org.uk) | `g4f.Provider.FreeChatgpt` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
232 236 | [liaobots.site](https://liaobots.site) | `g4f.Provider.Liaobots` | ✔️ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
233 | [chat.openai.com](https://chat.openai.com) | `g4f.Provider.OpenaiChat` | ✔️ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
237 | [chat.openai.com](https://chat.openai.com) | `g4f.Provider.OpenaiChat` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
234 238 | [raycast.com](https://raycast.com) | `g4f.Provider.Raycast` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
235 | [beta.theb.ai](https://beta.theb.ai) | `g4f.Provider.Theb` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
239 | [you.com](https://you.com) | `g4f.Provider.You` | ✔️ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
236 240 | [chat.geekgpt.org](https://chat.geekgpt.org) | `g4f.Provider.GeekGpt` | ✔️ | ✔️ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
237 241
238 242 ### GPT-3.5
@@ -242,14 +246,13 @@ set G4F_PROXY=http://host:port
242 246 | [chat3.aiyunos.top](https://chat3.aiyunos.top/) | `g4f.Provider.AItianhuSpace` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
243 247 | [aichatonline.org](https://aichatonline.org) | `g4f.Provider.AiChatOnline` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
244 248 | [openchat.team](https://openchat.team) | `g4f.Provider.Aura` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
245 | [chatbase.co](https://www.chatbase.co) | `g4f.Provider.ChatBase` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
249 | [chatbase.co](https://www.chatbase.co) | `g4f.Provider.ChatBase` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
246 250 | [chatforai.store](https://chatforai.store) | `g4f.Provider.ChatForAi` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
247 251 | [chatgpt.ai](https://chatgpt.ai) | `g4f.Provider.ChatgptAi` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
248 252 | [chat.chatgptdemo.net](https://chat.chatgptdemo.net) | `g4f.Provider.ChatgptDemo` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
249 253 | [chatgpt-free.cc](https://www.chatgpt-free.cc) | `g4f.Provider.ChatgptNext` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
250 254 | [chat.3211000.xyz](https://chat.3211000.xyz) | `g4f.Provider.Chatxyz` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
251 255 | [gptalk.net](https://gptalk.net) | `g4f.Provider.GPTalk` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
252 | [geminiprochat.com](https://geminiprochat.com) | `g4f.Provider.GeminiProChat` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
253 256 | [gpt6.ai](https://gpt6.ai) | `g4f.Provider.Gpt6` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
254 257 | [gptchatly.com](https://gptchatly.com) | `g4f.Provider.GptChatly` | ✔️ | ❌ | ❌ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
255 258 | [ai18.gptforlove.com](https://ai18.gptforlove.com) | `g4f.Provider.GptForLove` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
@@ -261,7 +264,6 @@ set G4F_PROXY=http://host:port
261 264 | [perplexity.ai](https://www.perplexity.ai) | `g4f.Provider.PerplexityAi` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
262 265 | [poe.com](https://poe.com) | `g4f.Provider.Poe` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
263 266 | [talkai.info](https://talkai.info) | `g4f.Provider.TalkAi` | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
264 | [you.com](https://you.com) | `g4f.Provider.You` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
265 267 | [aitianhu.com](https://www.aitianhu.com) | `g4f.Provider.AItianhu` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
266 268 | [e.aiask.me](https://e.aiask.me) | `g4f.Provider.AiAsk` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
267 269 | [chatgpt.bestim.org](https://chatgpt.bestim.org) | `g4f.Provider.Bestim` | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
@@ -284,12 +286,16 @@ set G4F_PROXY=http://host:port
284 286 | ------ | ------- | ------- | ----- | ------ | ------ | ---- |
285 287 | [bard.google.com](https://bard.google.com) | `g4f.Provider.Bard` | ❌ | ❌ | ❌ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
286 288 | [deepinfra.com](https://deepinfra.com) | `g4f.Provider.DeepInfra` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
287 | [gemini.google.com](https://gemini.google.com) | `g4f.Provider.Gemini` | ❌ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
288 | [huggingface.co](https://huggingface.co/chat) | `g4f.Provider.HuggingChat` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
289 | [gemini.google.com](https://gemini.google.com) | `g4f.Provider.Gemini` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
290 | [ai.google.dev](https://ai.google.dev) | `g4f.Provider.GeminiPro` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Active-brightgreen) | ❌ |
291 | [gemini-chatbot-sigma.vercel.app](https://gemini-chatbot-sigma.vercel.app) | `g4f.Provider.GeminiProChat` | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
292 | [huggingface.co](https://huggingface.co/chat) | `g4f.Provider.HuggingChat` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
289 293 | [llama2.ai](https://www.llama2.ai) | `g4f.Provider.Llama2` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
290 294 | [labs.perplexity.ai](https://labs.perplexity.ai) | `g4f.Provider.PerplexityLabs` | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
291 | [phind.com](https://www.phind.com) | `g4f.Provider.Phind` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
292 | [pi.ai](https://pi.ai/talk) | `g4f.Provider.Pi` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
295 | [phind.com](https://www.phind.com) | `g4f.Provider.Phind` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Active-brightgreen) | ❌ |
296 | [pi.ai](https://pi.ai/talk) | `g4f.Provider.Pi` | ❌ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Active-brightgreen) | ❌ |
297 | [beta.theb.ai](https://beta.theb.ai) | `g4f.Provider.Theb` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
298 | [free.chatgpt.org.uk](https://free.chatgpt.org.uk) | `g4f.Provider.FreeChatgpt` | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
293 299 | [theb.ai](https://theb.ai) | `g4f.Provider.ThebApi` | ❌ | ❌ | ❌ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
294 300 | [open-assistant.io](https://open-assistant.io/chat) | `g4f.Provider.OpenAssistant` | ❌ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ✔️ |
295 301
@@ -300,10 +306,11 @@ set G4F_PROXY=http://host:port
300 306 | gpt-3.5-turbo | OpenAI | 5+ Providers | [openai.com](https://openai.com/) |
301 307 | gpt-4 | OpenAI | 2+ Providers | [openai.com](https://openai.com/) |
302 308 | gpt-4-turbo | OpenAI | g4f.Provider.Bing | [openai.com](https://openai.com/) |
303 | Llama-2-7b-chat-hf | Huggingface | 2+ Providers | [huggingface.co](https://huggingface.co/) |
304 | Llama-2-13b-chat-hf | Huggingface | 2+ Providers | [huggingface.co](https://huggingface.co/) |
305 | Llama-2-70b-chat-hf | Huggingface | 4+ Providers | [huggingface.co](https://huggingface.co/) |
306 | CodeLlama-34b-Instruct-hf | Huggingface | 3+ Providers | [huggingface.co](https://huggingface.co/) |
309 | Llama-2-7b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
310 | Llama-2-13b-chat-hf | Meta | 2+ Providers | [llama.meta.com](https://llama.meta.com/) |
311 | Llama-2-70b-chat-hf | Meta | 4+ Providers | [llama.meta.com](https://llama.meta.com/) |
312 | CodeLlama-34b-Instruct-hf | Meta | 3+ Providers | [llama.meta.com](https://llama.meta.com/) |
313 | CodeLlama-70b-Instruct-hf | Meta | g4f.Provider.DeepInfra | [llama.meta.com](https://llama.meta.com/) |
307 314 | Mixtral-8x7B-Instruct-v0.1 | Huggingface | 3+ Providers | [huggingface.co](https://huggingface.co/) |
308 315 | Mistral-7B-Instruct-v0.1 | Huggingface | 3+ Providers | [huggingface.co](https://huggingface.co/) |
309 316 | dolphin-2.6-mixtral-8x7b | Huggingface | g4f.Provider.DeepInfra | [huggingface.co](https://huggingface.co/) |
Modified docs/client.md +33 -8
@@ -1,4 +1,4 @@
1 ### G4F - Client API (Beta Version)
1 ### G4F - Client API
2 2
3 3 #### Introduction
4 4
@@ -39,7 +39,7 @@ client = Client(
39 39
40 40 ## Configuration
41 41
42 You can set an "api_key" for your provider in client.
42 You can set an "api_key" for your provider in the client.
43 43 And you also have the option to define a proxy for all outgoing requests:
44 44
45 45 ```python
@@ -108,13 +108,35 @@ response = client.images.create_variation(
108 108
109 109 image_url = response.data[0].url
110 110 ```
111
112 #### Visual Examples
113
114 111 Original / Variant:
115 112
116 113 [![Original Image](/docs/cat.jpeg)](/docs/client.md) [![Variant Image](/docs/cat.webp)](/docs/client.md)
117 114
115 #### Use a list of providers with RetryProvider
116
117 ```python
118 from g4f.client import Client
119 from g4f.Provider import RetryProvider, Phind, FreeChatgpt, Liaobots
120
121 import g4f.debug
122 g4f.debug.logging = True
123
124 client = Client(
125 provider=RetryProvider([Phind, FreeChatgpt, Liaobots], shuffle=False)
126 )
127 response = client.chat.completions.create(
128 model="",
129 messages=[{"role": "user", "content": "Hello"}],
130 )
131 print(response.choices[0].message.content)
132 ```
133
134 ```
135 Using RetryProvider provider
136 Using Phind provider
137 How can I assist you today?
138 ```
139
118 140 #### Advanced example using GeminiProVision
119 141
120 142 ```python
@@ -128,13 +150,16 @@ client = Client(
128 150 response = client.chat.completions.create(
129 151 model="gemini-pro-vision",
130 152 messages=[{"role": "user", "content": "What are on this image?"}],
131 image=open("docs/cat.jpeg", "rb")
153 image=open("docs/waterfall.jpeg", "rb")
132 154 )
133 155 print(response.choices[0].message.content)
134 156 ```
135 **Question:** What are on this image?
157 ![Waterfall](/docs/waterfall.jpeg)
158 ```
159 User: What are on this image?
160 ```
136 161 ```
137 A cat is sitting on a window sill looking at a bird outside the window.
162 Bot: There is a waterfall in the middle of a jungle. There is a rainbow over...
138 163 ```
139 164
140 165 [Return to Home](/)
Added docs/guides/phone.jpeg +0 -0
二进制文件已变更,无法进行逐行预览。
Added docs/guides/phone.md +50 -0
@@ -0,0 +1,50 @@
1 ### Guide: Running the G4F GUI on Your Smartphone
2
3 Running Python applications on your smartphone is possible with specialized apps like Pydroid. This tutorial will walk you through the process using an Android smartphone with Pydroid. Note that the steps may vary slightly for iPhone users due to differences in app names and ownership.
4
5 <p align="center">
6 On the first screenshot is <strong>Pydroid</strong> and on the second is the <strong>Web UI</strong> in a browser
7 </p>
8
9 <p align="center">
10 <img src="/docs/guides/phone.png" />
11 <img src="/docs/guides/phone2.jpeg" />
12 </p>
13
14 1. **Install Pydroid from the Google Play Store:**
15 - Navigate to the Google Play Store and search for "Pydroid 3 - IDE for Python 3" or use the following link: [Pydroid 3 - IDE for Python 3](https://play.google.com/store/apps/details/Pydroid_3_IDE_for_Python_3).
16
17 2. **Install the Pydroid Repository Plugin:**
18 - To enhance functionality, install the Pydroid repository plugin. Find it on the Google Play Store or use this link: [Pydroid Repository Plugin](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3.quickinstallrepo).
19
20 3. **Adjust App Settings:**
21 - In the app settings for Pydroid, disable power-saving mode and ensure that the option to pause when not in use is also disabled. This ensures uninterrupted operation of your Python scripts.
22
23 4. **Install Required Packages:**
24 - Open Pip within the Pydroid app and install the necessary packages by executing the following commands:
25 ```
26 pip install g4f flask pillow beautifulsoup4
27 ```
28
29 5. **Create a New Python Script:**
30 - Within Pydroid, create a new Python script and input the following content:
31 ```python
32 from g4f import set_cookies
33
34 set_cookies(".bing.com", {
35 "_U": "cookie value"
36 })
37
38 from g4f.gui import run_gui
39
40 run_gui("0.0.0.0", 8080, debug=True)
41 ```
42 Replace `"cookie value"` with your actual cookie value from Bing if you intend to create images using Bing.
43
44 6. **Execute the Script:**
45 - Run the script by clicking on the play button or selecting the option to execute it.
46
47 7. **Access the GUI:**
48 - Wait for the server to start, and once it's running, open the GUI using the URL provided in the output. [http://localhost:8080/chat/](http://localhost:8080/chat/)
49
50 By following these steps, you can successfully run the G4F GUI on your smartphone using Pydroid, allowing you to create and interact with graphical interfaces directly from your device.
Added docs/guides/phone.png +0 -0
二进制文件已变更,无法进行逐行预览。
Added docs/guides/phone2.jpeg +0 -0
二进制文件已变更,无法进行逐行预览。
Added docs/waterfall.jpeg +0 -0
二进制文件已变更,无法进行逐行预览。
Modified etc/tool/readme_table.py +5 -3
@@ -87,7 +87,8 @@ def print_models():
87 87 "openai": "OpenAI",
88 88 "huggingface": "Huggingface",
89 89 "anthropic": "Anthropic",
90 "inflection": "Inflection"
90 "inflection": "Inflection",
91 "meta": "Meta"
91 92 }
92 93 provider_urls = {
93 94 "google": "https://gemini.google.com/",
@@ -95,6 +96,7 @@ def print_models():
95 96 "huggingface": "https://huggingface.co/",
96 97 "anthropic": "https://www.anthropic.com/",
97 98 "inflection": "https://inflection.ai/",
99 "meta": "https://llama.meta.com/"
98 100 }
99 101
100 102 lines = [
@@ -120,6 +122,6 @@ def print_models():
120 122 print("\n".join(lines))
121 123
122 124 if __name__ == "__main__":
123 #print_providers()
124 #print("\n", "-" * 50, "\n")
125 print_providers()
126 print("\n", "-" * 50, "\n")
125 127 print_models()
Modified g4f/Provider/FreeChatgpt.py +11 -28
@@ -4,24 +4,13 @@ import json, random
4 4 from aiohttp import ClientSession
5 5
6 6 from ..typing import AsyncResult, Messages
7 from .base_provider import AsyncGeneratorProvider
7 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
8 8
9 models = {
10 "claude-v2": "claude-2.0",
11 "claude-v2.1":"claude-2.1",
12 "gemini-pro": "google-gemini-pro"
13 }
14 urls = [
15 "https://free.chatgpt.org.uk",
16 "https://ai.chatgpt.org.uk"
17 ]
18
19 class FreeChatgpt(AsyncGeneratorProvider):
9 class FreeChatgpt(AsyncGeneratorProvider, ProviderModelMixin):
20 10 url = "https://free.chatgpt.org.uk"
21 11 working = True
22 supports_gpt_35_turbo = True
23 supports_gpt_4 = True
24 12 supports_message_history = True
13 default_model = "google-gemini-pro"
25 14
26 15 @classmethod
27 16 async def create_async_generator(
@@ -31,11 +20,6 @@ class FreeChatgpt(AsyncGeneratorProvider):
31 20 proxy: str = None,
32 21 **kwargs
33 22 ) -> AsyncResult:
34 if model in models:
35 model = models[model]
36 elif not model:
37 model = "gpt-3.5-turbo"
38 url = random.choice(urls)
39 23 headers = {
40 24 "Accept": "application/json, text/event-stream",
41 25 "Content-Type":"application/json",
@@ -51,16 +35,15 @@ class FreeChatgpt(AsyncGeneratorProvider):
51 35 }
52 36 async with ClientSession(headers=headers) as session:
53 37 data = {
54 "messages":messages,
55 "stream":True,
56 "model":model,
57 "temperature":0.5,
58 "presence_penalty":0,
59 "frequency_penalty":0,
60 "top_p":1,
61 **kwargs
38 "messages": messages,
39 "stream": True,
40 "model": cls.get_model(""),
41 "temperature": kwargs.get("temperature", 0.5),
42 "presence_penalty": kwargs.get("presence_penalty", 0),
43 "frequency_penalty": kwargs.get("frequency_penalty", 0),
44 "top_p": kwargs.get("top_p", 1)
62 45 }
63 async with session.post(f'{url}/api/openai/v1/chat/completions', json=data, proxy=proxy) as response:
46 async with session.post(f'{cls.url}/api/openai/v1/chat/completions', json=data, proxy=proxy) as response:
64 47 response.raise_for_status()
65 48 started = False
66 49 async for line in response.content:
Modified g4f/Provider/GeminiProChat.py +0 -1
@@ -11,7 +11,6 @@ from .base_provider import AsyncGeneratorProvider
11 11 class GeminiProChat(AsyncGeneratorProvider):
12 12 url = "https://gemini-chatbot-sigma.vercel.app"
13 13 working = True
14 supports_gpt_35_turbo = True
15 14
16 15 @classmethod
17 16 async def create_async_generator(
Modified g4f/models.py +5 -5
@@ -99,31 +99,31 @@ gpt_4_turbo = Model(
99 99
100 100 llama2_7b = Model(
101 101 name = "meta-llama/Llama-2-7b-chat-hf",
102 base_provider = 'huggingface',
102 base_provider = 'meta',
103 103 best_provider = RetryProvider([Llama2, DeepInfra])
104 104 )
105 105
106 106 llama2_13b = Model(
107 107 name = "meta-llama/Llama-2-13b-chat-hf",
108 base_provider = 'huggingface',
108 base_provider = 'meta',
109 109 best_provider = RetryProvider([Llama2, DeepInfra])
110 110 )
111 111
112 112 llama2_70b = Model(
113 113 name = "meta-llama/Llama-2-70b-chat-hf",
114 base_provider = "huggingface",
114 base_provider = "meta",
115 115 best_provider = RetryProvider([Llama2, DeepInfra, HuggingChat, PerplexityLabs])
116 116 )
117 117
118 118 codellama_34b_instruct = Model(
119 119 name = "codellama/CodeLlama-34b-Instruct-hf",
120 base_provider = "huggingface",
120 base_provider = "meta",
121 121 best_provider = RetryProvider([HuggingChat, PerplexityLabs, DeepInfra])
122 122 )
123 123
124 124 codellama_70b_instruct = Model(
125 125 name = "codellama/CodeLlama-70b-Instruct-hf",
126 base_provider = "huggingface",
126 base_provider = "meta",
127 127 best_provider = DeepInfra
128 128 )
129 129