"Failed to create file operation." when creating OpenAI Vector Store
I'm trying to create a Vector Store with some file attached:
curl --location 'https://{HOST}.openai.azure.com/openai/vector_stores?api-version=2024-05-01-preview' \
--header 'Content-Type: application/json' \
--header 'api-key: {OPENAI_KEY}' \
--header 'OpenAI-Beta: assistants=v2' \
--data '{
"name": "Software Engineer FAQ",
"file_ids": ["file-id"]
}'
But I get the error:
{
"error": {
"message": "Failed to create file operation.",
"type": "server_error",
"param": null,
"code": null
}
}
This only happens when I try to create with file_ids filed.
The same happens when I try to attach some file after creating a Vector Store.
Azure OpenAI Service
-
Jan • 5 Reputation points
2024-05-23T13:12:20.8966667+00:00 I can reproduce the same using the sample code from the docs.
I've tried both a GPT-4 and GPT-4 Turbo model.
The code used for me is this:
token_provider = get_bearer_token_provider( DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default" ) client = AzureOpenAI( azure_ad_token_provider=token_provider, api_version="2024-05-01-preview", azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT") ) message_file = client.files.create( file=open(datafileJson, "rb"), purpose="assistants" ) assistant = client.beta.assistants.create( name="Data Visualization", instructions=f"You are a helpful AI assistant who makes interesting visualizations based on data." f"You have access to a sandboxed environment for writing and testing code." f"When you are asked to create a visualization you should follow these steps:" f"1. Write the code." f"2. Anytime you write new code display a preview of the code to show your work." f"3. Run the code to confirm that it runs." f"4. If the code is successful display the visualization." f"5. If the code is unsuccessful display the error message and try to revise the code and rerun going through the steps from above again.", tools=[{"type": "code_interpreter"}], model=os.getenv("AZURE_OPENAI_GPT_DEPLOYED_MODEL"), ) print(assistant.model_dump_json(indent=2)) thread = client.beta.threads.create() # Create a thread and attach the file to the message thread = client.beta.threads.create( messages=[ { "role": "user", "content": "How many products are there?", # Attach the new file to the message. "attachments": [ { "file_id": message_file.id, "tools": [{"type": "file_search"}, {"type": "code_interpreter"}] } ], } ] ) # The thread now has a vector store with that file in its tool resources. print(thread.tool_resources.file_search)
-
romungi-MSFT • 48,406 Reputation points • Microsoft Employee
2024-05-23T15:09:12.4333333+00:00 @Andres da Silva Santos Do you think encoding of the file is an issue? I see the following mentioned in the documentation for all supported file types.
For text/ MIME types, the encoding must be either utf-8, utf-16, or ASCII.
Does it not work with any file that you are trying to use?
-
Andres da Silva Santos • 115 Reputation points
2024-05-23T17:43:21.8666667+00:00 @romungi-MSFT I don't think so... I'm correctly setting the content-type in Postman.
The file is being successfully uploaded.
POST /openai/files?api-version=2024-05-01-preview HTTP/1.1 api-key: KEY OpenAI-Beta: assistants=v2 User-Agent: PostmanRuntime/7.38.0 Accept: */* Postman-Token: Host: {HOST}.openai.azure.com Connection: keep-alive Content-Type: multipart/form-data; boundary=--------------------------757940290164238816746477 Content-Length: 15732 ----------------------------757940290164238816746477 Content-Disposition: form-data; name="purpose" assistants ----------------------------757940290164238816746477 Content-Disposition: form-data; name="file"; filename="Observabilidade.txt" Content-Type: text/plain; charset=UTF-8 <Observabilidade.txt> ----------------------------757940290164238816746477-- HTTP/1.1 200 OK
It doesn't work with any file.
Additionally, when I try to create the Vector Store, first I get the server error and then when I make a GET request to
/openai/vector_stores
it shows:{ "object": "list", "data": [ { "id": "vs_ymK7qM2BqhHdKaygg8zDS8iV", "object": "vector_store", "name": "Software Engineer FAQ", "status": "in_progress", "usage_bytes": 0, "created_at": 1716485596, "file_counts": { "in_progress": 1, "completed": 0, "failed": 0, "cancelled": 0, "total": 1 }, "metadata": {}, "expires_after": null, "expires_at": null, "last_active_at": 1716485596 } ], "first_id": "vs_ymK7qM2BqhHdKaygg8zDS8iV", "last_id": "vs_ymK7qM2BqhHdKaygg8zDS8iV", "has_more": false }
And stays "in_progress" forever.
-
Jan • 5 Reputation points
2024-05-24T11:42:10.2433333+00:00 While trying to find the issue, I did see these messages popping up when opening up the Assistants experience in Azure AI Studio.
AuthenticationTypeDisabled: Key based authentication is disabled for this resource.
For security reasons, we've disabled key-based authentication (connectionstrings, SAS tokens, etc.) to all our storage accounts.
Maybe it's related, maybe not...
The Assistant experience in Azure OpenAI Studio does still work so there's a discrepancy between how the two Studio experiences work.
-
Andres da Silva Santos • 115 Reputation points
2024-05-25T15:38:43.01+00:00 @romungi-MSFT any update? the error persists
-
Styrmir Grünheit • 15 Reputation points
2024-05-27T04:41:47.13+00:00 I got the same problems since a couple of days. Maybe a week ago it worked fine and suddenly it started to fail. I didn't change the code at all, so I guess there was something changed on MS behalf.
After the problems begun, I also started to change the way how the vector store is created and so on, but no Luck.
When I query the VS I see it remains in status "in_progress"
-
Daniel Leon Gonzalez • 10 Reputation points
2024-05-27T06:23:06.5766667+00:00 Hi, I am having the same issue, any update on this? I've tried all possible combinations. I would like to add that when I do not receive the "Failed to create file operation" error, I see that only one of the multiple files that I upload goes into processed status. The error "failed to create file operation" is even shown when deleting a vector file store. Microsoft should provide answer on this problem...
-
A R • 10 Reputation points
2024-05-27T07:07:39.52+00:00 Hi, I am also getting the same issue. I have tried creating multiple vector stores but link the file to the vector store. The files are getting uploaded as I am able to see the files in the Data Files section in the Azure Open AI Studio. But the files are not getting linked to the vector store. I am getting the "file_counts" as "file_counts": {
"in_progress": 5, "completed": 0, "failed": 0, "cancelled": 0, "total": 5 }
-
Simon H • 25 Reputation points
2024-05-27T12:25:19.3566667+00:00 Hi, I have a similar problem using
client.beta.vector_stores.file_batches.upload_and_poll
(/openai/vector_stores/vs_XYZ/file_batches):INFO:httpx:HTTP Request: POST https://xyz.openai.azure.com/openai/files?api-version=2024-05-01-preview "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://xyz.openai.azure.com/openai/files?api-version=2024-05-01-preview "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://xyz.openai.azure.com/openai/vector_stores/vs_XYZ/file_batches?api-version=2024-05-01-preview "HTTP/1.1 500 Internal Server Error"
InternalServerError: Error code: 500 - {'error': {'message': 'Failed to create file operation.', 'type': 'server_error', 'param': None, 'code': None}}
After this /openai/vector_stores shows the same result as above. All files have the status in_progress.
-
Styrmir Grünheit • 15 Reputation points
2024-05-28T18:59:26.46+00:00 Finally it works now!
-
Styrmir Grünheit • 15 Reputation points
2024-05-28T19:00:02.3733333+00:00 It finally works now!
-
Jan • 5 Reputation points
2024-05-29T08:24:20.22+00:00 Great to read!
Too bad it's still not working over here. Still receiving a
Too bad it's still not working over here. Still receiving a
InternalServerError: Error code: 500 - {'error': {'message': 'Failed to create file operation.', 'type': 'server_error', 'param': None, 'code': None}}
I tried to do the following from the docs now too: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/file-search?tabs=python#upload-files-for-file-search
So create a vector store and upload the files to the assistant instead of the individual thread.Only to see this doesn't work when using managed identities (tokens)
BadRequestError: Error code: 400 - {'error': {'code': 'API operation not supported for token authentication', 'message': 'ApiId openai-api-2024-05-01-preview OperationId create_vector_store not supported for CheckAccess.'}}
-
Daniel Leon Gonzalez • 10 Reputation points
2024-05-29T08:33:55.11+00:00 It is still not working for me. There is no improvement over the last few days. It is still impossible to create a vector store file batch for example without receiving the error:
InternalServerError: Error code: 500 - {'error': {'message': 'Failed to create file operation.', 'type': 'server_error', 'param': None, 'code': None}}
or receiving the response correctly but without all the files being processed correctly. Always only 1 file is processed but the rest are failed.
Microsoft should provide answer on this problem a lot of people is facing.
-
Styrmir Grünheit • 15 Reputation points
2024-06-03T14:48:13.5466667+00:00 Actually it stopped working again after a few days working pretty well. I know it is in a beta state, but this is a bit frustrating :(
Sign in to comment