pooling_params.py 683 Bytes
Newer Older
1
2
from typing import Any, Optional

3
import msgspec
4

5
6
7
8
9

class PoolingParams(
        msgspec.Struct,
        omit_defaults=True,  # type: ignore[call-arg]
        array_like=True):  # type: ignore[call-arg]
10
    """Pooling parameters for embeddings API.
11
12
13
14

    Attributes:
        additional_data: Any additional data needed for pooling.
    """
15
    additional_data: Optional[Any] = None
16
17
18

    def clone(self) -> "PoolingParams":
        """Returns a deep copy of the PoolingParams instance."""
19
        return PoolingParams(additional_data=self.additional_data)
20
21
22
23

    def __repr__(self) -> str:
        return (f"PoolingParams("
                f"additional_metadata={self.additional_data})")