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

How do I supply Files.contentType? #20

Open
omikader opened this issue Jan 27, 2024 · 1 comment
Open

How do I supply Files.contentType? #20

omikader opened this issue Jan 27, 2024 · 1 comment

Comments

@omikader
Copy link

omikader commented Jan 27, 2024

How can I provide a value for my file's content type to the partitioning API?

I noticed that the code in unstructured-api determines how to partition each file using the content_type attribute attached to the FastAPI UploadFile. If one is not provided, it tries to infer the file type using the filename extension.

My file names are arbitrary UUIDs (no filename extension) so when I try to partition them I get this error

{"detail":"File type None is not supported."}

I would like to manually provide a value for UploadFile.content_type to avoid the fallback behavior but I don't see a way to do that using the JS client. Can we modify the Files definition to include an optional value for contentType, which I presume would be used in the unstructured-api code and result in skipping the fallback path?

export declare class Files extends SpeakeasyBase {
    content: Uint8Array;
    fileName: string;
    // PROPOSING WE ADD THE FOLLOWING LINE
    contentType?: string;
}
@omikader omikader changed the title Should contentType be an optional parameter? How do I supply FIles.contentType? Jan 29, 2024
@omikader omikader changed the title How do I supply FIles.contentType? How do I supply Files.contentType? Jan 29, 2024
@awalker4
Copy link
Collaborator

awalker4 commented Feb 3, 2024

Hi there, apologies for the delay. This is certainly something that should be in the client. I can do some digging and get back to you soon. We're also planning to improve the content type checking on the server side in the near term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants