Skip to content

Commit aabc7a5

Browse files
author
awstools
committed
feat(client-qbusiness): Amazon Q Business now supports the GetDocumentContent() API that enables customers to securely access the source documents through clickable citation links at query time
1 parent 9b2c5e6 commit aabc7a5

File tree

13 files changed

+427
-4
lines changed

13 files changed

+427
-4
lines changed

clients/client-qbusiness/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,14 @@ GetDataSource
498498

499499
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/qbusiness/command/GetDataSourceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-qbusiness/Interface/GetDataSourceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-qbusiness/Interface/GetDataSourceCommandOutput/)
500500

501+
</details>
502+
<details>
503+
<summary>
504+
GetDocumentContent
505+
</summary>
506+
507+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/qbusiness/command/GetDocumentContentCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-qbusiness/Interface/GetDocumentContentCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-qbusiness/Interface/GetDocumentContentCommandOutput/)
508+
501509
</details>
502510
<details>
503511
<summary>

clients/client-qbusiness/src/QBusiness.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ import {
159159
GetDataSourceCommandInput,
160160
GetDataSourceCommandOutput,
161161
} from "./commands/GetDataSourceCommand";
162+
import {
163+
GetDocumentContentCommand,
164+
GetDocumentContentCommandInput,
165+
GetDocumentContentCommandOutput,
166+
} from "./commands/GetDocumentContentCommand";
162167
import { GetGroupCommand, GetGroupCommandInput, GetGroupCommandOutput } from "./commands/GetGroupCommand";
163168
import { GetIndexCommand, GetIndexCommandInput, GetIndexCommandOutput } from "./commands/GetIndexCommand";
164169
import { GetMediaCommand, GetMediaCommandInput, GetMediaCommandOutput } from "./commands/GetMediaCommand";
@@ -368,6 +373,7 @@ const commands = {
368373
GetChatResponseConfigurationCommand,
369374
GetDataAccessorCommand,
370375
GetDataSourceCommand,
376+
GetDocumentContentCommand,
371377
GetGroupCommand,
372378
GetIndexCommand,
373379
GetMediaCommand,
@@ -969,6 +975,23 @@ export interface QBusiness {
969975
cb: (err: any, data?: GetDataSourceCommandOutput) => void
970976
): void;
971977

978+
/**
979+
* @see {@link GetDocumentContentCommand}
980+
*/
981+
getDocumentContent(
982+
args: GetDocumentContentCommandInput,
983+
options?: __HttpHandlerOptions
984+
): Promise<GetDocumentContentCommandOutput>;
985+
getDocumentContent(
986+
args: GetDocumentContentCommandInput,
987+
cb: (err: any, data?: GetDocumentContentCommandOutput) => void
988+
): void;
989+
getDocumentContent(
990+
args: GetDocumentContentCommandInput,
991+
options: __HttpHandlerOptions,
992+
cb: (err: any, data?: GetDocumentContentCommandOutput) => void
993+
): void;
994+
972995
/**
973996
* @see {@link GetGroupCommand}
974997
*/

clients/client-qbusiness/src/QBusinessClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ import {
138138
} from "./commands/GetChatResponseConfigurationCommand";
139139
import { GetDataAccessorCommandInput, GetDataAccessorCommandOutput } from "./commands/GetDataAccessorCommand";
140140
import { GetDataSourceCommandInput, GetDataSourceCommandOutput } from "./commands/GetDataSourceCommand";
141+
import { GetDocumentContentCommandInput, GetDocumentContentCommandOutput } from "./commands/GetDocumentContentCommand";
141142
import { GetGroupCommandInput, GetGroupCommandOutput } from "./commands/GetGroupCommand";
142143
import { GetIndexCommandInput, GetIndexCommandOutput } from "./commands/GetIndexCommand";
143144
import { GetMediaCommandInput, GetMediaCommandOutput } from "./commands/GetMediaCommand";
@@ -268,6 +269,7 @@ export type ServiceInputTypes =
268269
| GetChatResponseConfigurationCommandInput
269270
| GetDataAccessorCommandInput
270271
| GetDataSourceCommandInput
272+
| GetDocumentContentCommandInput
271273
| GetGroupCommandInput
272274
| GetIndexCommandInput
273275
| GetMediaCommandInput
@@ -355,6 +357,7 @@ export type ServiceOutputTypes =
355357
| GetChatResponseConfigurationCommandOutput
356358
| GetDataAccessorCommandOutput
357359
| GetDataSourceCommandOutput
360+
| GetDocumentContentCommandOutput
358361
| GetGroupCommandOutput
359362
| GetIndexCommandOutput
360363
| GetMediaCommandOutput

clients/client-qbusiness/src/commands/ChatCommand.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ export interface ChatCommandOutput extends ChatOutput, __MetadataBearer {}
221221
* // },
222222
* // },
223223
* // ],
224+
* // documentId: "STRING_VALUE",
225+
* // indexId: "STRING_VALUE",
226+
* // datasourceId: "STRING_VALUE",
224227
* // },
225228
* // ],
226229
* // finalTextMessage: "STRING_VALUE",

clients/client-qbusiness/src/commands/ChatSyncCommand.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ export interface ChatSyncCommandOutput extends ChatSyncOutput, __MetadataBearer
231231
* // },
232232
* // },
233233
* // ],
234+
* // documentId: "STRING_VALUE",
235+
* // indexId: "STRING_VALUE",
236+
* // datasourceId: "STRING_VALUE",
234237
* // },
235238
* // ],
236239
* // failedAttachments: [ // AttachmentsOutput

clients/client-qbusiness/src/commands/CreateSubscriptionCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface CreateSubscriptionCommandInput extends CreateSubscriptionReques
2828
export interface CreateSubscriptionCommandOutput extends CreateSubscriptionResponse, __MetadataBearer {}
2929

3030
/**
31-
* <p>Subscribes an IAM Identity Center user or a group to a pricing tier for an Amazon Q Business application.</p> <p>Amazon Q Business offers two subscription tiers: <code>Q_LITE</code> and <code>Q_BUSINESS</code>. Subscription tier determines feature access for the user. For more information on subscriptions and pricing tiers, see <a href="https://aws.amazon.com/q/business/pricing/">Amazon Q Business pricing</a>.</p>
31+
* <p>Subscribes an IAM Identity Center user or a group to a pricing tier for an Amazon Q Business application.</p> <p>Amazon Q Business offers two subscription tiers: <code>Q_LITE</code> and <code>Q_BUSINESS</code>. Subscription tier determines feature access for the user. For more information on subscriptions and pricing tiers, see <a href="https://aws.amazon.com/q/business/pricing/">Amazon Q Business pricing</a>.</p> <note> <p>For an example IAM role policy for assigning subscriptions, see <a href="https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/setting-up.html#permissions">Set up required permissions</a> in the Amazon Q Business User Guide.</p> </note>
3232
* @example
3333
* Use a bare-bones client and the command you need to make an API call.
3434
* ```javascript
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { GetDocumentContentRequest, GetDocumentContentResponse } from "../models/models_1";
9+
import { de_GetDocumentContentCommand, se_GetDocumentContentCommand } from "../protocols/Aws_restJson1";
10+
import { QBusinessClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QBusinessClient";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link GetDocumentContentCommand}.
21+
*/
22+
export interface GetDocumentContentCommandInput extends GetDocumentContentRequest {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link GetDocumentContentCommand}.
27+
*/
28+
export interface GetDocumentContentCommandOutput extends GetDocumentContentResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p>Retrieves the content of a document that was ingested into Amazon Q Business. This API validates user authorization against document ACLs before returning a pre-signed URL for secure document access. You can download or view source documents referenced in chat responses through the URL.</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { QBusinessClient, GetDocumentContentCommand } from "@aws-sdk/client-qbusiness"; // ES Modules import
36+
* // const { QBusinessClient, GetDocumentContentCommand } = require("@aws-sdk/client-qbusiness"); // CommonJS import
37+
* const client = new QBusinessClient(config);
38+
* const input = { // GetDocumentContentRequest
39+
* applicationId: "STRING_VALUE", // required
40+
* indexId: "STRING_VALUE", // required
41+
* dataSourceId: "STRING_VALUE",
42+
* documentId: "STRING_VALUE", // required
43+
* outputFormat: "RAW",
44+
* };
45+
* const command = new GetDocumentContentCommand(input);
46+
* const response = await client.send(command);
47+
* // { // GetDocumentContentResponse
48+
* // presignedUrl: "STRING_VALUE", // required
49+
* // mimeType: "STRING_VALUE", // required
50+
* // };
51+
*
52+
* ```
53+
*
54+
* @param GetDocumentContentCommandInput - {@link GetDocumentContentCommandInput}
55+
* @returns {@link GetDocumentContentCommandOutput}
56+
* @see {@link GetDocumentContentCommandInput} for command's `input` shape.
57+
* @see {@link GetDocumentContentCommandOutput} for command's `response` shape.
58+
* @see {@link QBusinessClientResolvedConfig | config} for QBusinessClient's `config` shape.
59+
*
60+
* @throws {@link AccessDeniedException} (client fault)
61+
* <p> You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.</p>
62+
*
63+
* @throws {@link InternalServerException} (server fault)
64+
* <p>An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
65+
*
66+
* @throws {@link ResourceNotFoundException} (client fault)
67+
* <p>The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.</p>
68+
*
69+
* @throws {@link ThrottlingException} (client fault)
70+
* <p>The request was denied due to throttling. Reduce the number of requests and try again.</p>
71+
*
72+
* @throws {@link ValidationException} (client fault)
73+
* <p>The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.</p>
74+
*
75+
* @throws {@link QBusinessServiceException}
76+
* <p>Base exception class for all service exceptions from QBusiness service.</p>
77+
*
78+
*
79+
* @public
80+
*/
81+
export class GetDocumentContentCommand extends $Command
82+
.classBuilder<
83+
GetDocumentContentCommandInput,
84+
GetDocumentContentCommandOutput,
85+
QBusinessClientResolvedConfig,
86+
ServiceInputTypes,
87+
ServiceOutputTypes
88+
>()
89+
.ep(commonParams)
90+
.m(function (this: any, Command: any, cs: any, config: QBusinessClientResolvedConfig, o: any) {
91+
return [
92+
getSerdePlugin(config, this.serialize, this.deserialize),
93+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
94+
];
95+
})
96+
.s("ExpertQ", "GetDocumentContent", {})
97+
.n("QBusinessClient", "GetDocumentContentCommand")
98+
.f(void 0, void 0)
99+
.ser(se_GetDocumentContentCommand)
100+
.de(de_GetDocumentContentCommand)
101+
.build() {
102+
/** @internal type navigation helper, not in runtime. */
103+
protected declare static __types: {
104+
api: {
105+
input: GetDocumentContentRequest;
106+
output: GetDocumentContentResponse;
107+
};
108+
sdk: {
109+
input: GetDocumentContentCommandInput;
110+
output: GetDocumentContentCommandOutput;
111+
};
112+
};
113+
}

clients/client-qbusiness/src/commands/ListMessagesCommand.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ export interface ListMessagesCommandOutput extends ListMessagesResponse, __Metad
101101
* // },
102102
* // },
103103
* // ],
104+
* // documentId: "STRING_VALUE",
105+
* // indexId: "STRING_VALUE",
106+
* // datasourceId: "STRING_VALUE",
104107
* // },
105108
* // ],
106109
* // actionReview: { // ActionReview

clients/client-qbusiness/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export * from "./GetChatControlsConfigurationCommand";
3636
export * from "./GetChatResponseConfigurationCommand";
3737
export * from "./GetDataAccessorCommand";
3838
export * from "./GetDataSourceCommand";
39+
export * from "./GetDocumentContentCommand";
3940
export * from "./GetGroupCommand";
4041
export * from "./GetIndexCommand";
4142
export * from "./GetMediaCommand";

clients/client-qbusiness/src/models/models_0.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5344,7 +5344,7 @@ export interface BatchDeleteDocumentResponse {
53445344
}
53455345

53465346
/**
5347-
* <p>The contents of a document.</p>
5347+
* <p>The contents of a document.</p> <note> <p>Documents have size limitations. The maximum file size for a document is 50 MB. The maximum amount of text that can be extracted from a single document is 5 MB. For more information, see <a href="https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/doc-types.html">Supported document formats in Amazon Q Business</a>.</p> </note>
53485348
* @public
53495349
*/
53505350
export type DocumentContent = DocumentContent.BlobMember | DocumentContent.S3Member | DocumentContent.$UnknownMember;
@@ -5966,6 +5966,24 @@ export interface SourceAttribution {
59665966
* @public
59675967
*/
59685968
textMessageSegments?: TextSegment[] | undefined;
5969+
5970+
/**
5971+
* <p>The unique identifier of the source document used in the citation, obtained from the Amazon Q Business index during chat response generation. This ID is used as input to the <code>GetDocumentContent</code> API to retrieve the actual document content for user verification.</p>
5972+
* @public
5973+
*/
5974+
documentId?: string | undefined;
5975+
5976+
/**
5977+
* <p>The identifier of the index containing the source document's metadata and access control information. This links the citation back to the specific Amazon Q Business index where the document's searchable content and permissions are stored.</p>
5978+
* @public
5979+
*/
5980+
indexId?: string | undefined;
5981+
5982+
/**
5983+
* <p>The identifier of the data source from which the document was ingested. This field is not present if the document is ingested by directly calling the BatchPutDocument API (similar to checkDocumentAccess). If the document is from a file-upload data source, the datasource will be "uploaded-docs-file-stat-datasourceid".</p>
5984+
* @public
5985+
*/
5986+
datasourceId?: string | undefined;
59695987
}
59705988

59715989
/**

0 commit comments

Comments
 (0)