-
Notifications
You must be signed in to change notification settings - Fork 116
feat(ai-gateway): Sagemaker support #6521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/ai-gateway-2.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ## Authentication with AWS | ||
|
|
||
| For {{ provider.name }}, you can also set `auth` to `aws`. Provide static IAM user credentials with `access_key_id` and `secret_access_key`, or omit them to fall back to the default AWS credentials provider chain (EC2 instance profiles, environment variables, and so on). For cross-account access, assume a role with `assume_role_arn` and `role_session_name`. | ||
|
|
||
| See [Outbound authentication](/ai-gateway/entities/ai-model-provider/#outbound-authentication) on the AI Model Provider entity page for the full list of `auth` fields, including `sts_endpoint_url` and the Bedrock-specific `batch_role_arn`. | ||
|
|
||
| {:.info} | ||
| > **AWS Session tokens** | ||
| > | ||
| > There's no dedicated field for an AWS session token. | ||
| > For temporary credentials, set `config.auth.assume_role_arn` and `config.auth.role_session_name` to assume a role through AWS STS, or leave `config.auth.access_key_id` and `config.auth.secret_access_key` unset to fall back to environment variables or an instance or task IAM role. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ products: | |
| tools: | ||
| - konnect-api | ||
| - kongctl | ||
| - kongctl | ||
|
|
||
| tags: | ||
| - ai | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| --- | ||
| title: "Amazon SageMaker provider" | ||
| layout: reference | ||
| content_type: reference | ||
| description: Reference for supported capabilities for Amazon SageMaker provider | ||
| breadcrumbs: | ||
| - /ai-gateway/ | ||
| - /ai-gateway/ai-providers/ | ||
|
|
||
| permalink: /ai-gateway/ai-providers/sagemaker/ | ||
|
|
||
| works_on: | ||
| - konnect | ||
|
|
||
| products: | ||
| - ai-gateway | ||
|
|
||
| tools: | ||
| - konnect-api | ||
| - kongctl | ||
|
|
||
| tags: | ||
| - ai | ||
|
|
||
| min_version: | ||
| ai-gateway: '2.0' | ||
|
|
||
| related_resources: | ||
| - text: "{{site.ai_gateway}}" | ||
| url: /ai-gateway/ | ||
| - text: "{{site.ai_gateway}} Policies" | ||
| url: /ai-gateway/policies/ | ||
| - text: AI Providers | ||
| url: /ai-gateway/ai-providers/ | ||
| - text: AI Model Provider entity | ||
| url: /ai-gateway/entities/ai-model-provider/ | ||
| - text: AI Model entity | ||
| url: /ai-gateway/entities/ai-model/ | ||
|
|
||
| --- | ||
|
|
||
|
|
||
| {% include md/ai-gateway/v2/providers.md providers=site.data.ai-gateway.v2.providers provider_name="Amazon SageMaker" %} | ||
|
|
||
| {% include md/ai-gateway/v2/native-routes.md providers=site.data.ai-gateway.v2.providers provider_name="Amazon SageMaker" %} | ||
|
|
||
| ## Configure {{ provider.name }} | ||
|
|
||
| To use {{ provider.name }} with {{site.ai_gateway}}, configure a new [AI Model Provider](/ai-gateway/entities/ai-model-provider/). You can then access supported [AI Models](/ai-gateway/entities/ai-model/) from {{ provider.name }}. | ||
|
|
||
| Here's a minimal configuration for chat completions: | ||
|
|
||
| {% entity_example %} | ||
| type: model-provider | ||
| data: | ||
| display_name: SageMaker Production | ||
| name: my-sagemaker-account | ||
| type: sagemaker | ||
| config: | ||
| auth: | ||
| type: sagemaker | ||
| aws: | ||
| access_key_id: ${key_id} | ||
| secret_access_key: ${access_key} | ||
| variables: | ||
| key_id: | ||
| value: $AWS_ACCESS_KEY_ID | ||
| description: Your AWS access key ID. | ||
| access_key: | ||
| value: $AWS_SECRET_ACCESS_KEY | ||
| description: Your AWS secret access key. | ||
| {% endentity_example %} | ||
|
Comment on lines
+53
to
+72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if this is expected, but I tried testing this with 2.0.1-rc.4 and kongctl 1.9.0 and it's not accepting aws as the type or the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll fix it, the correct type is sagemker + I don't think kongctl supports it for now |
||
|
|
||
| ## Authentication with AWS | ||
|
|
||
| For {{ provider.name }}, set `auth` to `sagemaker` and provide static IAM user credentials under `aws`, or omit them to fall back to the default AWS credentials provider chain (EC2 instance profiles, environment variables, and so on): | ||
|
|
||
| * **`access_key_id`** (optional): AWS access key ID for static IAM user credentials. Overrides the `AWS_ACCESS_KEY_ID` environment variable. | ||
| * **`secret_access_key`** (optional): AWS secret access key paired with `access_key_id`. Overrides the `AWS_SECRET_ACCESS_KEY` environment variable. | ||
| * **`session_token`** (optional): AWS session token for temporary credentials. Overrides the `AWS_SESSION_TOKEN` environment variable. | ||
|
|
||
| {{ provider.name }} can also use `basic` auth instead. See [Outbound authentication](/ai-gateway/entities/ai-model-provider/#outbound-authentication) on the AI Model Provider entity page for the full list of `auth` types. | ||
|
|
||
| ## Configure a model target for {{ provider.name }} | ||
|
|
||
| Only the `generate` capability is supported for {{ provider.name }} targets. | ||
|
|
||
| A [target](/ai-gateway/entities/ai-model/#targets) is an entry in the `targets` array on the AI Model entity, not the AI Model Provider. The target `name` is the name of your SageMaker endpoint. Beyond the common target options (`name`, `provider`, `weight`), a target routing to {{ provider.name }} supports these `config` fields, grouped under `aws` and `target`: | ||
|
|
||
| {% table %} | ||
| columns: | ||
| - title: Field | ||
| key: field | ||
| - title: Description | ||
| key: description | ||
| rows: | ||
| - field: "`aws.region`" | ||
| description: "The AWS region hosting the SageMaker endpoint. Overrides the `AWS_REGION` environment variable." | ||
| - field: "`aws.assume_role_arn`" | ||
| description: "IAM role ARN to assume for temporary credentials. Requires `aws.role_session_name`." | ||
| - field: "`aws.role_session_name`" | ||
| description: "Session name for the assumed role. Required if `aws.assume_role_arn` is set." | ||
| - field: "`aws.sts_endpoint_url`" | ||
| description: "Custom STS endpoint used when assuming a role." | ||
| - field: "`target.model`" | ||
| description: "The model artifact to invoke on a multi-model endpoint. Sets the `X-Amzn-SageMaker-Target-Model` header." | ||
| - field: "`target.variant`" | ||
| description: "The production variant to invoke on a multi-variant endpoint. Sets the `X-Amzn-SageMaker-Target-Variant` header." | ||
| - field: "`target.container_hostname`" | ||
| description: "The container hostname to invoke on a multi-container endpoint. Sets the `X-Amzn-SageMaker-Target-Container-Hostname` header." | ||
| {% endtable %} | ||
|
|
||
| All fields in this table are optional. | ||
|
|
||
| ```yaml | ||
| targets: | ||
| - name: my-sagemaker-endpoint | ||
| provider: my-sagemaker-account | ||
| config: | ||
| type: sagemaker | ||
| aws: | ||
| region: us-east-1 | ||
| target: | ||
| model: my-model.tar.gz | ||
| variant: production-variant-1 | ||
| container_hostname: container-1 | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate?