Hi Goran
I am getting partial success in East Us region (not able summarize but not failing at least with 500 internal server errors, managable) and with API version - "2025-04-01-preview"
Attached sample code and results for reference
%pip install openai
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="<yourazureopenaikey>",
api_version="2025-04-01-preview",
azure_endpoint = "https://<yourazureopenairesourcename>.openai.azure.com/"
)
assistant = client.beta.assistants.create(
name="Recommender Assistant",
instructions="You are a bot summarize the document and gives a improved content for attached pdf.",
model="o3-mini",
tools=[{"type": "file_search"}],
)
# Create a vector store called "Financial Statements"
vector_store = client.vector_stores.create(name="Financial Statements")
# Ready the files for upload to OpenAI
file_paths = ["CSA_Test.pdf"]
file_streams = [open(path, "rb") for path in file_paths]
# Use the upload and poll SDK helper to upload the files, add them to the vector store,
# and poll the status of the file batch for completion.
file_batch = client.vector_stores.file_batches.upload_and_poll(
vector_store_id=vector_store.id, files=file_streams
)
# You can print the status and the file counts of the batch to see the result of this operation.
print(file_batch.status)
print(file_batch.file_counts)
# you can replace with vector_store.id instead of string value used here
assistant = client.beta.assistants.update(
assistant_id=assistant.id,
tool_resources={"file_search": {"vector_store_ids": [vector_store.id]}},
)
assistant = client.beta.assistants.create(
instructions="Please summarize the attached document",
model="o3-mini",
tools=[{"type": "file_search"}],
tool_resources={
"file_search": {
"vector_store_ids": [vector_store.id]
}
}
)
thread = client.beta.threads.create()
run = client.beta.threads.runs.create(
thread_id=thread.id,
assistant_id=assistant.id
)
#retrieve the results with run
import time
# Looping until the run completes or fails
while run.status in ['queued', 'in_progress', 'cancelling']:
time.sleep(1)
run = client.beta.threads.runs.retrieve(
thread_id=thread.id,
run_id=run.id
)
if run.status == 'completed':
messages = client.beta.threads.messages.list(
thread_id=thread.id
)
print(messages)
elif run.status == 'requires_action':
# the assistant requires calling some functions
# and submit the tool outputs back to the run
print("processing, Please rerun")
pass
else:
print(run.status)
Looking forward to your update with Code and result
Note: Have not used reasoning effort here, have modified code from playground instead of file search code, as i faced difficulty in event handler step.
Reference used for API Version
- https://learn.microsoft.com/en-us/azure/ai-foundry/openai/api-version-lifecycle?tabs=key
- https://learn.microsoft.com/en-us/azure/ai-foundry/openai/reference-preview
Thank you