-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AssistantsClient.UploadFile "message": "Additional properties are not allowed ('filename' was unexpected) #43953
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @trrwilson. |
I am getting the same, but I am using the library to connect to Azure OpenAI. Using Azure.AI.OpenAI.Assistants 1.0.0-beta.4
|
I'm also having issues. It seems the Files API has been updated; no longer accepts a |
I created a MemoryStream and I filled it up with the binary content of the PDF, i call the method UploadFile and this time i let the default parameter value (null) for the filename but It does not work neither. |
@Freddeb I have put together an alternate wrapper that you can use to upload files (using restsharp and the /openai/files endpoints) It got me around the bug, so thought I would share. |
@rogerdaryl I call the OpenAI library from a chatbot developed for Microsoft Teams (Microsoft Bot Framework 4). I will adapt your code and use the function RestRequest.AddFile (3rd overload) that supports a stream as parameter. Thank you. |
Hi @Freddeb @rogerdaryl I am struggling with the same problem. var client = new AssistantsClient(apiKey); where I still have a problem. Any help appreciated |
Hi @JohnTranstel, I wrote my own function to get around the bug. Let me know if you need more info than that. |
Hi Roger thanks for the quick reply.
I did look through your code but I am not subscribing to azure. I have two questions.
Looking at your usage example, the line
Files localFile = new Files(AzureEndpointDefault, AzureKeyDefault);
I know the azurekeydefault can be replaced by my openAI key, not sure what to use for the AzureEndpointDefault??
My main question though is how this links to
var fileUploadresponse = await client.UploadFileAsync(stream, OpenAIFilePurpose.Assistants, null, token);
are you saying that your resVal string is the same result as fileUploadresponse.Value.Id??
If so I think I get it.
Kind regards
John
From: Roger D ***@***.***>
Sent: Tuesday, May 28, 2024 8:12 PM
To: Azure/azure-sdk-for-net ***@***.***>
Cc: John Evans ***@***.***>; Mention ***@***.***>
Subject: Re: [Azure/azure-sdk-for-net] AssistantsClient.UploadFile "message": "Additional properties are not allowed ('filename' was unexpected) (Issue #43953)
Hi @Freddeb<https://github.com/Freddeb> @rogerdaryl<https://github.com/rogerdaryl> I am struggling with the same problem. I now have my file as a stream and it is not accepted. I already have my file uploaded server side, and can easily convert it into byte[] or MemoryStream, but it is the 2 lines
var client = new AssistantsClient(apiKey); var fileUploadresponse = await client.UploadFileAsync(stream, OpenAIFilePurpose.Assistants, null, token);
where I still have a problem. (The fourth parameter is a new Cancellation token, it makes no difference). The error is that the file is not one of the list of possible file types. Am I still to use UploadFileAsync or should I be using a different client.xxx function?
Any help appreciated Thanks
Hi @JohnTranstel<https://github.com/JohnTranstel>,
I wrote my own function to get around the bug.
Details are here.
https://github.com/ViceVersaLtd/viceversa.ai.openai.files
Let me know if you need more info than that.
—
Reply to this email directly, view it on GitHub<#43953 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEDZRJ3KZOVUL6DXZOVAX2LZETJJHAVCNFSM6AAAAABHO4MI5WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZVHEZTOMJYGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Hi @JohnTranstel, The "AzureKeys" variables in my code can be swapped for OpenAI values (the Endpoints are defined the same) And yes, my ResVal is the same as fileUploadresponse.Value.Id. Which is all you need to associate it with the Assistant. |
Type of issue
Code doesn't work
Description
When the method UploadFile is called with the parameters: stream, OpenAIFilePurpose.Assistants and a filename then the following exception is raised (request status:400) with the message:
"message": "Additional properties are not allowed ('filename' was unexpected)
My parameter filename contains a string with a filename with a pdf extension.
I use the library to connect directly on the API of OpenAI (not through Azure OpenAI).
Page URL
https://learn.microsoft.com/en-us/dotnet/api/azure.ai.openai.assistants.assistantsclient.uploadfile?view=azure-dotnet-preview
Content source URL
https://github.com/Azure/azure-docs-sdk-dotnet/blob/master/xml/Azure.AI.OpenAI.Assistants/AssistantsClient.xml
Document Version Independent Id
22aa7835-27b0-0f7e-3907-678244873658
Article author
@azure-sdk
Metadata
The text was updated successfully, but these errors were encountered: