-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
Access uploaded files in pipelines #164
Comments
Looking forward to it. |
Hey, |
I have the same problem. If we don't have access to user-uploaded files, it limits a lot of functionality 😶It' s hard to get other parameters passed by the front end, such as whether a new session has been created (which bothers me, even if a new session is created, there is no way to restart a new context), likes or dislike, etc. |
you can access uploaded files by adding an inlet function, if you upload a file, you should see it in the body:
|
@InquestGeronimo Sorry for pinging you, but did the API change? Some weeks ago I tried to make a example pipeline, and it errored out as soon as I attached an image (#66). Is it now "supported"? That's the main thing that's holding me back from integrating pipelines instead of OpenAI so far. I don't want to loose image capabilities. EDIT: Looks like something HAS changed! The pipeline doesn't error out anymore. Yay! Guess I'll be using Pipelines now! @tjbck Care to close this issue? I'm not OP but I guess this is solved. |
Here is a hacky way to access uploaded files. async def inlet(self, body: dict, user: dict) -> dict:
print(f"Received body: {body}")
files = body.get("files", [])
for file in files:
content_url = file["url"] + "/content"
print(f"file available at {content_url}")
# read the file content as binary and do something ...
return body |
Hi @InquestGeronimo , you solution works for me. Thank ! I still have an issue, it seems the data is not given has it is, do you know why ? Is there a way to get the original file content ? Here is the original data:
And here is what I got from the pipeline:
Regards |
i have "solved" the issue with this approach. This works when files are uploaded inside the chat
|
@sir3mat I tried the above method and printed just the body dictionary to see what is being passed. This dictionary seems to be only containing all the chat info like RAG prompt and context for the user query. It is not passing the complete document, which we want to do, so as to be able to perform our own custom retrieval through our pipeline To reproduce:
|
The body data which is given to the pipe(), does not contain details like filename, collection_name, so you have to get the details from the inlet function and store it in a variable like this
using these additional details you can lookup the file in the uploads dir and get the content, there is also an alternative way where you can send a request to a webui endpoint using an API key from your account in webui settings. Hope this helps. |
Hi there,
Being able to access uploaded files would be a great addition to pipelines. It would greatly expand the potential of pipelines, by not being limited with text input.
It would be also great to enable pipelines to return files in the chat as well.
Is there any plan to move this feature forward in the near future? Would be happy to test
Related issues: #66 #19 #81
The text was updated successfully, but these errors were encountered: