Assurance / Client / chat
chat¶
- Assurance.Client.chat(**kwargs)¶
Starts a streaming chat turn with the AWS Assurance agent. Returns an event stream of chat events, including chunks, tool calls, and errors.
See also: AWS API Documentation
Request Syntax
response = client.chat( message='string', sessionId='string', environmentArn='string', expectedSequenceNumber=123 )
- Parameters:
message (string) –
[REQUIRED]
The chat message to send to the AWS Assurance agent.
sessionId (string) – The session to continue. Pass the
sessionIdreturned by a previousChatcall to continue that session. If you omit it, AWS Assurance starts a new session. If the session doesn’t exist or has expired, the operation returnsResourceNotFoundException. If the format isn’t valid, the operation returnsValidationException.environmentArn (string) –
[REQUIRED]
The ARN of this governance environment.
expectedSequenceNumber (integer) – The sequence number of the last message you received. If the service detects a more recent sequence number, the request fails with
ConflictException, indicating a concurrent update.
- Return type:
dict
- Returns:
The response of this operation contains an
EventStreammember. When iterated theEventStreamwill yield events based on the structure below, where only one of the top level keys will be present for any given event.Response Syntax
{ 'eventStream': EventStream({ 'chunk': { 'message': 'string' }, 'toolCall': { 'message': 'string', 'eventDescription': 'string' }, 'response': {}, 'error': { 'message': 'string' } }), 'sessionId': 'string', 'sequenceNumber': 123 }
Response Structure
(dict) –
eventStream (
EventStream) –The stream of chat events returned by the agent.
chunk (dict) –
A partial streamed text chunk of the assistant response.
message (string) –
The chunk text content.
toolCall (dict) –
An event indicating the agent invoked a tool.
message (string) –
The tool call message content.
eventDescription (string) –
A human-readable description of the tool invocation.
response (dict) –
An event marking the end of the assistant response. Receiving this event confirms that the stream completed successfully rather than being dropped.
error (dict) –
An error event in the stream. The stream carries this event when an error occurs after the response has started; otherwise the operation returns a standard exception.
message (string) –
The error message text.
sessionId (string) –
The ID of the session. If you omitted
sessionIdin the request, use this value to continue the session in subsequent calls.sequenceNumber (integer) –
The updated sequence number for this session. Pass this value as
expectedSequenceNumberon your next call.
Exceptions
Assurance.Client.exceptions.ServiceQuotaExceededExceptionAssurance.Client.exceptions.ConflictExceptionAssurance.Client.exceptions.ValidationExceptionAssurance.Client.exceptions.InternalServerExceptionAssurance.Client.exceptions.ThrottlingExceptionAssurance.Client.exceptions.AccessDeniedExceptionAssurance.Client.exceptions.ResourceNotFoundException