Internal server error when executing against /batch
nbbaier opened this issue · comments
When I run the rollowing request:
curl -X POST http://127.0.0.1:8000/batch \
-H "Content-Type: application/json" \
-d '{"path": "/Users/nicholasbaier/Downloads/", "instruction": "please suggest new names for these files"
}'
I get the error trace below:
INFO: 127.0.0.1:60292 - "POST /batch HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 52, in _try_loading_included_file_formats
from llama_index.readers.file import (
ImportError: cannot import name 'DocxReader' from 'llama_index.readers.file' (/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/llama_index/readers/file/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/fastapi/applications.py", line 1106, in __call__
await super().__call__(scope, receive, send)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in __call__
await self.app(scope, receive, send)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
raise e
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/fastapi/routing.py", line 274, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/llama-fs/server.py", line 74, in batch
summaries = await get_dir_summaries(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/llama-fs/src/loader.py", line 20, in get_dir_summaries
doc_dicts = load_documents(path)
^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/llama-fs/src/loader.py", line 64, in load_documents
for docs in reader.iter_data():
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 750, in iter_data
documents = SimpleDirectoryReader.load_file(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 511, in load_file
default_file_reader_cls = SimpleDirectoryReader.supported_suffix_fn()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 66, in _try_loading_included_file_formats
raise ImportError("`llama-index-readers-file` package not found")
ImportError: `llama-index-readers-file` package not found
I have the specific package installed:
pip show llama-index-readers-file
Name: llama-index-readers-file
Version: 0.1.23
Summary: llama-index readers file integration
Home-page:
Author: Your Name
Author-email: you@example.com
License: MIT
Location: /Users/nicholasbaier/.pyenv/versions/3.11.5/lib/python3.11/site-packages
Requires: beautifulsoup4, llama-index-core, pypdf, striprtf
Required-by:
Same problem here, running
curl -X 'POST' \
'http://127.0.0.1:8000/batch' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"path": "C:\\Users\\Enrico\\Downloads\\",
"incognito": false
}'
C:\Users\Enrico>pip show llama-index-readers-file
Name: llama-index-readers-file
Version: 0.1.23
Summary: llama-index readers file integration
Home-page:
Author: Your Name
Author-email: you@example.com
License: MIT
Location: c:\users\enrico\appdata\local\programs\python\python310\lib\site-packages
Requires: beautifulsoup4, llama-index-core, pypdf, striprtf
Required-by: llama-index
Same problem.
Internal Server Error
Managed to make it run, by creating an api key in groq and using my key in server.py and main.py. However, when running it against the sample directory i get a bunch of errors and 5/7 requests for the files return status code 429.
Exception in ASGI application
Traceback (most recent call last):
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
yield
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 373, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
raise exc from None
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
response = await connection.handle_async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
raise exc
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 122, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 30, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: All connection attempts failed
The above exception was the direct cause of the following exception
Traceback (most recent call last):
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.
.
.
.
with map_httpcore_exceptions():
File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/Users/vic/Desktop/projects/llama-fs/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed
/Users/vic/Desktop/projects/llama-fs/sample_data/text_files/dsflsdflj.txt
A personal description of someone who is easy-going, hardworking, and caring, with a strong emphasis on enjoying life and being dedicated to their job and relationships.
/Users/vic/Desktop/projects/llama-fs/sample_data/random_file.txt
A text file containing a bank account number.
Error status 429
Error status 429
Error status 429
Error status 429
Error status 429`
Same problem. Internal Server Error
same problem (( anybody knows how fix it ?