Skip to content

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 #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
"""
try:
return obj.get("modality", Modality.text.value)
modality = obj.get("modality", None)
Copy link
Owner

Choose a reason for hiding this comment

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

I am worried that this, combined with a check takes a hit on performance.

@codecov-commenter
Copy link

codecov-commenter commented May 9, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 50.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 79.69%. Comparing base (88bad14) to head (075dad6).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...inity_emb/infinity_emb/fastapi_schemas/pymodels.py 50.00% 9 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #567      +/-   ##
==========================================
- Coverage   79.85%   79.69%   -0.16%     
==========================================
  Files          43       43              
  Lines        3489     3506      +17     
==========================================
+ Hits         2786     2794       +8     
- Misses        703      712       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants