According to the documentation:
[How to use Azure OpenAI Assistants file search - Azure OpenAI | Microsoft Learn]
Now you can attach vector stores to your Assistant or Thread using the tool_resources parameter.
However, the next error arises when trying to:
TypeError: Threads.create() got an unexpected keyword argument ‘tool_resources’
Can you show us the code? How you are passing Vector stores?
from openai import AzureOpenAI
client = AzureOpenAI(
api_key='',
api_version="2024-05-01-preview",
azure_endpoint = ''
)
empty_thread = client.beta.threads.create(
tool_resources = {}
)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[17], line 1
----> 1 empty_thread = client.beta.threads.create(
2 tool_resources = {}
3 )
TypeError: Threads.create() got an unexpected keyword argument 'tool_resources'
As per the Azure Documentation, you can only attach the files to Assistant, like this:
from openai import AzureOpenAI
client = AzureOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
api_version="2024-05-01-preview",
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
)
assistant = client.beta.assistants.create(
name="Financial Analyst Assistant",
instructions="You are an expert financial analyst. Use you knowledge base to answer questions about audited financial statements.",
model="gpt-4-turbo",
tools=[{"type": "file_search"}],
)
# Create a thread
thread = client.beta.threads.create()
print(thread)
Couldn’t fine any methods for passing vectors to Threads.
To update the Assistant with vector store:
assistant = client.beta.assistants.update(
assistant_id=assistant.id,
tool_resources={"file_search": {"vector_store_ids": [vector_store.id]}},
)
You can attach vector databases to threads, check on Attaching vector stores in the azure documentation you linked