How to get the assistant to use the vector store using Azure OpenAI: OpenAI Assistants client library for .NET

Khimananda Acharya 0 Reputation points
2025-01-07T05:21:51.9366667+00:00

Hi,

Seeking help getting the assistant to use the vector store using the library below:

Azure OpenAI: OpenAI Assistants client library for .NET - version 1.0.0-beta.4

For some context:

I've created a Vector store as well as an Assistant within Azure AI Foundry -> Azure OpenAI Service

Using the SDK (link above) and the assistantID I'm trying to run a thread but it's unable to do the file search.

Main Question: How do I hook up the vector store?

Any help is appreciated!

Thanks!

.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,034 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,185 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,503 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel FANG 1,040 Reputation points MVP
    2025-01-10T11:56:55.5366667+00:00

    hey @Khimananda Acharya

    You can pass the vector_store_ids into the assistants.create call. more details this link: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/file-search?tabs=python

    assistant = client.beta.assistants.create(
      instructions="You are a helpful product support assistant and you answer questions based on the files provided to you.",
      model="gpt-4-turbo",
      tools=[{"type": "file_search"}],
      tool_resources={
        "file_search": {
          "vector_store_ids": ["vs_1"]
        }
      }
    )
    
    thread = client.beta.threads.create(
      messages=[ { "role": "user", "content": "How do I cancel my subscription?"} ],
      tool_resources={
        "file_search": {
          "vector_store_ids": ["vs_2"]
        }
      }
    )
    
    
    0 comments No comments

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.