Struct Prediction Trie Lookup

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

1pub struct PredictionTrieLookup<'a> { /* private fields */ }

Looks up predictions in a prediction trie with graceful fallback.

Fallback chain:

  1. Exact path + exact call_index
  2. Exact path + predictions_any_index
  3. Deepest ancestor + exact call_index
  4. Deepest ancestor + predictions_any_index
  5. … continue to root …
  6. None (no predictions available)

Implementations

impl<'a> PredictionTrieLookup<'a>

impl<'a> PredictionTrieLookup<'a>

new

pub fn new(root: &'a PredictionTrieNode) -> Self

Create a new lookup over the given trie root.

find

pub fn find(
    &self,
    path: &[String],
    call_index: u32,
) -> Option<&'a LlmCallPrediction>

Find the best matching prediction for the given path and call index.

Walks the trie following path elements, tracking the deepest node that has a prediction. At each node, prefers predictions_by_call_index[call_index] over predictions_any_index.