starsaround
commited on
Commit
•
80250d2
1
Parent(s):
3e6aca2
Upload 2 files
Browse filesforce provider work, more providers.
models_for_langchain/__pycache__/model.cpython-311.pyc
CHANGED
Binary files a/models_for_langchain/__pycache__/model.cpython-311.pyc and b/models_for_langchain/__pycache__/model.cpython-311.pyc differ
|
|
models_for_langchain/model.py
CHANGED
@@ -14,8 +14,17 @@ from g4f.Provider import (
|
|
14 |
H2o,
|
15 |
ChatgptLogin,
|
16 |
DeepAi,
|
17 |
-
GetGpt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
)
|
|
|
19 |
import g4f
|
20 |
from langchain.callbacks.manager import CallbackManagerForLLMRun
|
21 |
from langchain.llms.base import LLM
|
@@ -34,9 +43,21 @@ provider_dict = {
|
|
34 |
'H2o': H2o,
|
35 |
'ChatgptLogin': ChatgptLogin,
|
36 |
'DeepAi': DeepAi,
|
37 |
-
'GetGpt': GetGpt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
-
|
40 |
class CustomLLM(LLM):
|
41 |
model_name: str="gpt-3.5-turbo"
|
42 |
provider_name: str="GetGpt"
|
@@ -52,13 +73,15 @@ class CustomLLM(LLM):
|
|
52 |
model_name = 'gpt-3.5-turbo',
|
53 |
provider = GetGpt
|
54 |
) -> str:
|
55 |
-
if stop is not None:
|
56 |
-
|
|
|
|
|
57 |
bot_msg = g4f.ChatCompletion.create(model=self.model_name,
|
58 |
provider=provider_dict[self.provider_name],
|
59 |
messages=[{"role": "user",
|
60 |
"content": prompt}],
|
61 |
-
stream=False)
|
62 |
return bot_msg
|
63 |
|
64 |
@property
|
|
|
14 |
H2o,
|
15 |
ChatgptLogin,
|
16 |
DeepAi,
|
17 |
+
GetGpt,
|
18 |
+
AItianhu,
|
19 |
+
EasyChat,
|
20 |
+
Acytoo,
|
21 |
+
DfeHub,
|
22 |
+
AiService,
|
23 |
+
BingHuan,
|
24 |
+
Wewordle,
|
25 |
+
ChatgptAi,
|
26 |
)
|
27 |
+
from g4f import Provider
|
28 |
import g4f
|
29 |
from langchain.callbacks.manager import CallbackManagerForLLMRun
|
30 |
from langchain.llms.base import LLM
|
|
|
43 |
'H2o': H2o,
|
44 |
'ChatgptLogin': ChatgptLogin,
|
45 |
'DeepAi': DeepAi,
|
46 |
+
'GetGpt': GetGpt,
|
47 |
+
'AItianhu': AItianhu,
|
48 |
+
'EasyChat': EasyChat,
|
49 |
+
'Acytoo': Acytoo,
|
50 |
+
'DfeHub': DfeHub,
|
51 |
+
'AiService': AiService,
|
52 |
+
'BingHuan': BingHuan,
|
53 |
+
'Wewordle': Wewordle,
|
54 |
+
'ChatgptAi': ChatgptAi,
|
55 |
+
}
|
56 |
+
provider_auth_settings = {
|
57 |
+
'Bard':{
|
58 |
+
'cookie':""
|
59 |
+
}
|
60 |
}
|
|
|
61 |
class CustomLLM(LLM):
|
62 |
model_name: str="gpt-3.5-turbo"
|
63 |
provider_name: str="GetGpt"
|
|
|
73 |
model_name = 'gpt-3.5-turbo',
|
74 |
provider = GetGpt
|
75 |
) -> str:
|
76 |
+
# if stop is not None:
|
77 |
+
# raise ValueError("stop kwargs are not permitted.")
|
78 |
+
provider_llm = getattr(Provider, self.provider_name)
|
79 |
+
provider_llm.working = True
|
80 |
bot_msg = g4f.ChatCompletion.create(model=self.model_name,
|
81 |
provider=provider_dict[self.provider_name],
|
82 |
messages=[{"role": "user",
|
83 |
"content": prompt}],
|
84 |
+
stream=False,auth=provider_auth_settings['provider'] if provider_llm.needs_auth else None)
|
85 |
return bot_msg
|
86 |
|
87 |
@property
|