Spaces:
Running
Running
Synced repo using 'sync_with_huggingface' Github Action
Browse files- client/html/index.html +0 -12
- g4f/Provider/Providers/Chimera.py +8 -17
client/html/index.html
CHANGED
@@ -111,22 +111,10 @@
|
|
111 |
<optgroup label="GPT">
|
112 |
<option value="gpt-3.5-turbo">GPT-3.5-turbo</option>
|
113 |
<option value="gpt-3.5-turbo-0301">GPT-3.5-turbo-0301</option>
|
114 |
-
<option value="gpt-3.5-turbo-poe">GPT-3.5-turbo-poe</option>
|
115 |
<option value="gpt-3.5-turbo-16k">GPT-3.5-turbo-16k</option>
|
116 |
-
<option value="gpt-3.5-turbo-16k-poe">GPT-3.5-turbo-16k-poe</option>
|
117 |
<option value="gpt-4">GPT-4</option>
|
118 |
<option value="gpt-4-0314">GPT-4-0314</option>
|
119 |
-
<option value="gpt-4-poe">GPT-4-poe</option>
|
120 |
<option value="gpt-4-32k">GPT-4-32k</option>
|
121 |
-
<option value="gpt-4-32k-poe">GPT-4-32k-poe</option>
|
122 |
-
</optgroup>
|
123 |
-
<optgroup label="SAGE">
|
124 |
-
<option value="sage">Sage</option>
|
125 |
-
</optgroup>
|
126 |
-
<optgroup label="CLAUDE">
|
127 |
-
<option value="claude-instant">Claude-Instant</option>
|
128 |
-
<option value="claude-2-100k">Claude-2-100k</option>
|
129 |
-
<option value="claude-instant-100k">Claude-Instant-100k</option>
|
130 |
</optgroup>
|
131 |
<optgroup label="LLAMA">
|
132 |
<option value="llama-2-7b-chat">llama-2-7b-chat</option>
|
|
|
111 |
<optgroup label="GPT">
|
112 |
<option value="gpt-3.5-turbo">GPT-3.5-turbo</option>
|
113 |
<option value="gpt-3.5-turbo-0301">GPT-3.5-turbo-0301</option>
|
|
|
114 |
<option value="gpt-3.5-turbo-16k">GPT-3.5-turbo-16k</option>
|
|
|
115 |
<option value="gpt-4">GPT-4</option>
|
116 |
<option value="gpt-4-0314">GPT-4-0314</option>
|
|
|
117 |
<option value="gpt-4-32k">GPT-4-32k</option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
</optgroup>
|
119 |
<optgroup label="LLAMA">
|
120 |
<option value="llama-2-7b-chat">llama-2-7b-chat</option>
|
g4f/Provider/Providers/Chimera.py
CHANGED
@@ -13,30 +13,19 @@ url = 'https://chimeragpt.adventblocks.cc/'
|
|
13 |
model = [
|
14 |
'gpt-3.5-turbo',
|
15 |
'gpt-3.5-turbo-0301',
|
16 |
-
'gpt-3.5-turbo-poe',
|
17 |
-
'gpt-3.5-turbo-openai',
|
18 |
'gpt-3.5-turbo-16k',
|
19 |
-
'gpt-3.5-turbo-16k-openai',
|
20 |
-
'gpt-3.5-turbo-16k-poe',
|
21 |
'gpt-4',
|
22 |
'gpt-4-0314',
|
23 |
-
'gpt-4-poe',
|
24 |
'gpt-4-32k',
|
25 |
-
'
|
26 |
-
'claude_instant',
|
27 |
-
'claude-instant-100k',
|
28 |
-
'claude-2-100k',
|
29 |
-
'llama-2-7b-chat'
|
30 |
'llama-2-13b-chat',
|
31 |
'llama-2-70b-chat',
|
32 |
-
'sage'
|
33 |
]
|
34 |
-
|
35 |
supports_stream = True
|
36 |
needs_auth = False
|
37 |
|
38 |
|
39 |
-
def _create_completion(
|
40 |
|
41 |
openai.api_key = api_key if api_key else api_key_env
|
42 |
|
@@ -47,9 +36,12 @@ def _create_completion(api_key: str, model: str, messages: list, stream: bool, *
|
|
47 |
stream=stream
|
48 |
)
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
53 |
except openai.error.APIError as e:
|
54 |
detail_pattern = re.compile(r'{"detail":"(.*?)"}')
|
55 |
match = detail_pattern.search(e.user_message)
|
@@ -62,7 +54,6 @@ def _create_completion(api_key: str, model: str, messages: list, stream: bool, *
|
|
62 |
yield e.user_message
|
63 |
|
64 |
|
65 |
-
|
66 |
params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
|
67 |
'(%s)' % ', '.join(
|
68 |
[f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])
|
|
|
13 |
model = [
|
14 |
'gpt-3.5-turbo',
|
15 |
'gpt-3.5-turbo-0301',
|
|
|
|
|
16 |
'gpt-3.5-turbo-16k',
|
|
|
|
|
17 |
'gpt-4',
|
18 |
'gpt-4-0314',
|
|
|
19 |
'gpt-4-32k',
|
20 |
+
'llama-2-7b-chat',
|
|
|
|
|
|
|
|
|
21 |
'llama-2-13b-chat',
|
22 |
'llama-2-70b-chat',
|
|
|
23 |
]
|
|
|
24 |
supports_stream = True
|
25 |
needs_auth = False
|
26 |
|
27 |
|
28 |
+
def _create_completion(model: str, messages: list, stream: bool, api_key: str = None, **kwargs):
|
29 |
|
30 |
openai.api_key = api_key if api_key else api_key_env
|
31 |
|
|
|
36 |
stream=stream
|
37 |
)
|
38 |
|
39 |
+
if (stream):
|
40 |
+
for chunk in response:
|
41 |
+
yield chunk.choices[0].delta.get("content", "")
|
42 |
+
else:
|
43 |
+
yield response.choices[0].message.get("content", "")
|
44 |
+
|
45 |
except openai.error.APIError as e:
|
46 |
detail_pattern = re.compile(r'{"detail":"(.*?)"}')
|
47 |
match = detail_pattern.search(e.user_message)
|
|
|
54 |
yield e.user_message
|
55 |
|
56 |
|
|
|
57 |
params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
|
58 |
'(%s)' % ', '.join(
|
59 |
[f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])
|