def count_input_tokens()

in aidial_adapter_vertexai/embedding/multi_modal.py [0:0]


    def count_input_tokens(self) -> int:
        # The model doesn't report the number of input tokens.
        # However, one could count it oneself:
        # https://cloud.google.com/vertex-ai/generative-ai/pricing#embedding-models
        # As of 29 Jul 2024, one image costs as much as 500 text input characters
        ret = len(self.contextual_text or "")
        if self.image:
            ret += 500
        return ret