LLMRequestHash class abstract
Computes a stable hash of an LLM request, used as the cache key for recording / replay.
Stability requirements:
- The hash must be deterministic given the same logical request.
- It must ignore non-deterministic fields (timestamps, UUIDs, ids).
- It must be sensitive to anything that would change the model's output (messages, tools, model id, sampling parameters).
Non-determinism caveat: when trialsPerRun > 1, every trial sends
the same request (same messages, same tools, same model). Without
extra signal the hash collapses across trials and the cache forces
every trial to receive an identical response — which silently
destroys the non-determinism that pass^k / pass@k are supposed to
measure (Anthropic Step 6).
To preserve per-trial variation, callers can pass trialSalt (a
stable per-trial identifier such as runName/taskId#trialIndex).
Each trial then computes a distinct hash and the recording store
keeps a separate cache entry per trial. A null salt means "no
per-trial axis" — appropriate for one-off requests, judges, or any
other call that should be cached once across all trials.
- Implementers
Constructors
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
-
compute(
{required List< LLMMessage> messages, required List<Tool> ? tools, required ModelConfig modelConfig, bool? jsonOutput, String? trialSalt}) → String - Compute the hash for a request.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited