__init__.py 946 Bytes
"""
Embeddings module.

Important: keep package import lightweight.

Some callers do:
  - `from embeddings import BgeEncoder`
  - `from embeddings import CLIPImageEncoder`

But the underlying implementations may import heavy optional deps (Pillow, torch, etc).
To avoid importing those at package import time (and to allow the embedding service to boot
without importing client code), we provide small lazy factories here.
"""


class BgeEncoder(object):
    """Lazy factory for `embeddings.text_encoder.BgeEncoder`."""

    def __new__(cls, *args, **kwargs):
        from .text_encoder import BgeEncoder as _Real

        return _Real(*args, **kwargs)


class CLIPImageEncoder(object):
    """Lazy factory for `embeddings.image_encoder.CLIPImageEncoder`."""

    def __new__(cls, *args, **kwargs):
        from .image_encoder import CLIPImageEncoder as _Real

        return _Real(*args, **kwargs)


__all__ = ["BgeEncoder", "CLIPImageEncoder"]