AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Invoke the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. The response is returned in a stream.

To see if a model supports streaming, call GetFoundationModel and check the responseStreamingSupported field in the response.

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeModelWithResponseStream.

For example code, see Invoke model with streaming code example in the Amazon Bedrock User Guide.

This operation requires permissions to perform the bedrock:InvokeModelWithResponseStream action.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to InvokeModelWithResponseStreamAsync.

Namespace: Amazon.BedrockRuntime
Assembly: AWSSDK.BedrockRuntime.dll
Version: 3.x.y.z

Syntax

C#
public virtual InvokeModelWithResponseStreamResponse InvokeModelWithResponseStream(
         InvokeModelWithResponseStreamRequest request
)

Parameters

request
Type: Amazon.BedrockRuntime.Model.InvokeModelWithResponseStreamRequest

Container for the necessary parameters to execute the InvokeModelWithResponseStream service method.

Return Value


The response from the InvokeModelWithResponseStream service method, as returned by BedrockRuntime.

Exceptions

ExceptionCondition
AccessDeniedException The request is denied because of missing access permissions.
InternalServerException An internal server error occurred. Retry your request.
ModelErrorException The request failed due to an error while processing the model.
ModelNotReadyException The model specified in the request is not ready to serve inference requests.
ModelStreamErrorException An error occurred while streaming the response. Retry your request.
ModelTimeoutException The request took too long to process. Processing time exceeded the model timeout length.
ResourceNotFoundException The specified resource ARN was not found. Check the ARN and try your request again.
ServiceQuotaExceededException Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.
ServiceUnavailableException The service isn't currently available. Try again later.
ThrottlingException Your request was throttled because of service-wide limitations. Resubmit your request later or in a different region. You can also purchase Provisioned Throughput to increase the rate or number of tokens you can process.
ValidationException Input validation failed. Check your request parameters and retry the request.

Version Information

.NET Framework:
Supported in: 4.5 and newer, 3.5

See Also