pyrit.identifiers.compute_eval_hash#
- compute_eval_hash(identifier: ComponentIdentifier, *, target_child_keys: frozenset[str], behavioral_child_params: frozenset[str]) str[source]#
Compute a behavioral equivalence hash for evaluation grouping.
Unlike
ComponentIdentifier.hash(which includes all params of self and children), the eval hash filters child components that are “targets” to only their behavioral params (e.g., model_name, temperature, top_p), stripping operational params like endpoint or max_requests_per_minute. This ensures the same logical configuration on different deployments produces the same eval hash.Non-target children (e.g., sub-scorers) receive full recursive eval treatment.
When
target_child_keysis empty, no child filtering occurs and the result equalsidentifier.hash.- Parameters:
identifier (ComponentIdentifier) – The component identity to compute the hash for.
target_child_keys (frozenset[str]) – Child names that are targets (e.g.,
{"prompt_target", "converter_target"}).behavioral_child_params (frozenset[str]) – Param allowlist for target children (e.g.,
{"model_name", "temperature", "top_p"}).
- Returns:
A hex-encoded SHA256 hash suitable for eval registry keying.
- Return type: