monra commited on
Commit
82df63f
1 Parent(s): fd519b4

Synced repo using 'sync_with_huggingface' Github Action

Browse files
client/html/index.html CHANGED
@@ -72,10 +72,10 @@
72
  </div>
73
  <a
74
  class="info"
75
- href="https://github.com/ramonvc/freegpt-webui/tree/chimeragpt-version"
76
  target="_blank">
77
  <i class="fa-brands fa-github"></i>
78
- <span class="conversation-title">freegpt-webui-chimera</span>
79
  </a>
80
  <a class="info" href="https://discord.naga.ac" target="_blank">
81
  <i class="fa-brands fa-discord"></i>
 
72
  </div>
73
  <a
74
  class="info"
75
+ href="https://github.com/ramonvc/freegpt-webui/tree/naga-version"
76
  target="_blank">
77
  <i class="fa-brands fa-github"></i>
78
+ <span class="conversation-title">freegpt-webui-naga</span>
79
  </a>
80
  <a class="info" href="https://discord.naga.ac" target="_blank">
81
  <i class="fa-brands fa-discord"></i>
g4f/Provider/Providers/Naga.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import os
3
+ import openai
4
+ import openai.error
5
+ from dotenv import load_dotenv
6
+ from ...typing import sha256, Dict, get_type_hints
7
+
8
+ load_dotenv()
9
+ api_key_env = os.environ.get("CHIMERA_API_KEY") or os.environ.get("NAGA_API_KEY")
10
+ openai.api_base = "https://api.naga.ac/v1"
11
+
12
+ url = 'https://api.naga.ac'
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-70b-chat',
21
+ 'oasst-sft-6-llama-30b',
22
+ 'claude-instant',
23
+ 'claude-2',
24
+ 'claude-2-100k'
25
+ ]
26
+ supports_stream = True
27
+ needs_auth = False
28
+
29
+
30
+ def _create_completion(model: str, messages: list, stream: bool, api_key: str = None, **kwargs):
31
+
32
+ openai.api_key = api_key if api_key else api_key_env
33
+
34
+ try:
35
+ response = openai.ChatCompletion.create(
36
+ model=model,
37
+ messages=messages,
38
+ stream=stream
39
+ )
40
+
41
+ if (stream):
42
+ for chunk in response:
43
+ yield chunk.choices[0].delta.get("content", "")
44
+ else:
45
+ yield response.choices[0].message.get("content", "")
46
+
47
+ except openai.error.APIError as e:
48
+ detail_pattern = re.compile(r'{"detail":"(.*?)"}')
49
+ match = detail_pattern.search(e.user_message)
50
+ if match:
51
+ error_message = match.group(1)
52
+ print(error_message)
53
+ yield error_message
54
+ else:
55
+ print(e.user_message)
56
+ yield e.user_message
57
+
58
+
59
+ params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
60
+ '(%s)' % ', '.join(
61
+ [f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])
g4f/Provider/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
  from . import Provider
2
  from .Providers import (
3
- Chimera,
4
  )
 
1
  from . import Provider
2
  from .Providers import (
3
+ Naga,
4
  )
g4f/models.py CHANGED
@@ -10,92 +10,92 @@ class Model:
10
  class gpt_35_turbo:
11
  name: str = 'gpt-3.5-turbo'
12
  base_provider: str = 'openai'
13
- best_provider: Provider.Provider = Provider.Chimera
14
 
15
  class gpt_35_turbo_0301:
16
  name: str = 'gpt-3.5-turbo-0301'
17
  base_provider: str = 'openai'
18
- best_provider: Provider.Provider = Provider.Chimera
19
 
20
  class gpt_35_turbo_poe:
21
  name: str = 'gpt-3.5-turbo-poe'
22
  base_provider: str = 'poe'
23
- best_provider: Provider.Provider = Provider.Chimera
24
 
25
  class gpt_35_turbo_16k:
26
  name: str = 'gpt-3.5-turbo-16k'
27
  base_provider: str = 'reversed'
28
- best_provider: Provider.Provider = Provider.Chimera
29
 
30
  class gpt_35_turbo_16k_poe:
31
  name: str = 'gpt-3.5-turbo-16k-poe'
32
  base_provider: str = 'poe'
33
- best_provider: Provider.Provider = Provider.Chimera
34
 
35
  class gpt_4:
36
  name: str = 'gpt-4'
37
  base_provider: str = 'reversed'
38
- best_provider: Provider.Provider = Provider.Chimera
39
 
40
  class gpt_4_0314:
41
  name: str = 'gpt-4-0314'
42
  base_provider: str = 'reversed'
43
- best_provider: Provider.Provider = Provider.Chimera
44
 
45
  class gpt_4_poe:
46
  name: str = 'gpt-4-poe'
47
  base_provider: str = 'poe'
48
- best_provider: Provider.Provider = Provider.Chimera
49
 
50
  class gpt_4_32k:
51
  name: str = 'gpt-4-32k'
52
  base_provider: str = 'reversed'
53
- best_provider: Provider.Provider = Provider.Chimera
54
 
55
  class gpt_4_32k_poe:
56
  name: str = 'gpt-4-32k-poe'
57
  base_provider: str = 'poe'
58
- best_provider: Provider.Provider = Provider.Chimera
59
 
60
  class claude_instant_100k:
