Hi Eric S,
Thanks for explaining everything so clearly.
You're very close — but the issue you're facing is actually due to a limitation of the current Azure OpenAI 2025-03-02-preview API version:
Azure OpenAI Vector Stores currently do not fully support attributes retrieval yet, even though OpenAI API does!
Why is it happening?
· In OpenAI's own API (api.openai.com), when you add attributes while uploading a file to a Vector Store, you can later retrieve them via the vector_stores.files.retrieve call.
· However, in Azure OpenAI, attributes are currently accepted during creation, but NOT returned on retrieval yet.
· This is a known gap as of the 2025-03-02-preview API version.
That's why:
· vs_file creation succeeds
· but retrieved_vs_file does NOT contain the attributes you saved.
It isn't your code's mistake — it's Azure's Vector Store backend not returning attributes yet.
Confirmed by documentation and tests:
· If you check the official Azure OpenAI Vector Store documentation you’ll notice they don't mention support for attributes in retrieve response yet.
· OpenAI Python SDK works because OpenAI (non-Azure) backend supports this fully.
How you can handle it temporarily:
Manually store metadata elsewhere (workaround):
Since Azure is not returning attributes yet, you can store the file_id and its attributes separately.
Example:
· When you add a file to the Vector Store, also save file_id + attributes mapping somewhere (like in a small Azure Table Storage, CosmosDB, or even a local JSON file).
· Later, when you retrieve the file by ID, you can manually look up the attributes.
Quick sample idea:
file_metadata_store = {} # Simple dictionary
# After adding the file:
file_metadata_store[file_id] = TEST_ATTRIBUTE
# Later when retrieving:
retrieved_attributes = file_metadata_store.get(file_id)
Wait for Azure API to upgrade:
Azure will eventually add full support for attribute retrieval (most likely in a later stable API version).
Hope this helps, do let me know if you have any further queries.
Thank you!