2023/10/02 - Amazon Bedrock Runtime - 1 updated api methods
Changes Provisioned throughput feature with Amazon and third-party base models, and update validators for model identifier and taggable resource ARNs.
{'body': {'modelTimeoutException': {'message': 'string'}}}
Invoke the specified Bedrock model to run inference using the input provided. Return the response in a stream.
For more information, see Run inference in the Bedrock User Guide.
For an example request and response, see Examples (after the Errors section).
See also: AWS API Documentation
Request Syntax
client.invoke_model_with_response_stream( accept='string', body=b'bytes'|file, contentType='string', modelId='string' )
string
The desired MIME type of the inference body in the response. The default value is application/json .
bytes or seekable file-like object
[REQUIRED]
Inference input in the format specified by the content-type. To see the format and content of this field for different models, refer to Inference parameters .
string
The MIME type of the input data in the request. The default value is application/json .
string
[REQUIRED]
Id of the model to invoke using the streaming request.
dict
The response of this operation contains an :class:`.EventStream` member. When iterated the :class:`.EventStream` will yield events based on the structure below, where only one of the top level keys will be present for any given event.
Response Syntax
{ 'body': EventStream({ 'chunk': { 'bytes': b'bytes' }, 'internalServerException': { 'message': 'string' }, 'modelStreamErrorException': { 'message': 'string', 'originalMessage': 'string', 'originalStatusCode': 123 }, 'modelTimeoutException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'validationException': { 'message': 'string' } }), 'contentType': 'string' }
Response Structure
(dict) --
body (:class:`.EventStream`) --
Inference response from the model in the format specified by Content-Type. To see the format and content of this field for different models, refer to Inference parameters .
chunk (dict) --
Content included in the response.
bytes (bytes) --
Base64-encoded bytes of payload data.
internalServerException (dict) --
An internal server error occurred. Retry your request.
message (string) --
modelStreamErrorException (dict) --
An error occurred while streaming the response.
message (string) --
originalMessage (string) --
The original message.
originalStatusCode (integer) --
The original status code.
modelTimeoutException (dict) --
The request took too long to process. Processing time exceeded the model timeout length.
message (string) --
throttlingException (dict) --
The number of requests exceeds the limit. Resubmit your request later.
message (string) --
validationException (dict) --
Input validation failed. Check your request parameters and retry the request.
message (string) --
contentType (string) --
The MIME type of the inference result.