Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Request to OpenAI failed. Please try again. #6

Open
wccccp opened this issue Mar 28, 2023 · 4 comments
Open

Error: Request to OpenAI failed. Please try again. #6

wccccp opened this issue Mar 28, 2023 · 4 comments

Comments

@wccccp
Copy link

wccccp commented Mar 28, 2023

Error: Request to OpenAI failed. Please try again.

image

@Ulov888
Copy link
Owner

Ulov888 commented Mar 28, 2023

程序报错信息贴一下

@wccccp
Copy link
Author

wccccp commented Mar 28, 2023

程序报错信息贴一下

  • Serving Flask app "run" (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: on
  • Restarting with watchdog (windowsapi)
  • Debugger is active!
  • Debugger PIN: 101-682-997
  • Running on all addresses.
    WARNING: This is a development server. Do not use it in a production deployment.
  • Running on http://192.168.37.23:8080/ (Press CTRL+C to quit)
    192.168.37.23 - - [28/Mar/2023 16:25:31] "GET / HTTP/1.1" 200 -
    Processing pdf
  • Detected change in 'C:\Users\46213\anaconda3\Lib\site-packages\pandas\core\indexes\base.py', reloading
    INFO:werkzeug: * Detected change in 'C:\Users\46213\anaconda3\Lib\site-packages\pandas\core\indexes\base.py', reloading
  • Detected change in 'C:\Users\46213\anaconda3\Lib\site-packages\pandas\core\frame.py', reloading
    INFO:werkzeug: * Detected change in 'C:\Users\46213\anaconda3\Lib\site-packages\pandas\core\frame.py', reloading
    192.168.37.23 - - [28/Mar/2023 16:25:36] "POST /process_pdf HTTP/1.1" 500 -
    INFO:werkzeug:192.168.37.23 - - [28/Mar/2023 16:25:36] "POST /process_pdf HTTP/1.1" 500 -
    Traceback (most recent call last):
    File "C:\Users\46213\anaconda3\Lib\site-packages\pandas\core\indexes\base.py", line 3080, in get_loc
    return self._engine.get_loc(casted_key)
    File "pandas_libs\index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc

File "pandas_libs\index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc

File "pandas_libs\hashtable_class_helper.pxi", line 4554, in pandas._libs.hashtable.PyObjectHashTable.get_item

File "pandas_libs\hashtable_class_helper.pxi", line 4562, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'text'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 2464, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\46213\anaconda3\Lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\46213\anaconda3\Lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\46213\anaconda3\Lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\46213\anaconda3\Lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\46213\Desktop\t5\chatpdflike-main\run.py", line 24, in process_pdf
df = chatbot.paper_df(paper_text)
File "C:\Users\46213\Desktop\t5\chatpdflike-main\generate_embedding.py", line 76, in paper_df
df['length'] = df['text'].apply(lambda x: len(x))
File "C:\Users\46213\anaconda3\Lib\site-packages\pandas\core\frame.py", line 3024, in getitem
indexer = self.columns.get_loc(key)
File "C:\Users\46213\anaconda3\Lib\site-packages\pandas\core\indexes\base.py", line 3082, in get_loc
raise KeyError(key) from err
KeyError: 'text'

  • Restarting with watchdog (windowsapi)
  • Debugger is active!
  • Debugger PIN: 101-682-997
  • Running on all addresses.
    WARNING: This is a development server. Do not use it in a production deployment.
  • Running on http://192.168.37.23:8080/ (Press CTRL+C to quit)
    192.168.37.23 - - [28/Mar/2023 16:26:13] "POST /reply HTTP/1.1" 500 -
    Traceback (most recent call last):
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 2464, in call
    return self.wsgi_app(environ, start_response)
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask_compat.py", line 39, in reraise
    raise value
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask_compat.py", line 39, in reraise
    raise value
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
    File "C:\Users\46213\anaconda3\Lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functionsrule.endpoint
    File "C:\Users\46213\Desktop\t5\chatpdflike-main\run.py", line 48, in reply
    prompt = chatbot.create_prompt(df, query)
    NameError: name 'df' is not defined

@wzqstudio
Copy link

same issue

@wzqstudio
Copy link

103.7.29.32 - - [29/Mar/2023 14:29:11] "POST /reply HTTP/1.1" 500 -
INFO:werkzeug:103.7.29.32 - - [29/Mar/2023 14:29:11] "POST /reply HTTP/1.1" 500 -
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.11/site-packages/flask/app.py", line 2548, in call
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/chatpdflike/run.py", line 48, in reply
prompt = chatbot.create_prompt(df, query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/chatpdflike/generate_embedding.py", line 105, in create_prompt
result = self.search_embeddings(df, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/chatpdflike/generate_embedding.py", line 100, in search_embeddings
sources.append({'Page '+str(results.iloc[i]['page']): results.iloc[i]['text'][:150]+'...'})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/pandas/core/indexing.py", line 1073, in getitem
return self._getitem_axis(maybe_callable, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python3/lib/python3.11/site-packages/pandas/core/indexing.py", line 1625, in _getitem_axis
self._validate_integer(key, axis)
File "/usr/local/python3/lib/python3.11/site-packages/pandas/core/indexing.py", line 1557, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants