How to upload a file to an agent thread and have the agent use the file?

André 40 Reputation points
2025-02-28T13:44:33.7033333+00:00

I have tried to upload a file to a thread both through code and through the playground. While I can see that my Vector Storage was indeed created and the file is indeed uploaded there, the agent doesn't seem to be reading the files at all.

My question, then, is twofold: First, I need to know how to upload a file to a thread and make the agent use it through playground. Again, I can see that the file is uploaded and the vector storage is associated with the thread.

Screenshot from 2025-02-28 10-42-14

Second, how can I do that through code? I'm using the AIProjectClient and I can see that the file I update my thread with creates a new Vector Storage that is associated with the target thread. Do I need to enable a tool call or just sending a question to a thread with a Vector Storage associated with it should be enough?

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,271 questions
{count} votes

Accepted answer
  1. Vikram Singh 2,550 Reputation points Microsoft Employee
    2025-03-03T09:26:10.6133333+00:00

    Hello @André

    Thank you for posting your question on Microsoft Q&A. I apologize for any inconvenience this may have caused. let's go with your question one by one.

    My question, then, is twofold: First, I need to know how to upload a file to a thread and make the agent use it through playground. Again, I can see that the file is uploaded and the vector storage is associated with the thread.

    As this feature is currently in preview, the recommended approach is to upload your files at the thread level (Thread files). For vector storage (Knowledge), you can upload a dummy file with content such as "This is the dummy file." This method should help you achieve the desired resolution, as it has worked for me in similar scenarios.

    User's image

    Second, how can I do that through code? I'm using the AIProjectClient and I can see that the file I update my thread with creates a new Vector Storage that is associated with the target thread. Do I need to enable a tool call or just sending a question to a thread with a Vector Storage associated with it should be enough?

    When you upload a file using the AIProjectClient, it creates a new Vector Storage associated with the target thread. Depending on your implementation, you might need to enable a tool call to ensure the agent can access the files. Also, simply sending a question to a thread with an associated Vector Storage might not be sufficient. Ensure that the agent's logic includes steps to read from the Vector Storage when processing the thread.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    Thanks!

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.