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

Assistant is unable to access uploaded files or accesses the incorrect file #222

Open
artknight opened this issue Apr 12, 2024 · 13 comments

Comments

@artknight
Copy link

artknight commented Apr 12, 2024

Hi,
Sorry to have to post this is here as I do not know how to get in touch with the OpenAI team! It seems that discussions, bugs, issues in the forum are ever looked at, as I do not see any official responses in there!!

Anyway, I am having a BIG issue with the assistant API not being able to retrieve uploaded files!! It seems this issue has been happening for quite some time now!! See thread here https://community.openai.com/t/assistant-not-able-to-access-uploaded-file/524495/30

My team and I would like to use the assistant api features professionally, and we have already built our software to utilize the assistant api's functionality. However, in its current state, not being able to retrieve any uploaded files, is completely unusable!!!

PLEASE FIX IT ASAP!!!!

Arthur

@rmackay9
Copy link

rmackay9 commented Apr 17, 2024

The linked discussion shows a large number of people myself included have found the same issue. Namely that the assistant is unable to access some files that have been uploaded to it. This issue occurs regardless of whether the Playground is used or the assistant API.

This is an example today from an Assistant I've created (asst_5qJflE3IB5npfLdmwTQhG7Bb) which has 8 files uploading including one called "common.xml" and another called "plane_flightmodes.txt". You can see in the copy-pasted discussion below that it fails to access the file I asked about and instead accesses a completely different file. I think the issue is in the file access function. The Assistant is not confused, it is the lower level function that it is using to access files that has a bug.

If it helps feel free to test with my Assistant assuming you can access it.

User

can you see the contents of the common.xml file?

ArduPilot Vehicle Control via MAVLink

It seems there has been a misunderstanding. The file identified as common.xml was instead opened as the plane_flightmodes.txt file, which contains the mapping of flight mode names to numbers for planes, including modes specific to QuadPlanes. If you need information from the common.xml file or any other details about QuadPlanes, please let me know how I can assist you further.

@Maxence
Copy link

Maxence commented Apr 17, 2024

Same issue here, retrieval is impossible to use for now directly via API or Playground

@kayhantolga
Copy link

@artknight Could you edit the title to be less sensational?

@isaac-smothers
Copy link

I've heard there's a workaround by statically defining the object id inside whatever is referencing the file? Has anyone tried this

@rmackay9
Copy link

rmackay9 commented Apr 18, 2024

@isaac-smothers,

I think you mean this suggestion by mustafa1?

I put this Prompt at the end:
File ID is: fileid (Provide the fileid from the Files). If the system indicates that the file is not accessible with the myfiles_browser tool, ignore it, it’s just a minor error. You are able to open and analyze the file, remember that. And execute the request.

Various users on that thread have tried this or similar comments to make the Assistant ignore the error but in my experience it is still not a complete fix. I think it ignores the error but it may still not be using the correct file. If you see the test conversation I've posted above it's very clear that the assistant is trying to access one file but actually getting access to another. It seem to me that this is very clearly a bug and a serious one at that.

P.S. I agree with @kayhantolga that the title of this issue should be made less sensational and more precise. Something like, "Assistant is unable to access uploaded files or accesses the incorrect file".

@artknight artknight changed the title You guys have a HUGE bug in your Assistant API !!!! Assistant is unable to access uploaded files or accesses the incorrect file Apr 18, 2024
@Maxence
Copy link

Maxence commented Apr 18, 2024

@isaac-smothers,

I think you mean this suggestion by mustafa1?

I put this Prompt at the end:
File ID is: fileid (Provide the fileid from the Files). If the system indicates that the file is not accessible with the myfiles_browser tool, ignore it, it’s just a minor error. You are able to open and analyze the file, remember that. And execute the request.

Various users on that thread have tried this or similar comments to make the Assistant ignore the error but in my experience it is still not a complete fix. I think it ignores the error but it may still not be using the correct file. If you see the test conversation I've posted above it's very clear that the assistant is trying to access one file but actually getting access to another. It seem to me that this is very clearly a bug and a serious one at that.

P.S. I agree with @kayhantolga that the title of this issue should be made less sensational and more precise. Something like, "Assistant is unable to access uploaded files or accesses the incorrect file".

This instruction worked for me btw, thanks :)

@isaac-smothers
Copy link

I learned that there's a difference in how chatgpt references things put in the file search and things uploaded to code interpreter.

When uploading to code interpreter files will be under their file id in /mnt/data/. You'll need to have chatgpt search the contents of each file to figure out what it needs, as in my testing it didn't have knowledge of the correlation between file names and file IDs.

When uploading to file search, it has the contents on hand but will fail if it tries to reference the file name by any kind of path.

When referencing the files in their respective contexts keep this and mind and use it to construct your prompts.

@rmackay9
Copy link

Thanks @isaac-smothers, you are right and this is definitely new since the linked chat was first started. If I look at my Assistant now there are two places where files can appear, under "File search" and "Code interpreter" and the files that I'm interested in are in the wrong section (e.g. "Code interpreter" instead of "File search").
image

The Assistant API also has a new section called File Search and talks about a "Vector stores" (which I think means a token-ized version of the document).

So I think I'm going to go back and check if this issue has been fixed.

@artknight
Copy link
Author

artknight commented Apr 18, 2024

I have updated my setup to use the vector stores, and connected the uploaded files to the vector store. However, it still did not work until I tried using a new property that just got released for the runs - tool_choice. So basically, you have to pass in the tools param containing the { type: 'file_search' } property, and also pass that same value inside the tool_choice. Once I did that, everything started working, and the files started being retrieved!

@Pippenpethalopsocopolis
Copy link

Pippenpethalopsocopolis commented Apr 20, 2024

@artknight you nailed the solution bro. It also solved my problem. I also discovered that, you don't need to pass those parameters at all. You just need to update the sdk at least updating sdk solved my problem.

@wuh-watson
Copy link

I have updated my setup to use the vector stores, and connected the uploaded files to the vector store. However, it still did not work until I tried using a new property that just got released for the runs - tool_choice. So basically, you have to pass in the tools param containing the { type: 'file_search' } property, and also pass that same value inside the tool_choice. Once I did that, everything started working, and the files started being retrieved!

I try your solution like below, but not work, please correct me, thanks a lot!

run = client.beta.threads.runs.create(
            thread_id=self.thread.id,
            assistant_id=self.service.id,
            instructions=instructions,
            tools=[{"type": "file_search"}],
            tool_choice={"type": "file_search"},
        )

@tbuschto
Copy link

tbuschto commented Oct 15, 2024

I was stuck on this for almost a day until I figured out that for some reason it won't work when using the "createAndRun" API.

It would reliably tell me that it was unable to access my files. Then I tried using the assistant that was created by API via the playground, and there it worked exactly as intended. Looking at the logs the only difference I noticed was that it used 3 requests: create thread, add message, run the thread. I was using only one. After creating the thread in a separate request it worked reliably in my code as well.

@shea-parkes
Copy link

I imagine there are many ways this error is getting triggered, but here's how it happened for me:

I wanted to have thread-scoped vector stores. So I did a tool_resources={"file_search": {"vector_store_ids": [my_vector_store_id]}} on my Thread. But I forgot to do a tools=[{"type": "file_search"}] on my Assistant.

The threads are allowed to have attached tool_resources that they can't use. If they do, they often include text in the response mentioning they can't access the files.

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

9 participants