diff --git a/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts b/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts index 081d846014c69..ce891e0cce0b3 100644 --- a/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts @@ -60,6 +60,13 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * document: { // DocumentBlock + * format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md", // required + * name: "STRING_VALUE", // required + * source: { // DocumentSource Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * }, + * }, * toolUse: { // ToolUseBlock * toolUseId: "STRING_VALUE", // required * name: "STRING_VALUE", // required @@ -77,6 +84,13 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * document: { + * format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md", // required + * name: "STRING_VALUE", // required + * source: {// Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * }, + * }, * }, * ], * status: "success" || "error", @@ -153,6 +167,13 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * // bytes: new Uint8Array(), * // }, * // }, + * // document: { // DocumentBlock + * // format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md", // required + * // name: "STRING_VALUE", // required + * // source: { // DocumentSource Union: only one key present + * // bytes: new Uint8Array(), + * // }, + * // }, * // toolUse: { // ToolUseBlock * // toolUseId: "STRING_VALUE", // required * // name: "STRING_VALUE", // required @@ -170,6 +191,13 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * // bytes: new Uint8Array(), * // }, * // }, + * // document: { + * // format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md", // required + * // name: "STRING_VALUE", // required + * // source: {// Union: only one key present + * // bytes: new Uint8Array(), + * // }, + * // }, * // }, * // ], * // status: "success" || "error", diff --git a/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts b/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts index 38abc842c97c8..f2f2c95994e88 100644 --- a/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts @@ -67,6 +67,13 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * document: { // DocumentBlock + * format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md", // required + * name: "STRING_VALUE", // required + * source: { // DocumentSource Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * }, + * }, * toolUse: { // ToolUseBlock * toolUseId: "STRING_VALUE", // required * name: "STRING_VALUE", // required @@ -84,6 +91,13 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * document: { + * format: "pdf" || "csv" || "doc" || "docx" || "xls" || "xlsx" || "html" || "txt" || "md", // required + * name: "STRING_VALUE", // required + * source: {// Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * }, + * }, * }, * ], * status: "success" || "error", diff --git a/clients/client-bedrock-runtime/src/models/models_0.ts b/clients/client-bedrock-runtime/src/models/models_0.ts index 0f0d3aacc3594..47a4952fbfcb1 100644 --- a/clients/client-bedrock-runtime/src/models/models_0.ts +++ b/clients/client-bedrock-runtime/src/models/models_0.ts @@ -111,6 +111,89 @@ export interface InferenceConfiguration { stopSequences?: string[]; } +/** + * @public + * @enum + */ +export const DocumentFormat = { + CSV: "csv", + DOC: "doc", + DOCX: "docx", + HTML: "html", + MD: "md", + PDF: "pdf", + TXT: "txt", + XLS: "xls", + XLSX: "xlsx", +} as const; + +/** + * @public + */ +export type DocumentFormat = (typeof DocumentFormat)[keyof typeof DocumentFormat]; + +/** + *
Contains the content of the document included in a message when sending a Converse or ConverseStream request or in the response.
+ * @public + */ +export type DocumentSource = DocumentSource.BytesMember | DocumentSource.$UnknownMember; + +/** + * @public + */ +export namespace DocumentSource { + /** + *A base64-encoded string of a UTF-8 encoded file, that is the document to include in the message.
+ * @public + */ + export interface BytesMember { + bytes: Uint8Array; + $unknown?: never; + } + + /** + * @public + */ + export interface $UnknownMember { + bytes?: never; + $unknown: [string, any]; + } + + export interface VisitorA document to include in a message when sending a Converse or ConverseStream request. You can include up to 5 documents in a request. The maximum document size is 50 MB.
+ * @public + */ +export interface DocumentBlock { + /** + *The format of a document, or its extension.
+ * @public + */ + format: DocumentFormat | undefined; + + /** + *A name for the document.
+ * @public + */ + name: string | undefined; + + /** + *Contains the content of the document.
+ * @public + */ + source: DocumentSource | undefined; +} + /** *A text block that contains text that you want to assess with a guardrail. For more information, see GuardrailConverseContentBlock.
* @public @@ -242,6 +325,7 @@ export interface ImageBlock { * @public */ export type ToolResultContentBlock = + | ToolResultContentBlock.DocumentMember | ToolResultContentBlock.ImageMember | ToolResultContentBlock.JsonMember | ToolResultContentBlock.TextMember @@ -259,6 +343,7 @@ export namespace ToolResultContentBlock { json: __DocumentType; text?: never; image?: never; + document?: never; $unknown?: never; } @@ -270,6 +355,7 @@ export namespace ToolResultContentBlock { json?: never; text: string; image?: never; + document?: never; $unknown?: never; } @@ -284,6 +370,19 @@ export namespace ToolResultContentBlock { json?: never; text?: never; image: ImageBlock; + document?: never; + $unknown?: never; + } + + /** + *A tool result that is a document.
+ * @public + */ + export interface DocumentMember { + json?: never; + text?: never; + image?: never; + document: DocumentBlock; $unknown?: never; } @@ -294,6 +393,7 @@ export namespace ToolResultContentBlock { json?: never; text?: never; image?: never; + document?: never; $unknown: [string, any]; } @@ -301,6 +401,7 @@ export namespace ToolResultContentBlock { json: (value: __DocumentType) => T; text: (value: string) => T; image: (value: ImageBlock) => T; + document: (value: DocumentBlock) => T; _: (name: string, value: any) => T; } @@ -308,6 +409,7 @@ export namespace ToolResultContentBlock { if (value.json !== undefined) return visitor.json(value.json); if (value.text !== undefined) return visitor.text(value.text); if (value.image !== undefined) return visitor.image(value.image); + if (value.document !== undefined) return visitor.document(value.document); return visitor._(value.$unknown[0], value.$unknown[1]); }; } @@ -384,6 +486,7 @@ export interface ToolUseBlock { * @public */ export type ContentBlock = + | ContentBlock.DocumentMember | ContentBlock.GuardContentMember | ContentBlock.ImageMember | ContentBlock.TextMember @@ -402,6 +505,7 @@ export namespace ContentBlock { export interface TextMember { text: string; image?: never; + document?: never; toolUse?: never; toolResult?: never; guardContent?: never; @@ -418,6 +522,21 @@ export namespace ContentBlock { export interface ImageMember { text?: never; image: ImageBlock; + document?: never; + toolUse?: never; + toolResult?: never; + guardContent?: never; + $unknown?: never; + } + + /** + *A document to include in the message.
+ * @public + */ + export interface DocumentMember { + text?: never; + image?: never; + document: DocumentBlock; toolUse?: never; toolResult?: never; guardContent?: never; @@ -431,6 +550,7 @@ export namespace ContentBlock { export interface ToolUseMember { text?: never; image?: never; + document?: never; toolUse: ToolUseBlock; toolResult?: never; guardContent?: never; @@ -444,6 +564,7 @@ export namespace ContentBlock { export interface ToolResultMember { text?: never; image?: never; + document?: never; toolUse?: never; toolResult: ToolResultBlock; guardContent?: never; @@ -462,6 +583,7 @@ export namespace ContentBlock { export interface GuardContentMember { text?: never; image?: never; + document?: never; toolUse?: never; toolResult?: never; guardContent: GuardrailConverseContentBlock; @@ -474,6 +596,7 @@ export namespace ContentBlock { export interface $UnknownMember { text?: never; image?: never; + document?: never; toolUse?: never; toolResult?: never; guardContent?: never; @@ -483,6 +606,7 @@ export namespace ContentBlock { export interface VisitorImage to include in the message.
\nThis field is only supported by Anthropic Claude 3 models.
\nA document to include in the message.
" + } + }, "toolUse": { "target": "com.amazonaws.bedrockruntime#ToolUseBlock", "traits": { @@ -1346,6 +1352,115 @@ "smithy.api#documentation": "The trace object in a response from Converse. Currently, you can only trace guardrails.
" } }, + "com.amazonaws.bedrockruntime#DocumentBlock": { + "type": "structure", + "members": { + "format": { + "target": "com.amazonaws.bedrockruntime#DocumentFormat", + "traits": { + "smithy.api#documentation": "The format of a document, or its extension.
", + "smithy.api#required": {} + } + }, + "name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "A name for the document.
", + "smithy.api#length": { + "min": 1, + "max": 64 + }, + "smithy.api#required": {} + } + }, + "source": { + "target": "com.amazonaws.bedrockruntime#DocumentSource", + "traits": { + "smithy.api#documentation": "Contains the content of the document.
", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "A document to include in a message when sending a Converse or ConverseStream request. You can include up to 5 documents in a request. The maximum document size is 50 MB.
" + } + }, + "com.amazonaws.bedrockruntime#DocumentFormat": { + "type": "enum", + "members": { + "PDF": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "pdf" + } + }, + "CSV": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "csv" + } + }, + "DOC": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "doc" + } + }, + "DOCX": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "docx" + } + }, + "XLS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "xls" + } + }, + "XLSX": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "xlsx" + } + }, + "HTML": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "html" + } + }, + "TXT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "txt" + } + }, + "MD": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "md" + } + } + } + }, + "com.amazonaws.bedrockruntime#DocumentSource": { + "type": "union", + "members": { + "bytes": { + "target": "smithy.api#Blob", + "traits": { + "smithy.api#documentation": "A base64-encoded string of a UTF-8 encoded file, that is the document to include in the message.
", + "smithy.api#length": { + "min": 1 + } + } + } + }, + "traits": { + "smithy.api#documentation": "Contains the content of the document included in a message when sending a Converse or ConverseStream request or in the response.
" + } + }, "com.amazonaws.bedrockruntime#GuardrailAssessment": { "type": "structure", "members": { @@ -3153,6 +3268,12 @@ "traits": { "smithy.api#documentation": "A tool result that is an image.
\nThis field is only supported by Anthropic Claude 3 models.
\nA tool result that is a document.
" + } } }, "traits": {