61
  name: str = 'claude-instant-100k'
62
  base_provider: str = 'anthropic'
63
- best_provider: Provider.Provider = Provider.Chimera
64
 
65
  class claude_instant:
66
  name: str = 'claude-instant'
67
  base_provider: str = 'anthropic'
68
- best_provider: Provider.Provider = Provider.Chimera
69
 
70
  class claude_2:
71
  name: str = 'claude-2'
72
  base_provider: str = 'anthropic'
73
- best_provider: Provider.Provider = Provider.Chimera
74
 
75
  class claude_2_100k:
76
  name: str = 'claude-2-100k'
77
  base_provider: str = 'anthropic'
78
- best_provider: Provider.Provider = Provider.Chimera
79
 
80
  class llama_2_7b_chat:
81
  name: str = 'llama-2-7b-chat'
82
  base_provider: str = 'llama'
83
- best_provider: Provider.Provider = Provider.Chimera
84
 
85
  class llama_2_13b_chat:
86
  name: str = 'llama-2-13b-chat'
87
  base_provider: str = 'llama'
88
- best_provider: Provider.Provider = Provider.Chimera
89
 
90
  class llama_2_70b_chat:
91
  name: str = 'llama-2-70b-chat'
92
  base_provider: str = 'llama'
93
- best_provider: Provider.Provider = Provider.Chimera
94
 
95
  class oasst_sft_6_llama_30b:
96
  name: str = 'oasst-sft-6-llama-30b'
97
  base_provider: str = 'huggingface-chat'
98
- best_provider: Provider.Provider = Provider.Chimera
99
 
100
 
101
 
 
10
  class gpt_35_turbo:
11
  name: str = 'gpt-3.5-turbo'
12
  base_provider: str = 'openai'
13
+ best_provider: Provider.Provider = Provider.Naga
14
 
15
  class gpt_35_turbo_0301:
16
  name: str = 'gpt-3.5-turbo-0301'
17
  base_provider: str = 'openai'
18
+ best_provider: Provider.Provider = Provider.Naga
19
 
20
  class gpt_35_turbo_poe:
21
  name: str = 'gpt-3.5-turbo-poe'
22
  base_provider: str = 'poe'
23
+ best_provider: Provider.Provider = Provider.Naga
24
 
25
  class gpt_35_turbo_16k:
26
  name: str = 'gpt-3.5-turbo-16k'
27
  base_provider: str = 'reversed'
28
+ best_provider: Provider.Provider = Provider.Naga
29
 
30
  class gpt_35_turbo_16k_poe:
31
  name: str = 'gpt-3.5-turbo-16k-poe'
32
  base_provider: str = 'poe'
33
+ best_provider: Provider.Provider = Provider.Naga
34
 
35
  class gpt_4:
36
  name: str = 'gpt-4'
37
  base_provider: str = 'reversed'
38
+ best_provider: Provider.Provider = Provider.Naga
39
 
40
  class gpt_4_0314:
41
  name: str = 'gpt-4-0314'
42
  base_provider: str = 'reversed'
43
+ best_provider: Provider.Provider = Provider.Naga
44
 
45
  class gpt_4_poe:
46
  name: str = 'gpt-4-poe'
47
  base_provider: str = 'poe'
48
+ best_provider: Provider.Provider = Provider.Naga
49
 
50
  class gpt_4_32k:
51
  name: str = 'gpt-4-32k'
52
  base_provider: str = 'reversed'
53
+ best_provider: Provider.Provider = Provider.Naga
54
 
55
  class gpt_4_32k_poe:
56
  name: str = 'gpt-4-32k-poe'
57
  base_provider: str = 'poe'
58
+ best_provider: Provider.Provider = Provider.Naga
59
 
60
  class claude_instant_100k:
61
  name: str = 'claude-instant-100k'
62
  base_provider: str = 'anthropic'
63
+ best_provider: Provider.Provider = Provider.Naga
64
 
65
  class claude_instant:
66
  name: str = 'claude-instant'
67
  base_provider: str = 'anthropic'
68
+ best_provider: Provider.Provider = Provider.Naga
69
 
70
  class claude_2:
71
  name: str = 'claude-2'
72
  base_provider: str = 'anthropic'
73
+ best_provider: Provider.Provider = Provider.Naga
74
 
75
  class claude_2_100k:
76
  name: str = 'claude-2-100k'
77
  base_provider: str = 'anthropic'
78
+ best_provider: Provider.Provider = Provider.Naga
79
 
80
  class llama_2_7b_chat:
81
  name: str = 'llama-2-7b-chat'
82
  base_provider: str = 'llama'
83
+ best_provider: Provider.Provider = Provider.Naga
84
 
85
  class llama_2_13b_chat:
86
  name: str = 'llama-2-13b-chat'
87
  base_provider: str = 'llama'
88
+ best_provider: Provider.Provider = Provider.Naga
89
 
90
  class llama_2_70b_chat:
91
  name: str = 'llama-2-70b-chat'
92
  base_provider: str = 'llama'
93
+ best_provider: Provider.Provider = Provider.Naga
94
 
95
  class oasst_sft_6_llama_30b:
96
  name: str = 'oasst-sft-6-llama-30b'
97
  base_provider: str = 'huggingface-chat'
98
+ best_provider: Provider.Provider = Provider.Naga
99
 
100
 
101