mukulpatnaik/researchgpt

reply:Error: Request to OpenAI failed. Please try again. is it a network problem?

Closed this issue · 3 comments

屏幕截图 2023-04-05 131225

Done calculating embeddings
Done processing pdf
127.0.0.1 - - [05/Apr/2023 13:23:44] "POST /process_pdf HTTP/1.1" 200 -
127.0.0.1 - - [05/Apr/2023 13:24:12] "POST /reply HTTP/1.1" 500 -
Traceback (most recent call last):
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask\app.py", line 2551, in call
return self.wsgi_app(environ, start_response)
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask\app.py", line 2531, in wsgi_app
response = self.handle_exception(e)
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask\app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\flask\app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "F:\ChatGPT\researchgpt-main\main-local.py", line 181, in reply
prompt = chatbot.create_prompt(df, query)
File "F:\ChatGPT\researchgpt-main\main-local.py", line 112, in create_prompt
result = self.search_embeddings(df, user_input, n=3)
File "F:\ChatGPT\researchgpt-main\main-local.py", line 107, in search_embeddings
sources.append({'Page '+str(results.iloc[i]['page']): results.iloc[i]['text'][:150]+'...'})
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\pandas\core\indexing.py", line 1103, in getitem
return self._getitem_axis(maybe_callable, axis=axis)
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\pandas\core\indexing.py", line 1656, in _getitem_axis
self._validate_integer(key, axis)
File "F:\ChatGPT\researchgpt-main\myenv\lib\site-packages\pandas\core\indexing.py", line 1589, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds

Supplement: I am deploying in a virtual environment:python -m venv myenv;myenv\Scripts\activate;python main-local.py

same problem

看日志是因为超过了max token了 目前无解

Hi all @marxo126 @1353604736 @Maddaxman sorry for the late response

I have made a major refactor of the code, fixing many issues and moving from flask to fastapi, if you are still interested please consider running git fetch to update your code to the latest version and try following the steps in the README to run the app.

Also consider using the web app www.dara.chat, it has some features and optimizations that are not open source yet. Thanks for trying it!