-
Notifications
You must be signed in to change notification settings - Fork 177
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
base: main
Are you sure you want to change the base?
auto get modality #567
Conversation
There was a problem hiding this 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_modalityinlibs/infinity_emb/infinity_emb/fastapi_schemas/pymodels.pyto 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
| """ | ||
| try: | ||
| return obj.get("modality", Modality.text.value) | ||
| modality = obj.get("modality", None) |
There was a problem hiding this comment.
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 ReportAttention: Patch coverage is
❗ 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. 🚀 New features to boost your workflow:
|
Related Issue
Checklist
Additional Notes
Add any other context about the PR here.