Skip to content

auto get modality #567

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lloydzhou
Copy link

Related Issue

Checklist

  • I have read the CONTRIBUTING guidelines.
  • I have added tests to cover my changes.
  • I have updated the documentation (docs folder) accordingly.

Additional Notes

Add any other context about the PR here.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR enhances the get_modality function to automatically detect content type (text, image, or audio) based on input patterns rather than requiring explicit modality specification.

  • Modified get_modality in libs/infinity_emb/infinity_emb/fastapi_schemas/pymodels.py to examine URL patterns, file extensions, and data URI prefixes
  • Added pattern recognition for common image formats (jpg, jpeg, png, etc.) and audio formats (mp3, wav, etc.)
  • Implemented fallback to explicit modality parameter when available
  • Improved user experience by reducing the need for manual modality specification
  • This change supports the integration of models like nomic-ai/nomic-embed-text-v1.5 mentioned in issue Support for nomic-ai/nomic-embed-text-v1.5 #123

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

1 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

@lloydzhou lloydzhou changed the title aoto get modality auto get modality Apr 15, 2025
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.

1 participant