Skip to content

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

Open

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

DataPlanebugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions