Spaces:
Runtime error
Runtime error
xuyingliKepler
commited on
Commit
•
001e5de
1
Parent(s):
e19515b
Update app.py
Browse files
app.py
CHANGED
@@ -47,13 +47,13 @@ class ExtendedUserProxyAgent(upa.UserProxyAgent):
|
|
47 |
config_list = [
|
48 |
{
|
49 |
"model": "gpt-4",
|
50 |
-
"api_key": "
|
51 |
}
|
52 |
]
|
53 |
|
54 |
gpt4_api_key = config_list[0]["api_key"]
|
55 |
-
os.environ['OPENAI_API_KEY'] =
|
56 |
-
openai.api_key =
|
57 |
|
58 |
def build_vector_store(pdf_path, chunk_size=1000):
|
59 |
loaders = [PyPDFLoader(pdf_path)]
|
@@ -94,13 +94,13 @@ def setup_agents(config_list, answer_function):
|
|
94 |
"functions": [
|
95 |
{
|
96 |
"name": "answer_uniswap_question",
|
97 |
-
"description": "Answer
|
98 |
"parameters": {
|
99 |
"type": "object",
|
100 |
"properties": {
|
101 |
"question": {
|
102 |
"type": "string",
|
103 |
-
"description": "The question to ask in relation to
|
104 |
}
|
105 |
},
|
106 |
"required": ["question"],
|
@@ -189,10 +189,4 @@ def app():
|
|
189 |
|
190 |
if __name__ == "__main__":
|
191 |
st.set_page_config(layout="wide")
|
192 |
-
app()
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
47 |
config_list = [
|
48 |
{
|
49 |
"model": "gpt-4",
|
50 |
+
"api_key": st.secrets["OPENAI_API_KEY"]
|
51 |
}
|
52 |
]
|
53 |
|
54 |
gpt4_api_key = config_list[0]["api_key"]
|
55 |
+
os.environ['OPENAI_API_KEY'] = st.secrets["OPENAI_API_KEY"]
|
56 |
+
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
57 |
|
58 |
def build_vector_store(pdf_path, chunk_size=1000):
|
59 |
loaders = [PyPDFLoader(pdf_path)]
|
|
|
94 |
"functions": [
|
95 |
{
|
96 |
"name": "answer_uniswap_question",
|
97 |
+
"description": "Answer all paper related questions",
|
98 |
"parameters": {
|
99 |
"type": "object",
|
100 |
"properties": {
|
101 |
"question": {
|
102 |
"type": "string",
|
103 |
+
"description": "The question to ask in relation to the document",
|
104 |
}
|
105 |
},
|
106 |
"required": ["question"],
|
|
|
189 |
|
190 |
if __name__ == "__main__":
|
191 |
st.set_page_config(layout="wide")
|
192 |
+
app()
|
|
|
|
|
|
|
|
|
|
|
|