chat method
Starts a new chat, optionally attaching via snapshotId / sessionId /
state (provide at most one).
Implementation
AgentChat<State> chat({
String? snapshotId,
String? sessionId,
SessionState? state,
}) {
assert(
[snapshotId, sessionId, state].where((x) => x != null).length <= 1,
'Provide at most one of snapshotId, sessionId, or state.',
);
if (snapshotId == null && sessionId == null && state == null) {
return AgentChat<State>._(_transport, null, _stateSchema);
}
return AgentChat<State>._(
_transport,
AgentInit(snapshotId: snapshotId, sessionId: sessionId, state: state),
_stateSchema,
);
}