I can no longer upload files to vector store with AzureOpenAI
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.6k
- Forks
- 5.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 96
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
Hi,
From 2 days till now i'm getting error when I try to upload files in vector stores using AzureOpenAI package.
The same code works with OpenAI.
I changed nothing in my code but from 31/07/2024 it doesn't work with AzureOpenAI.
The output of file_batch:
File batch: FileCounts(cancelled=0, completed=0, failed=1, in_progress=0, total=1)
File batch status: failed
File status: failed
File last error: LastError(code='server_error', message='An internal error occurred.')
Are there some problems with AzureOpenAI ?
Thanks,
Matteo
To Reproduce
Use a simple file.txt or other types.
Execute the code and see the result.
Code snippets
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")
)
file_stream = open("path/of/my/simple/file.txt", "rb")
vector_store = client.beta.vector_stores.create(name="vs_test_assistant_v2")
vector_store_id = vector_store.id
print("Uploading file to vector store..")
file_batch = client.beta.vector_stores.file_batches.upload_and_poll(
vector_store_id=vector_store_id,
files=[file_stream],
)
print(f"File batch status: {file_batch.status}")
print(f"File batch: {file_batch.file_counts}")
file = client.beta.vector_stores.files.list(vector_store_id).data[0]
print(f"File status: {file.status}")
if file.status == "failed":
print(f"File last error: {file.last_error}")
OS
Linux
Python version
Python v3.10.12
Library version
openai v1.37.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided AzureOpenAI vector-store upload example with openai v1.37.2, Python 3.10.12, and the 2024-05-01-preview API version, then compare it with the same code against OpenAI. Done means identifying whether the Python library causes the failed file batch and documenting or testing the corrected Azure behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100