-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(upload): async improved #2544
Conversation
Someone is attempting to deploy a commit to the Quivr-app Team on Vercel. A member of the Team first needs to authorize it. |
Thanks a lot ! I'll review it and let you know if there is anything |
Thanks a lot! It works great except for when you upload URLs ;) I'll fix that |
Signed-off-by: aminediro <aminediro@github.com>
The list_files_array in the QuivrRAG class is updated to include file URLs in addition to file names. This change allows for better handling and display of files in the application.
Quality Gate failedFailed conditions |
|
||
def __init__(self, **data): | ||
super().__init__(**data) | ||
data["file_sha1"] = compute_sha1_from_content(data["bytes_content"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving it <3
🤖 I have created a release *beep* *boop* --- ## 0.0.259 (2024-06-04) ## What's Changed * feat(upload): async improved by @AmineDiro in #2544 ## New Contributors * @AmineDiro made their first contribution in #2544 **Full Changelog**: v0.0.258...v0.0.259 --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Description
Hey,
Here's a breakdown of what I've done:
langchain
loader classes, we couldn't use memory buffers for the loaders. Now, with the changes made, we only open a single temporary file for eachprocess_file_and_notify
, cutting down on excessive file opening, read syscalls, and memory buffer usage. This could cause stability issues when ingesting and processing large volumes of documents. Unfortunately, there is still reopening of temporary files in some code paths but this can be improved further in later work.UploadFile
class from File: TheUploadFile
( a FastAPI abstraction over a SpooledTemporaryFile for multipart upload) was redundant in ourFile
setup since we already downloaded the file from remote storage and read it into memory + wrote the file into a temp file. By removing this abstraction, we streamline our code and eliminate unnecessary complexity.async
function Adjustments: I've removed the async labeling from functions where it wasn't truly asynchronous. For instance, callingfilter_file
for processing files isn't genuinely async, ass async file reading isn't actually asynchronous—it uses a threadpool for reading the file . Given that we're already leveragingcelery
for parallelism (one worker per core), we need to ensure that reading and processing occur in the same thread, or at least minimize thread spawning. Additionally, since the rest of the code isn't inherently asynchronous, our bottleneck lies in CPU operations rather than asynchronous processing.These changes aim to improve performance and streamline our codebase.
Let me know if you have any questions or suggestions for further improvements!
Checklist before requesting a review