Sha256LLMRequestHash class

Default SHA-256 based implementation. Hashes the JSON-encoded (messages, tools, modelConfig, jsonOutput, trialSalt) tuple. Tool.executable closures are ignored (they're not in toJson).

Default-stripped keys: timestamp is always stripped from message JSON before hashing. UserMessage / ModelMessage / FunctionExecutionResultMessage all carry DateTime.now()-derived timestamps for tracing purposes, but those values are never semantically part of the LLM request — including them would make every hash unique per process invocation and defeat the cache.

Implemented types

Constructors

Sha256LLMRequestHash({Set<String> stripMessageKeys = const {}})
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
stripMessageKeys Set<String>
Additional message-level keys to strip before hashing. timestamp is always stripped — see class docstring. Pass extra keys here when the application embeds non-deterministic fields in messages (e.g. trace ids inside system reminders).
final

Methods

compute({required List<LLMMessage> messages, required List<Tool>? tools, required ModelConfig modelConfig, bool? jsonOutput, String? trialSalt}) String
Compute the hash for a request.
override
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