(self, key: Sequence[int])
| 128 | return min_key |
| 129 | |
| 130 | def __getitem__(self, key: Sequence[int]) -> "llama_cpp.llama.LlamaState": |
| 131 | key = tuple(key) |
| 132 | _key = self._find_longest_prefix_key(key) |
| 133 | if _key is None: |
| 134 | raise KeyError("Key not found") |
| 135 | value: "llama_cpp.llama.LlamaState" = self.cache.pop(_key) # type: ignore |
| 136 | # NOTE: This puts an integer as key in cache, which breaks, |
| 137 | # Llama.longest_token_prefix(k, key) above since k is not a tuple of ints/tokens |
| 138 | # self.cache.push(_key, side="front") # type: ignore |
| 139 | return value |
| 140 | |
| 141 | def __contains__(self, key: Sequence[int]) -> bool: |
| 142 | return self._find_longest_prefix_key(tuple(key)) is not None |
nothing calls this directly
no test coverage detected