MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / __getitem__

Method __getitem__

llama_cpp/llama_cache.py:79–86  ·  view source on GitHub ↗
(self, key: Sequence[int])

Source from the content-addressed store, hash-verified

77 return min_key
78
79 def __getitem__(self, key: Sequence[int]) -> "llama_cpp.llama.LlamaState":
80 key = tuple(key)
81 _key = self._find_longest_prefix_key(key)
82 if _key is None:
83 raise KeyError("Key not found")
84 value = self.cache_state[_key]
85 self.cache_state.move_to_end(_key)
86 return value
87
88 def __contains__(self, key: Sequence[int]) -> bool:
89 return self._find_longest_prefix_key(tuple(key)) is not None

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected