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.
Container for the parameters to the InvokeModel operation. Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. You use model inference to generate text, images, and embeddings.
For example code, see Invoke model code examples in the Amazon Bedrock User Guide.
This operation requires permission for the bedrock:InvokeModel
action.
To deny all inference access to resources that you specify in the modelId field, you
need to deny access to the bedrock:InvokeModel
and bedrock:InvokeModelWithResponseStream
actions. Doing this also denies access to the resource through the Converse API actions
(Converse
and ConverseStream).
For more information see Deny
access for inference on specific models.
For troubleshooting some of the common errors you might encounter when using the InvokeModel
API, see Troubleshooting
Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide
Namespace: Amazon.BedrockRuntime.Model
Assembly: AWSSDK.BedrockRuntime.dll
Version: 3.x.y.z
public class InvokeModelRequest : AmazonBedrockRuntimeRequest IAmazonWebServiceRequest
The InvokeModelRequest type exposes the following members
Name | Description | |
---|---|---|
InvokeModelRequest() |
Name | Type | Description | |
---|---|---|---|
Accept | System.String |
Gets and sets the property Accept.
The desired MIME type of the inference body in the response. The default value is
|
|
Body | System.IO.MemoryStream |
Gets and sets the property Body.
The prompt and inference parameters in the format specified in the |
|
ContentType | System.String |
Gets and sets the property ContentType.
The MIME type of the input data in the request. You must specify |
|
GuardrailIdentifier | System.String |
Gets and sets the property GuardrailIdentifier. The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation. An error will be thrown in the following situations.
|
|
GuardrailVersion | System.String |
Gets and sets the property GuardrailVersion.
The version number for the guardrail. The value can also be |
|
ModelId | System.String |
Gets and sets the property ModelId. The unique identifier of the model to invoke to run inference.
The
|
|
PerformanceConfigLatency | Amazon.BedrockRuntime.PerformanceConfigLatency |
Gets and sets the property PerformanceConfigLatency. Model performance settings for the request. |
|
Trace | Amazon.BedrockRuntime.Trace |
Gets and sets the property Trace. Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace. |
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5