Spaces:
Runtime error
Runtime error
Commit
·
53482f6
1
Parent(s):
49000f7
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ def set_openai_api_key(api_key: str):
|
|
15 |
If no api_key, then None is returned.
|
16 |
"""
|
17 |
if api_key:
|
18 |
-
os.environ["OPENAI_API_KEY"] =
|
19 |
chain = get_chain(vectorstore)
|
20 |
os.environ["OPENAI_API_KEY"] = ""
|
21 |
return chain
|
@@ -37,7 +37,7 @@ class ChatWrapper:
|
|
37 |
return history, history
|
38 |
# Set OpenAI key
|
39 |
import openai
|
40 |
-
openai.api_key =
|
41 |
# Run chain and append input.
|
42 |
output = chain({"question": inp, "chat_history": history})["answer"]
|
43 |
history.append((inp, output))
|
|
|
15 |
If no api_key, then None is returned.
|
16 |
"""
|
17 |
if api_key:
|
18 |
+
os.environ["OPENAI_API_KEY"] = api_key
|
19 |
chain = get_chain(vectorstore)
|
20 |
os.environ["OPENAI_API_KEY"] = ""
|
21 |
return chain
|
|
|
37 |
return history, history
|
38 |
# Set OpenAI key
|
39 |
import openai
|
40 |
+
openai.api_key = api_key
|
41 |
# Run chain and append input.
|
42 |
output = chain({"question": inp, "chat_history": history})["answer"]
|
43 |
history.append((inp, output))
|