invoke_model_with_bidirectional_stream¶
Operation¶
invoke_model_with_bidirectional_stream
async
¶
invoke_model_with_bidirectional_stream(input: InvokeModelWithBidirectionalStreamOperationInput, plugins: list[Plugin] | None = None) -> DuplexEventStream[InvokeModelWithBidirectionalStreamInput, InvokeModelWithBidirectionalStreamOutput, InvokeModelWithBidirectionalStreamOperationOutput]
Invoke the specified Amazon Bedrock model to run inference using the bidirectional stream. The response is returned in a stream that remains open for 8 minutes. A single session can contain multiple prompts and responses from the model. The prompts to the model are provided as audio files and the model's responses are spoken back to the user and transcribed.
It is possible for users to interrupt the model's response with a new prompt, which will halt the response speech. The model will retain contextual awareness of the conversation while pivoting to respond to the new prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
InvokeModelWithBidirectionalStreamOperationInput
|
An instance of |
required |
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
|
Returns:
| Type | Description |
|---|---|
DuplexEventStream[InvokeModelWithBidirectionalStreamInput, InvokeModelWithBidirectionalStreamOutput, InvokeModelWithBidirectionalStreamOperationOutput]
|
A |
Source code in src/aws_sdk_bedrock_runtime/client.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | |
Input¶
InvokeModelWithBidirectionalStreamOperationInput
dataclass
¶
Dataclass for InvokeModelWithBidirectionalStreamOperationInput structure.
Source code in src/aws_sdk_bedrock_runtime/models.py
12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 | |
Output¶
This operation returns a DuplexEventStream for bidirectional streaming.
Event Stream Structure¶
Input Event Type¶
InvokeModelWithBidirectionalStreamInput
Output Event Type¶
InvokeModelWithBidirectionalStreamOutput
Initial Response Structure¶
InvokeModelWithBidirectionalStreamOperationOutput
dataclass
¶
Dataclass for InvokeModelWithBidirectionalStreamOperationOutput structure.
Source code in src/aws_sdk_bedrock_runtime/models.py
13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 | |