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

Method match_prefix

examples/server/server.py:12686–12690  ·  view source on GitHub ↗
(self, tokens: Sequence[int])

Source from the content-addressed store, hash-verified

12684
12685class AttentionMemoryPolicy(MemoryPolicy):
12686 def match_prefix(self, tokens: Sequence[int]) -> Tuple[int, int]:
12687 return self.scheduler.radix_trie.longest_prefix(
12688 tokens,
12689 preferred_sequences=self.scheduler.free_sequences,
12690 )
12691
12692 @staticmethod
12693 def reuse_len_for_request(request: CompletionRequest, match_length: int) -> int:

Callers 2

can_admitMethod · 0.80
can_admitMethod · 0.80

Calls 1

longest_prefixMethod · 0.80

Tested by

no test coverage detected