An engine's calls for scoring options, on one loaded model. Core makes one call at a time on a scorer (a decider runs its decisions one after another); every call runs on the model's own engine, ordered with its other native work.
An abstract base class, so that a member added in a later release
reaches every engine with its default body. Extend it.
Experimental: may change in a minor release while the API settles.
- Annotations
-
- @experimental
Constructors
- OptionScorer()
-
For engines.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Releases what the scorer holds. The model stays open. Idempotent.
-
detokenize(
List< int> ids) → Future<String> -
The text of
ids. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prepare(
List< String> targets) → Future<void> -
Called once, before the first score, with the decision's targets. An
engine checks here what it has to before it can score them exactly
(LiteRT-LM finds out how its version scores after a prefill), and fails
with
DeciderUnsupportedExceptionwhen it cannot. Nothing by default. -
renderUserMessage(
String content) → Future< String> -
One user message with
content, rendered by the model's own chat template up to where the model's reply begins: the prompt score takes. -
score(
String prompt, List< String> targets, {CancelToken? cancelToken}) → Future<OptionScoringRun> -
The exact natural-log probability of each token of each of
targetsas the model's continuation ofprompt— the text renderUserMessage returned, after the BOS the engine adds — each target scored on its own, tokenised as tokenize splits it. -
tokenize(
String text) → Future< List< int> > -
The model's token ids for
text, as its tokenizer splits it — control tokens written as text (<end_of_turn>) included — with no BOS added. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited