Open
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