Spaces:
Sleeping
Sleeping
Commit
·
f42ab4f
1
Parent(s):
89504d1
openai key
Browse files
app.py
CHANGED
@@ -30,6 +30,7 @@ Your answers should be:
|
|
30 |
Helpful Answer:"""
|
31 |
|
32 |
QA_CHAIN_PROMPT = PromptTemplate(input_variables=["context", "question"], template=template,)
|
|
|
33 |
OPENAI_API_KEY = ''
|
34 |
|
35 |
def get_opeanai_key(openai_key):
|
@@ -40,6 +41,9 @@ def get_opeanai_key(openai_key):
|
|
40 |
|
41 |
|
42 |
def slow_echo(usr_message, chat_history):
|
|
|
|
|
|
|
43 |
|
44 |
chat_model = ChatOpenAI(temperature=0, model_name='gpt-3.5-turbo', openai_api_key=OPENAI_API_KEY)
|
45 |
# customized memory
|
|
|
30 |
Helpful Answer:"""
|
31 |
|
32 |
QA_CHAIN_PROMPT = PromptTemplate(input_variables=["context", "question"], template=template,)
|
33 |
+
|
34 |
OPENAI_API_KEY = ''
|
35 |
|
36 |
def get_opeanai_key(openai_key):
|
|
|
41 |
|
42 |
|
43 |
def slow_echo(usr_message, chat_history):
|
44 |
+
|
45 |
+
if OPENAI_API_KEY=='':
|
46 |
+
return 'Invalid or empty OPENAI_API_KEY', chat_history
|
47 |
|
48 |
chat_model = ChatOpenAI(temperature=0, model_name='gpt-3.5-turbo', openai_api_key=OPENAI_API_KEY)
|
49 |
# customized memory
|