Skip to content

Commit

Permalink
feat(client-bedrock-runtime): Added support for Intelligent Prompt Ro…
Browse files Browse the repository at this point in the history
…uter in Invoke, InvokeStream, Converse and ConverseStream. Add support for Bedrock Guardrails image content filter. New Bedrock Marketplace feature enabling a wider range of bedrock compatible models with self-hosted capability.
  • Loading branch information
awstools committed Dec 4, 2024
1 parent 728fa5a commit 8b3d71d
Show file tree
Hide file tree
Showing 6 changed files with 751 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { ApplyGuardrailRequest, ApplyGuardrailResponse } from "../models/models_0";
import {
ApplyGuardrailRequest,
ApplyGuardrailRequestFilterSensitiveLog,
ApplyGuardrailResponse,
} from "../models/models_0";
import { de_ApplyGuardrailCommand, se_ApplyGuardrailCommand } from "../protocols/Aws_restJson1";

/**
Expand Down Expand Up @@ -49,6 +53,12 @@ export interface ApplyGuardrailCommandOutput extends ApplyGuardrailResponse, __M
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: { // GuardrailImageBlock
* format: "png" || "jpeg", // required
* source: { // GuardrailImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* ],
* };
Expand Down Expand Up @@ -147,6 +157,10 @@ export interface ApplyGuardrailCommandOutput extends ApplyGuardrailResponse, __M
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: { // GuardrailImageCoverage
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // },
Expand All @@ -156,6 +170,10 @@ export interface ApplyGuardrailCommandOutput extends ApplyGuardrailResponse, __M
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: {
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // };
*
Expand Down Expand Up @@ -212,7 +230,7 @@ export class ApplyGuardrailCommand extends $Command
})
.s("AmazonBedrockFrontendService", "ApplyGuardrail", {})
.n("BedrockRuntimeClient", "ApplyGuardrailCommand")
.f(void 0, void 0)
.f(ApplyGuardrailRequestFilterSensitiveLog, void 0)
.ser(se_ApplyGuardrailCommand)
.de(de_ApplyGuardrailCommand)
.build() {
Expand Down
38 changes: 36 additions & 2 deletions clients/client-bedrock-runtime/src/commands/ConverseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { ConverseRequest, ConverseRequestFilterSensitiveLog, ConverseResponse } from "../models/models_0";
import {
ConverseRequest,
ConverseRequestFilterSensitiveLog,
ConverseResponse,
ConverseResponseFilterSensitiveLog,
} from "../models/models_0";
import { de_ConverseCommand, se_ConverseCommand } from "../protocols/Aws_restJson1";

/**
Expand Down Expand Up @@ -134,6 +139,12 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: { // GuardrailConverseImageBlock
* format: "png" || "jpeg", // required
* source: { // GuardrailConverseImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* },
* ],
Expand All @@ -149,6 +160,12 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: {
* format: "png" || "jpeg", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* },
* ],
Expand Down Expand Up @@ -278,6 +295,12 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare
* // "grounding_source" || "query" || "guard_content",
* // ],
* // },
* // image: { // GuardrailConverseImageBlock
* // format: "png" || "jpeg", // required
* // source: { // GuardrailConverseImageSource Union: only one key present
* // bytes: new Uint8Array(),
* // },
* // },
* // },
* // },
* // ],
Expand Down Expand Up @@ -376,6 +399,10 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: { // GuardrailImageCoverage
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // },
Expand Down Expand Up @@ -459,12 +486,19 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: {
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // },
* // ],
* // },
* // },
* // promptRouter: { // PromptRouterTrace
* // invokedModelId: "STRING_VALUE",
* // },
* // },
* // performanceConfig: { // PerformanceConfiguration
* // latency: "standard" || "optimized",
Expand Down Expand Up @@ -537,7 +571,7 @@ export class ConverseCommand extends $Command
})
.s("AmazonBedrockFrontendService", "Converse", {})
.n("BedrockRuntimeClient", "ConverseCommand")
.f(ConverseRequestFilterSensitiveLog, void 0)
.f(ConverseRequestFilterSensitiveLog, ConverseResponseFilterSensitiveLog)
.ser(se_ConverseCommand)
.de(de_ConverseCommand)
.build() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: { // GuardrailConverseImageBlock
* format: "png" || "jpeg", // required
* source: { // GuardrailConverseImageSource Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* },
* ],
Expand All @@ -160,6 +166,12 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M
* "grounding_source" || "query" || "guard_content",
* ],
* },
* image: {
* format: "png" || "jpeg", // required
* source: {// Union: only one key present
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* },
* },
* },
* ],
Expand Down Expand Up @@ -337,6 +349,10 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: { // GuardrailImageCoverage
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // },
Expand Down Expand Up @@ -420,12 +436,19 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // images: {
* // guarded: Number("int"),
* // total: Number("int"),
* // },
* // },
* // },
* // },
* // ],
* // },
* // },
* // promptRouter: { // PromptRouterTrace
* // invokedModelId: "STRING_VALUE",
* // },
* // },
* // performanceConfig: { // PerformanceConfiguration
* // latency: "standard" || "optimized",
Expand Down
Loading

0 comments on commit 8b3d71d

Please sign in to comment.