v1
latestOpenAPI 3.0.22026-07-173834119.9 KBModel Invocation
Async Invoke Model Endpoint
Endpoint to Invoke a Model on Bedrock Asynchronously
This endpoint allows users to invoke a model on Bedrock asynchronously using either a simple text prompt or a series of messages. It returns an invocation ID that can be used to retrieve the result later.
Request Body
| Parameter | Type | Description |
|---|---|---|
| model_name | str | The name of the model to invoke. Must be one of the supported models. |
| prompt | str | A simple text prompt (str) or a list of messages (see below for message format). |
| max_tokens | Optional[int] | The maximum number of tokens to generate in the response. |
| temperature | Optional[float] | Sampling temperature to use. Higher values make the output more random. |
| top_p | Optional[float] | Probability threshold for nucleus sampling. |
| top_k | Optional[int] | The number of highest probability vocabulary tokens to keep for top-k filtering. |
| stop_sequences | Optional[List[str]] | Sequences where the generation will stop. |
Example:
{
"model_name": "example_model",
"prompt": "Translate the following text to French: 'Hello, how are you?'",
"max_tokens": 100,
"temperature": 0.7,
"top_p": 0.9,
"top_k": 50,
"stop_sequences": ["\n"]
}
Response Body
| Field | Type | Description |
|---|---|---|
| invocation_id | str | The ID of the asynchronous invocation. |
Errors
- 400 Bad Request: If the request parameters are invalid.
- 500 Internal Server Error: If there is an unexpected error during model invocation.
post/model/async_invoke
Request body
Example request
{
"system_prompts": [
{
"text": "You are a helpful assistant."
}
]
}Response
Successful Response
{"stackTrail":"paths:/model/async_invoke:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}