Skip to content

feat: Allow application/yaml as mime_type#2575

Merged
leseb merged 1 commit intollamastack:mainfrom
onmete:yaml-mime-type
Jul 21, 2025
Merged

feat: Allow application/yaml as mime_type#2575
leseb merged 1 commit intollamastack:mainfrom
onmete:yaml-mime-type

Conversation

@onmete
Copy link
Contributor

@onmete onmete commented Jul 1, 2025

What does this PR do?

Allow application/yaml as mime_type for documents.

Test Plan

Added unit tests.

@facebook-github-bot
Copy link

Hi @onmete!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@onmete
Copy link
Contributor Author

onmete commented Jul 1, 2025

I understand it might not be the best solution, because it opens up a can of worms on what and how many types of documents should be supported. :)

Our application (build on top of llama-stack), supports these types {"text/plain", "application/json", "application/yaml", "application/xml"}, so I'm open for suggestions if we should stick to text/plain or add all of these.


async def get_raw_document_text(document: Document) -> str:
if not document.mime_type.startswith("text/"):
if not (document.mime_type.startswith("text/") or document.mime_type == "application/yaml"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text/yaml is considered deprecated

Deprecated alias names for this type: ...text/yaml...

Therefore application/yaml is the only official MIME Type for YAML documents.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the current code does not address @manstis comment. Should we fail if mime_type="text/yaml"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that is another issue, how to handle the deprecated mime type.
Would you have any preference if I should include/allow more types (json/xml) in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ @leseb @ashwinb @yanxi0830 (sorry, pinging random people here :))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we can followup on this.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 2, 2025
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Copy link
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see pre-commit failures

@onmete onmete requested a review from mattf as a code owner July 14, 2025 07:33
@onmete
Copy link
Contributor Author

onmete commented Jul 14, 2025

@leseb I've added the deprecation warning for text/yaml and fixed pre-commit step.

@onmete
Copy link
Contributor Author

onmete commented Jul 16, 2025

@leseb @ashwinb @yanxi0830 can someone review this please?

Copy link
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additional unit tests

@onmete
Copy link
Contributor Author

onmete commented Jul 21, 2025

@leseb @ashwinb @yanxi0830
Sorry for another ping, but I would like to know if this can be merged or if we are closing this. :)

@leseb
Copy link
Collaborator

leseb commented Jul 21, 2025

@leseb @ashwinb @yanxi0830 Sorry for another ping, but I would like to know if this can be merged or if we are closing this. :)

Was waiting to see if others wanted to chime in :)

@leseb leseb merged commit 89c49eb into llamastack:main Jul 21, 2025
133 of 134 checks passed
@onmete
Copy link
Contributor Author

onmete commented Jul 21, 2025

Thank you!

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

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants