after_model(
self,
state: AgentState[Any],
runtime: Runtime[Any]
) | Name | Type | Description |
|---|---|---|
state* | AgentState[Any] | |
runtime* | Runtime[Any] |
Evaluate groundedness of the last model response.
Extracts the answer, grounding sources, and (for task="QnA") the
question from the state — either via the context_extractor callable
supplied at construction time or using the built-in heuristics — then
sends the result to the groundedness detection API.
The middleware annotates the state with the evaluation result and
either raises :exc:ContentSafetyViolationError (exit_behavior="error")
or lets execution proceed (exit_behavior="continue").
Current LangGraph state dict.
The runtime context.