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

genai[feat]: add filetype detection for images from bytes #616

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

maxmet91
Copy link
Contributor

PR Description

This pull request enhances the process of guessing MIME types by introducing an alternative method to determine the MIME type from file bytes when guessing from the filename fails. Additionally, it includes an integration test for a specific case related to remote URL images without file extensions.

MIME Type Detection:

  • Updated pyproject.toml to add new dependency: filetype.
  • Implemented MIME type guessing using the filetype library to analyze image bytes as a fallback mechanism.

Integration Test:

  • Added a new integration test for a remote URL image without a file extension (https://picsum.photos/seed/picsum/200/300). This URL is currently used in the example section of the README, but it does not work as intended.

Type

🆕 New Feature
✅ Test

@lkuligin lkuligin merged commit 69be452 into langchain-ai:main Nov 27, 2024
15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants