Fix qa_chain typo
Browse files- app.py +5 -3
- requirements.txt +5 -5
app.py
CHANGED
|
@@ -290,7 +290,7 @@ def set_openai_api_key(api_key, use_gpt4):
|
|
| 290 |
print("Trying to use qa_chain OpenAIChat with gpt-4")
|
| 291 |
else:
|
| 292 |
print("Trying to use qa_chain OpenAI with text-davinci-003")
|
| 293 |
-
qa_chain = OpenAI(temperature=0,
|
| 294 |
|
| 295 |
print(str(datetime.datetime.now()) + ": After load_chain, OPENAI_API_KEY length: " + str(
|
| 296 |
len(os.environ["OPENAI_API_KEY"])))
|
|
@@ -316,7 +316,8 @@ def run_chain(chain, inp, capture_hidden_text):
|
|
| 316 |
except RateLimitError as rle:
|
| 317 |
error_msg = "\n\nRateLimitError: " + str(rle)
|
| 318 |
except ValueError as ve:
|
| 319 |
-
|
|
|
|
| 320 |
except InvalidRequestError as ire:
|
| 321 |
error_msg = "\n\nInvalidRequestError: " + str(ire)
|
| 322 |
except Exception as e:
|
|
@@ -354,7 +355,8 @@ def run_chain(chain, inp, capture_hidden_text):
|
|
| 354 |
except RateLimitError as rle:
|
| 355 |
output = "\n\nRateLimitError: " + str(rle)
|
| 356 |
except ValueError as ve:
|
| 357 |
-
|
|
|
|
| 358 |
except InvalidRequestError as ire:
|
| 359 |
output = "\n\nInvalidRequestError: " + str(ire)
|
| 360 |
except Exception as e:
|
|
|
|
| 290 |
print("Trying to use qa_chain OpenAIChat with gpt-4")
|
| 291 |
else:
|
| 292 |
print("Trying to use qa_chain OpenAI with text-davinci-003")
|
| 293 |
+
qa_chain = load_qa_chain(OpenAI(temperature=0, model_name="text-davinci-003"), chain_type="stuff")
|
| 294 |
|
| 295 |
print(str(datetime.datetime.now()) + ": After load_chain, OPENAI_API_KEY length: " + str(
|
| 296 |
len(os.environ["OPENAI_API_KEY"])))
|
|
|
|
| 316 |
except RateLimitError as rle:
|
| 317 |
error_msg = "\n\nRateLimitError: " + str(rle)
|
| 318 |
except ValueError as ve:
|
| 319 |
+
pass
|
| 320 |
+
# error_msg = "\n\nValueError: " + str(ve)
|
| 321 |
except InvalidRequestError as ire:
|
| 322 |
error_msg = "\n\nInvalidRequestError: " + str(ire)
|
| 323 |
except Exception as e:
|
|
|
|
| 355 |
except RateLimitError as rle:
|
| 356 |
output = "\n\nRateLimitError: " + str(rle)
|
| 357 |
except ValueError as ve:
|
| 358 |
+
pass
|
| 359 |
+
# output = "\n\nValueError: " + str(ve)
|
| 360 |
except InvalidRequestError as ire:
|
| 361 |
output = "\n\nInvalidRequestError: " + str(ire)
|
| 362 |
except Exception as e:
|
requirements.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
openai==0.27.
|
| 2 |
-
gradio==3.
|
| 3 |
google-search-results==2.4.2
|
| 4 |
-
google-api-python-client==2.
|
| 5 |
wolframalpha
|
| 6 |
-
langchain==0.0.
|
| 7 |
requests==2.28.2
|
| 8 |
git+https://github.com/openai/whisper.git
|
| 9 |
-
boto3==1.26.
|
| 10 |
faiss-cpu
|
|
|
|
| 1 |
+
openai==0.27.4
|
| 2 |
+
gradio==3.24.1
|
| 3 |
google-search-results==2.4.2
|
| 4 |
+
google-api-python-client==2.83.0
|
| 5 |
wolframalpha
|
| 6 |
+
langchain==0.0.131
|
| 7 |
requests==2.28.2
|
| 8 |
git+https://github.com/openai/whisper.git
|
| 9 |
+
boto3==1.26.106
|
| 10 |
faiss-cpu
|