Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
8029644
1
Parent(s):
5879508
加入PaLM支持(未完成)
Browse files- modules/config.py +3 -0
- modules/models/PaLM.py +2 -1
- requirements.txt +1 -0
modules/config.py
CHANGED
@@ -77,6 +77,9 @@ my_api_key = os.environ.get("OPENAI_API_KEY", my_api_key)
|
|
77 |
xmchat_api_key = config.get("xmchat_api_key", "")
|
78 |
os.environ["XMCHAT_API_KEY"] = xmchat_api_key
|
79 |
|
|
|
|
|
|
|
80 |
render_latex = config.get("render_latex", True)
|
81 |
|
82 |
if render_latex:
|
|
|
77 |
xmchat_api_key = config.get("xmchat_api_key", "")
|
78 |
os.environ["XMCHAT_API_KEY"] = xmchat_api_key
|
79 |
|
80 |
+
google_palm_api_key = config.get("google_palm_api_key", "")
|
81 |
+
os.environ["GOOGLE_PALM_API_KEY"] = google_palm_api_key
|
82 |
+
|
83 |
render_latex = config.get("render_latex", True)
|
84 |
|
85 |
if render_latex:
|
modules/models/PaLM.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
from .base_model import BaseLLMModel, CallbackToIterator, ChuanhuCallbackHandler
|
2 |
from langchain.chat_models import ChatGooglePalm
|
|
|
3 |
|
4 |
class PaLM_Client(BaseLLMModel):
|
5 |
def __init__(self, model_name, user="") -> None:
|
6 |
super().__init__(model_name, user)
|
7 |
-
self.llm = ChatGooglePalm(google_api_key="")
|
8 |
|
9 |
def get_answer_at_once(self):
|
10 |
self.llm.generate(self.history)
|
|
|
1 |
from .base_model import BaseLLMModel, CallbackToIterator, ChuanhuCallbackHandler
|
2 |
from langchain.chat_models import ChatGooglePalm
|
3 |
+
import os
|
4 |
|
5 |
class PaLM_Client(BaseLLMModel):
|
6 |
def __init__(self, model_name, user="") -> None:
|
7 |
super().__init__(model_name, user)
|
8 |
+
self.llm = ChatGooglePalm(google_api_key=os.environ["GOOGLE_PALM_API_KEY"])
|
9 |
|
10 |
def get_answer_at_once(self):
|
11 |
self.llm.generate(self.history)
|
requirements.txt
CHANGED
@@ -24,3 +24,4 @@ wikipedia
|
|
24 |
google.generativeai
|
25 |
openai
|
26 |
unstructured
|
|
|
|
24 |
google.generativeai
|
25 |
openai
|
26 |
unstructured
|
27 |
+
google-api-python-client
|