chat¶
Operation¶
Async only
This operation uses an event stream, so only the asynchronous client supports it.
chat
async
¶
chat(request: ChatInput | ChatInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[ChatInputDict]) -> AsyncDuplexEventStream[ChatInputStream, ChatOutputStream, ChatOutput]
Starts or continues a streaming Amazon Q Business conversation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
ChatInput | ChatInputDict | None
|
The input as a model or dictionary. Pass this or keyword arguments, not both. |
None
|
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
**kwargs
|
Unpack[ChatInputDict]
|
The input fields as keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
AsyncDuplexEventStream[ChatInputStream, ChatOutputStream, ChatOutput]
|
An |
Input¶
Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.
ChatInputDict
¶
Bases: TypedDict
Dictionary form of ChatInput.
Attributes¶
application_id
instance-attribute
¶
The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.
client_token
instance-attribute
¶
client_token: str | None
A token that you provide to identify the chat input.
This field is autopopulated if not provided.
conversation_id
instance-attribute
¶
conversation_id: str | None
The identifier of the Amazon Q Business conversation.
parent_message_id
instance-attribute
¶
parent_message_id: str | None
The identifier used to associate a user message with a AI generated response.
user_groups
instance-attribute
¶
The group names that a user associated with the chat input belongs to.
ChatInput
dataclass
¶
Bases: _SerdeShape
Dataclass for ChatInput structure.
Attributes¶
application_id
class-attribute
instance-attribute
¶
application_id: str | None = ...
The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.
client_token
class-attribute
instance-attribute
¶
client_token: str | None = ...
A token that you provide to identify the chat input.
This field is autopopulated if not provided.
conversation_id
class-attribute
instance-attribute
¶
conversation_id: str | None = ...
The identifier of the Amazon Q Business conversation.
parent_message_id
class-attribute
instance-attribute
¶
parent_message_id: str | None = ...
The identifier used to associate a user message with a AI generated response.
user_groups
class-attribute
instance-attribute
¶
The group names that a user associated with the chat input belongs to.
Output¶
This operation returns an AsyncDuplexEventStream for bidirectional streaming.
Event Stream Structure¶
Input Event Type¶
Output Event Type¶
Initial Response Structure¶
ChatOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for ChatOutput structure.