Commit
·
9f1bad6
1
Parent(s):
bf907b1
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
from typing import Optional, Tuple
|
3 |
|
4 |
import gradio as gr
|
@@ -11,6 +12,10 @@ from ingest_data import get_vectorstore
|
|
11 |
|
12 |
|
13 |
|
|
|
|
|
|
|
|
|
14 |
class ChatWrapper:
|
15 |
|
16 |
def __init__(self):
|
@@ -32,8 +37,9 @@ class ChatWrapper:
|
|
32 |
history.append((inp, "Please paste your OpenAI key to use"))
|
33 |
return history, history
|
34 |
# Set OpenAI key
|
35 |
-
import
|
36 |
-
|
|
|
37 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
38 |
# Run chain and append input.
|
39 |
output = chain({"question": inp, "chat_history": history})["answer"]
|
|
|
1 |
import os
|
2 |
+
|
3 |
from typing import Optional, Tuple
|
4 |
|
5 |
import gradio as gr
|
|
|
12 |
|
13 |
|
14 |
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
class ChatWrapper:
|
20 |
|
21 |
def __init__(self):
|
|
|
37 |
history.append((inp, "Please paste your OpenAI key to use"))
|
38 |
return history, history
|
39 |
# Set OpenAI key
|
40 |
+
import promptlayer
|
41 |
+
promptlayer.api_key = os.environ.get("PROMPTLAYER_API_KEY")
|
42 |
+
openai = promptlayer.openai
|
43 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
44 |
# Run chain and append input.
|
45 |
output = chain({"question": inp, "chat_history": history})["answer"]
|