| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | """The `vecs.experimental.adapter.noop` module provides a default no-op (no operation) adapterthat passes the inputs through without any modification. This can be useful when no specificadapter processing is required.All public classes, enums, and functions are re-exported by `vecs.adapters` module."""from typing import Generator, Iterable, Optionalfrom .base import AdapterContext, AdapterStep, Recordclass NoOp(AdapterStep):    """    NoOp is a no-operation AdapterStep. It is a default adapter that passes through    the input records without any modifications.    """    def __init__(self, dimension: int):        """        Initializes the NoOp adapter with a dimension.        Args:            dimension (int): The dimension of the input vectors.        """        self._dimension = dimension    @property    def exported_dimension(self) -> Optional[int]:        """        Returns the dimension of the adapter.        Returns:            int: The dimension of the input vectors.        """        return self._dimension    def __call__(        self,        records: Iterable[Record],        adapter_context: AdapterContext,    ) -> Generator[Record, None, None]:        for record in records:            (                id,                document_id,                user_id,                collection_ids,                vec,                text,                metadata,            ) = record            yield (                str(id),                str(document_id),                str(user_id),                [str(gid) for gid in collection_ids],                vec,                text,                metadata or {},            )
 |