Conversation
There was a problem hiding this comment.
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.
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.