feat: Add "final_session_state" to the EvalCase data model

This will allow setting a golden expectation on the session state for agents that will modify the states.

PiperOrigin-RevId: 826166904
This commit is contained in:
Google Team Member
2025-10-30 13:37:42 -07:00
committed by Copybara-Service
parent 610e219a9f
commit 2274c4f304
+8 -1
View File
@@ -108,6 +108,10 @@ class Invocation(EvalBaseModel):
"""Details about the App that was used for this invocation."""
SessionState: TypeAlias = dict[str, Any]
"""The state of the session."""
class SessionInput(EvalBaseModel):
"""Values that help initialize a Session."""
@@ -117,7 +121,7 @@ class SessionInput(EvalBaseModel):
user_id: str
"""The user id."""
state: dict[str, Any] = Field(default_factory=dict)
state: SessionState = Field(default_factory=dict)
"""The state of the session."""
@@ -159,6 +163,9 @@ class EvalCase(EvalBaseModel):
)
"""A list of rubrics that are applicable to all the invocations in the conversation of this eval case."""
final_session_state: Optional[SessionState] = Field(default_factory=dict)
"""The expected final session state at the end of the conversation."""
@model_validator(mode="after")
def ensure_conversation_xor_conversation_scenario(self) -> EvalCase:
if (self.conversation is None) == (self.conversation_scenario is None):