I was trying different ways to send requests to /upsert-file api endpoint, but I keep getting 500 errors like Unsupported file type or Unsupported file type: application/octet-stream. I am not sure if there is something wrong with my way of initializing the request. I tried to search for the reasons but currently there are not much information about this project on the Internet.
The following C# snippet results in a "Unsupported file type":
var fileName = Path.GetFileName(filePath);
var content = new MultipartFormDataContent();
var stream = new FileStream(filePath, FileMode.Open);
content.Add(new StreamContent(stream), "file", fileName);
var res = await client.PostAsync(requestUrl, content);
Error:
INFO: 127.0.0.1:54034 - "POST /upsert-file HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 271, in __call__
await super().__call__(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/applications.py", line 118, in __call__
await self.middleware_stack(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/routing.py", line 706, in __call__
await route.handle(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "chatgpt-retrieval-plugin/server/main.py", line 63, in upsert_file
document = await get_document_from_file(file, metadata_obj)
File "chatgpt-retrieval-plugin/services/file.py", line 17, in get_document_from_file
extracted_text = await extract_text_from_form_file(file)
File "chatgpt-retrieval-plugin/services/file.py", line 112, in extract_text_from_form_file
raise e
File "chatgpt-retrieval-plugin/services/file.py", line 108, in extract_text_from_form_file
extracted_text = extract_text_from_filepath(temp_file_path, mimetype)
File "chatgpt-retrieval-plugin/services/file.py", line 36, in extract_text_from_filepath
raise Exception("Unsupported file type")
Exception: Unsupported file type
And the following command results in a "Unsupported file type: application/octet-stream":
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 271, in __call__
await super().__call__(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/applications.py", line 118, in __call__
await self.middleware_stack(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/routing.py", line 706, in __call__
await route.handle(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "chatgpt-retrieval-plugin/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "chatgpt-retrieval-plugin/server/main.py", line 63, in upsert_file
document = await get_document_from_file(file, metadata_obj)
File "chatgpt-retrieval-plugin/services/file.py", line 17, in get_document_from_file
extracted_text = await extract_text_from_form_file(file)
File "chatgpt-retrieval-plugin/services/file.py", line 112, in extract_text_from_form_file
raise e
File "chatgpt-retrieval-plugin/services/file.py", line 108, in extract_text_from_form_file
extracted_text = extract_text_from_filepath(temp_file_path, mimetype)
File "chatgpt-retrieval-plugin/services/file.py", line 43, in extract_text_from_filepath
raise e
File "chatgpt-retrieval-plugin/services/file.py", line 40, in extract_text_from_filepath
extracted_text = extract_text_from_file(file, mimetype)
File "chatgpt-retrieval-plugin/services/file.py", line 85, in extract_text_from_file
raise ValueError("Unsupported file type: {}".format(mimetype))
ValueError: Unsupported file type: application/octet-stream
Let me know if more related details are needed to provide.
Hi,
I was trying different ways to send requests to /upsert-file api endpoint, but I keep getting 500 errors like
Unsupported file type
orUnsupported file type: application/octet-stream
. I am not sure if there is something wrong with my way of initializing the request. I tried to search for the reasons but currently there are not much information about this project on the Internet.The following C# snippet results in a "Unsupported file type":
Error:
And the following command results in a "Unsupported file type: application/octet-stream":
Error:
Let me know if more related details are needed to provide.