Skip to content
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

[BUG] OpenAI TypeSpec should not include the "filename" part in multipart/form-data API #28905

Open
weidongxu-microsoft opened this issue Apr 30, 2024 · 1 comment
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. DataPlane

Comments

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Apr 30, 2024

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/ai/OpenAI.Assistants/files/routes.tsp#L50-L57

API Spec version

2024-02-15-preview

Describe the bug

The "filename" of a File should not be in multipart/form-data model.

Same in
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_transcription.tsp#L48-L53

In TypeSpec design, the part would be written as

HttpPart<File, #{ name: "file" }>,

And the filename is included in the File.

Expected behavior

This "filename" should not be in model or method.

It is up to SDK emitter to determine, how to let user to set a "filename" for the File.

0000: --------------------------NWdLREXJ51lgZwiipJsqHR
0032: Content-Disposition: form-data; name="file"; filename=<filename>
005f: Content-Type: application/octet-stream
0087:
0089: The word 'apple' uses the code 442345, while the word 'banana' u
00c9: ses the code 673457.

Actual behavior

This extra "filename" part.

Java had to customize the method signature to remove it. Azure/azure-sdk-for-java#38698

Assistants backend would error, if filename is sent as part.

  {
    "error": {
        "message": "Additional properties are not allowed ('filename' was unexpected)",
            "type": "invalid_request_error",
            "param": null,
            "code": null
    }
 }

Reproduction Steps

NOOP

Environment

No response

@weidongxu-microsoft weidongxu-microsoft added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Apr 30, 2024
@zzhxiaofeng
Copy link

@iscai-msft Please help have a look, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. DataPlane
Projects
None yet
Development

No branches or pull requests

3 participants