Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,11 @@ YOUTUBE_URL_3 = "https://www.youtube.com/watch?v=vw-KWfKwvTQ"
|
|
41 |
MODEL_NAME = "gpt-4"
|
42 |
|
43 |
def invoke(openai_api_key, use_rag, prompt):
|
|
|
|
|
|
|
|
|
|
|
44 |
try:
|
45 |
llm = ChatOpenAI(model_name = MODEL_NAME,
|
46 |
openai_api_key = openai_api_key,
|
|
|
41 |
MODEL_NAME = "gpt-4"
|
42 |
|
43 |
def invoke(openai_api_key, use_rag, prompt):
|
44 |
+
if (openai_api_key == ""):
|
45 |
+
print(use_rag)
|
46 |
+
raise gr.Error("'OpenAI API Key' is required.")
|
47 |
+
if (prompt == ""):
|
48 |
+
raise gr.Error("'Prompt' is required.")
|
49 |
try:
|
50 |
llm = ChatOpenAI(model_name = MODEL_NAME,
|
51 |
openai_api_key = openai_api_key,
|