[ aws . sagemaker-gateway-runtime ]

invoke-global-inference-gateway

Description

Buffered (non-streaming) inference. Returns the full OpenAI completion body.

Errors carry their origin in the Message prefix. Every typed error’s text is in the Message member (JSON key Message ), and starts with one of these prefixes:

  • Global Inference Gateway: – the gateway rejected or failed the request itself: validation, authorization, throttling, routing (the gateway or model was not found, or no capacity is available), a gateway limit or time limit, or failing to reach the inference gateway (Global Inference Gateway: could not reach the inference gateway: <reason> , or Global Inference Gateway: timed out waiting for the inference gateway ). This includes the 400 for an invalid request and the 413 for a request body that is too large.
  • inference gateway: – the inference gateway serving the model returned an error status. The message gives that status code and up to 256 bytes of its error message, for example inference gateway: 503 <message> . A BadGatewayException can instead read inference gateway: response ended unexpectedly , with no status, when the inference gateway’s connection failed while it was sending the response.
  • inference gateway (<component>): – the same, when the inference gateway reports which of its components produced the error, for example inference gateway (model server): 502 <message> . The component is one of:
    • config – the inference gateway’s configuration and proxy layer.
    • scheduler – the inference gateway’s request scheduler.
    • model selector – the inference gateway’s model selector.
    • model server – the model server.

Every error status the inference gateway returns is a typed error, chosen by that status:

  • 400 and any other 4xx not listed here – a 400 validation error.
  • 401 and 403 – AccessDeniedException (403).
  • 404 – ResourceNotFoundException.
  • 408 – GatewayTimeoutException (504).
  • 429 – ThrottlingException, with the Retry-After header.
  • 502, and 500, 503 or any other 5xx not listed here – BadGatewayException (502). A 500 or 503 from the inference gateway comes after the request was dispatched, so it is not modeled as retryable, and the gateway may already have tried another inference gateway. Standard SDK retry modes may still retry a 5xx status; set max attempts to 1 if a repeated inference is unacceptable.
  • 504 – GatewayTimeoutException.

See also: AWS API Documentation

Synopsis

  invoke-global-inference-gateway
--gateway-id <value>
[--accept <value>]
--content-type <value>
[--customer-identity-token <value>]
--body <value>
<outfile>
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]

Options

--gateway-id (string) [required]

The ID of the Global Inference Gateway to invoke. IAM policies refer to the gateway by its ARN, arn:<partition>:sagemaker:<region>:<account>:global-inference-gateway/<id> .

Constraints:

  • min: 1
  • max: 64
  • pattern: [a-z0-9]+

--accept (string)

The MIME type you want for the response. It is passed to the model server.

--content-type (string) [required]

The MIME type of the request body. Pass application/json (parameters such as charset=utf-8 are allowed): the body is one OpenAI JSON object. The Global Inference Gateway rejects other content types with a 415 error.

Constraints:

  • min: 1
  • max: 1024

--customer-identity-token (string)

Per-caller customer identity token (a JWT), forwarded unchanged to the inference gateway, which validates it. The gateway does not use it to authorize the request. Include it in the SigV4 signed headers so it cannot be altered in transit. Redacted from logs, metrics and traces.

--body (blob) [required]

The inference request body: one OpenAI JSON object, at most 10 MiB. Its content is passed to the model server unchanged, except that the request is always sent with "stream": false : this operation returns one JSON document, so a "stream": true in the body is overridden (use InvokeGlobalInferenceGatewayWithResponseStream to stream). A body that is not one JSON object, or that repeats the top-level model key with different values, is rejected with a 400 validation error. A body larger than 10 MiB is rejected with PayloadTooLargeException (413). The gateway reads only model and stream , and does not store the body.

Constraints:

  • min: 0
  • max: 10485760

outfile (string) [required] Filename where the content will be saved

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command’s default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

--output (string)

The formatting style for command output.

  • json
  • text
  • table
  • yaml
  • yaml-stream
  • off

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

--cli-binary-format (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.

  • base64
  • raw-in-base64-out

--no-cli-pager (boolean)

Disable cli pager for output.

--cli-auto-prompt (boolean)

Automatically prompt for CLI input parameters.

--no-cli-auto-prompt (boolean)

Disable automatically prompt for CLI input parameters.

--cli-error-format (string)

The formatting style for error output. By default, errors are displayed in enhanced format.

  • legacy
  • json
  • yaml
  • text
  • table
  • enhanced

--help (boolean)

Display help for the command/subcommand.

Output

Body -> (blob)

The model server’s OpenAI completion JSON, returned unchanged. A response larger than 10 MiB fails with BadGatewayException (502).

Constraints:

  • min: 0
  • max: 10485760