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

new-release? #494

Merged
merged 4 commits into from
Dec 10, 2024
Merged

new-release? #494

merged 4 commits into from
Dec 10, 2024

Conversation

michaelfeil
Copy link
Owner

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 introduces support for matryoshka embeddings and the nomic-ai/nomic-embed-text-v1.5 model through several key changes:

  • Added matryoshka dimension support with new dimensions field across text, audio and image embedding models, including validation and slicing logic
  • Added einops dependency and updated version to 0.0.73 to support nomic-ai/nomic-embed-text-v1.5 model requirements
  • Introduced MatryoshkaDimError exception class for proper dimension validation handling
  • Simplified error handling in audio/vision utils by removing redundant try-except blocks
  • Standardized error message format across endpoints using {ex.__class__} -> {ex} pattern

The changes appear well-structured and maintain backward compatibility while adding new capabilities.

12 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile

modality (Union[Unset, OpenAIEmbeddingInputTextModality]): Default: OpenAIEmbeddingInputTextModality.TEXT.
"""

input_: Union[List[str], str]
model: Union[Unset, str] = "default/not-specified"
encoding_format: Union[Unset, EmbeddingEncodingFormat] = UNSET
user: Union[None, Unset, str] = UNSET
dimensions: Union[Unset, int] = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

style: dimensions default value of 0 should be documented in docstring to match other attributes

@@ -24,6 +24,7 @@
RootModel,
Tag,
conlist,
conint,
Copy link
Contributor

Choose a reason for hiding this comment

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

style: conint is imported but not used in the changes shown

@@ -54,7 +55,7 @@ class _OpenAIEmbeddingInput(BaseModel):
model: str = "default/not-specified"
encoding_format: EmbeddingEncodingFormat = EmbeddingEncodingFormat.float
user: Optional[str] = None
dimensions: Optional[Annotated[int, Field(strict=True, gt=0, lt=8193)]] = None
dimensions: int = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: changing from Optional[int] to int with default=0 is a breaking change for API clients expecting null values

Comment on lines +65 to +67
def matryososka_slice(
embeddings: list[np.ndarray], matryoshka_dim: Optional[int]
) -> list[np.ndarray]:
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: function name 'matryososka_slice' is misspelled, should be 'matryoshka_slice'

Comment on lines 308 to 309
getattr(self.model_worker[0]._model, "sampling_rate", -42),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

style: sampling rate fallback of -42 should be documented or use a more meaningful default

Comment on lines +439 to +440
class MatryoshkaDimError(Exception):
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Empty exception class needs docstring explaining when this error is raised and what it means

Comment on lines +55 to +57
resolved_audios = await asyncio.gather(
*[resolve_audio(audio, allowed_sampling_rate, session) for audio in audio_urls]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider using gather with return_exceptions=True to handle partial failures more gracefully

@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2024

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

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.92%. Comparing base (edd9107) to head (b1eae04).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...finity_emb/infinity_emb/inference/batch_handler.py 88.88% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #494      +/-   ##
==========================================
+ Coverage   79.68%   79.92%   +0.23%     
==========================================
  Files          42       42              
  Lines        3476     3467       -9     
==========================================
+ Hits         2770     2771       +1     
+ Misses        706      696      -10     

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

@michaelfeil michaelfeil merged commit d614094 into main Dec 10, 2024
36 checks passed
@michaelfeil michaelfeil deleted the 0.0.73-release branch December 10, 2024 08:22
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