MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / _split_child

Method _split_child

examples/server/server.py:833–851  ·  view source on GitHub ↗
(
        self,
        parent: "RadixTrie.Node",
        child: "RadixTrie.Node",
        prefix_len: int,
    )

Source from the content-addressed store, hash-verified

831 return match_len
832
833 def _split_child(
834 self,
835 parent: "RadixTrie.Node",
836 child: "RadixTrie.Node",
837 prefix_len: int,
838 ) -> "RadixTrie.Node":
839 assert 0 < prefix_len < len(child.label)
840 prefix = child.label[:prefix_len]
841 suffix = child.label[prefix_len:]
842 middle = RadixTrie.Node(
843 label=prefix,
844 parent=parent,
845 sequences=set(child.sequences),
846 )
847 parent.children[prefix[0]] = middle
848 child.label = suffix
849 child.parent = middle
850 middle.children[suffix[0]] = child
851 return middle
852
853 def _locate_prefix_node(
854 self,

Callers 2

_locate_prefix_nodeMethod · 0.95
extendMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected