def update(self, present_kvs: list["NDArray"]):
        """Update the cache with the present key-value tensors.

        At the prompt processing step, i.e., when the cache is empty, the present key-value tensors can have any length
        smaller than or equal to max_cache_len.
        In token generation step, i.e., with one new token at each step, the present key-value tensors must have length
        equal to max_cache_len + 1. The last key-value tensor at the end of present_kvs is inserted into the first empty
        slot in the cache.

        :param present_kvs: List of present key-value tensors.
        """
        present_len = present_kvs[0].shape[2]
        assert present_len > 0, "present_kvs cannot be empty"

        if self.seen_len == 0:
            assert present_len <= self.max_cache_len, (
                "present_kvs is longer than max_cache_len during prompt processing"
            )
            # prompt processing
            for k, v in zip(self.past_names, present_kvs):
                self.cache[k][:, :, :present_len] = v
            self.seen_len = present_len
            return

        assert present_len == self.max_cache_len + 1, (
            "present_kvs must be one step longer than max_cache_len in token generation"
        )
        for k, v in zip(self.past_names, present_kvs):
            self.cache[k][:, :, self.seen_len] = v[:, :, -1]
        self.seen_len += 1
Update the cache with the present key-value tensors.

        At the prompt processing step, i.e., when the cache is empty, the present key-value tensors can have any length
        smaller than or equal to max_cache_len.
        In token generation step, i.e., with one new token at each step, the present key-value tensors must have length
        equal to max_cache_len + 1. The last key-value tensor at the end of present_kvs is inserted into the first empty
        slot in the cache.

        :param present_kvs: List of present key-value tensors.
        
examples/utils/kv_cache_utils.py