返回提交历史
Modified
README.md
+21
-20
Modified
docker-compose.yml
+2
-2
Modified
g4f/Provider/Llama2.py
+7
-9
XFEstudio/gpt4free
Fix llama2 provider, Update TOC in readme (#1325)
c3ccc4e8
代码差异
3 个文件
+30
-31
@@ -22,36 +22,37 @@ docker pull hlohaus789/g4f
22
22
23
23
## 📚 Table of Contents
24
24
25
- [🆕 What's New](#-whats-new)
25
- [🆕 What's New](#-what-s-new)
26
26
- [📚 Table of Contents](#-table-of-contents)
27
- [🛠️ Getting Started](#️-getting-started)
28
- [Prerequisites:](#prerequisites)
29
- [Setting up the project:](#setting-up-the-project)
27
- [🛠️ Getting Started](#-getting-started)
28
+ [Docker container](#docker-container)
29
- [Quick start](#quick-start)
30
+ [Use python package](#use-python-package)
31
- [Prerequisites](#prerequisites)
30
32
- [Install using pypi](#install-using-pypi)
31
- [or](#or)
32
- [Setting up with Docker:](#setting-up-with-docker)
33
+ [Docker for Developers](#docker-for-developers)
33
34
- [💡 Usage](#-usage)
34
- [The `g4f` Package](#the-g4f-package)
35
- [ChatCompletion](#chatcompletion)
35
* [The `g4f` Package](#the-g4f-package)
36
+ [ChatCompletion](#chatcompletion)
36
37
- [Completion](#completion)
37
38
- [Providers](#providers)
38
- [Cookies Required](#cookies-required)
39
- [Using Browser](#using-browser)
39
40
- [Async Support](#async-support)
40
41
- [Proxy and Timeout Support](#proxy-and-timeout-support)
41
- [Interference openai-proxy API (Use with openai python package)](#interference-openai-proxy-api-use-with-openai-python-package)
42
- [Run interference API from PyPi package](#run-interference-api-from-pypi-package)
43
- [Run interference API from repo](#run-interference-api-from-repo)
42
* [Interference openai-proxy API](#interference-openai-proxy-api-use-with-openai-python-package-)
43
+ [Run interference API from PyPi package](#run-interference-api-from-pypi-package)
44
+ [Run interference API from repo](#run-interference-api-from-repo)
44
45
- [🚀 Providers and Models](#-providers-and-models)
45
- [GPT-4](#gpt-4)
46
- [GPT-3.5](#gpt-35)
47
- [Other](#other)
48
- [Models](#models)
46
* [GPT-4](#gpt-4)
47
* [GPT-3.5](#gpt-35)
48
* [Other](#other)
49
* [Models](#models)
49
50
- [🔗 Related GPT4Free Projects](#-related-gpt4free-projects)
50
51
- [🤝 Contribute](#-contribute)
51
- [Create Provider with AI Tool](#create-provider-with-ai-tool)
52
- [Create Provider](#create-provider)
52
+ [Create Provider with AI Tool](#create-provider-with-ai-tool)
53
+ [Create Provider](#create-provider)
53
54
- [🙌 Contributors](#-contributors)
54
- [©️ Copyright](#️-copyright)
55
- [©️ Copyright](#-copyright)
55
56
- [⭐ Star History](#-star-history)
56
57
- [📄 License](#-license)
57
58
@@ -70,7 +71,7 @@ docker run -p 8080:80 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f:l
70
71
```
71
72
3. Open the included client on: [http://localhost:8080/chat/](http://localhost:8080/chat/)
72
73
or set the api base in your client to: [http://localhost:1337/v1](http://localhost:1337/v1)
73
4. (Optional) If you need to log in to a provider, you can open the desktop in the container here: http://localhost:7900/?autoconnect=1&resize=scale&password=secret.
74
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.
74
75
75
76
#### Use python package
76
77
@@ -7,8 +7,8 @@ services:
7
7
build:
8
8
context: .
9
9
dockerfile: docker/Dockerfile
10
# volumes:
11
# - .:/app
10
volumes:
11
- .:/app
12
12
ports:
13
13
- '8080:80'
14
14
- '1337:1337'
@@ -6,10 +6,9 @@ from ..typing import AsyncResult, Messages
6
6
from .base_provider import AsyncGeneratorProvider
7
7
8
8
models = {
9
"meta-llama/Llama-2-7b-chat-hf": {"name": "Llama 2 7B", "version": "d24902e3fa9b698cc208b5e63136c4e26e828659a9f09827ca6ec5bb83014381", "shortened":"7B"},
10
"meta-llama/Llama-2-13b-chat-hf": {"name": "Llama 2 13B", "version": "9dff94b1bed5af738655d4a7cbcdcde2bd503aa85c94334fe1f42af7f3dd5ee3", "shortened":"13B"},
11
"meta-llama/Llama-2-70b-chat-hf": {"name": "Llama 2 70B", "version": "2796ee9483c3fd7aa2e171d38f4ca12251a30609463dcfd4cd76703f22e96cdf", "shortened":"70B"},
12
"Llava": {"name": "Llava 13B", "version": "6bc1c7bb0d2a34e413301fee8f7cc728d2d4e75bfab186aa995f63292bda92fc", "shortened":"Llava"}
9
"meta-llama/Llama-2-7b-chat-hf": "meta/llama-2-7b-chat",
10
"meta-llama/Llama-2-13b-chat-hf": "meta/llama-2-13b-chat",
11
"meta-llama/Llama-2-70b-chat-hf": "meta/llama-2-70b-chat",
13
12
}
14
13
15
14
class Llama2(AsyncGeneratorProvider):
@@ -26,10 +25,9 @@ class Llama2(AsyncGeneratorProvider):
26
25
**kwargs
27
26
) -> AsyncResult:
28
27
if not model:
29
model = "meta-llama/Llama-2-70b-chat-hf"
30
elif model not in models:
31
raise ValueError(f"Model are not supported: {model}")
32
version = models[model]["version"]
28
model = "meta/llama-2-70b-chat"
29
elif model in models:
30
model = models[model]
33
31
headers = {
34
32
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0",
35
33
"Accept": "*/*",
@@ -50,7 +48,7 @@ class Llama2(AsyncGeneratorProvider):
50
48
prompt = format_prompt(messages)
51
49
data = {
52
50
"prompt": prompt,
53
"version": version,
51
"model": model,
54
52
"systemPrompt": kwargs.get("system_message", "You are a helpful assistant."),
55
53
"temperature": kwargs.get("temperature", 0.75),
56
54
"topP": kwargs.get("top_p", 0.9),