Skip to content

Commit a7fb9d5

Browse files
author
awstools
committed
feat(client-qbusiness): Adds functionality to enable/disable a new Q Business Hallucination Reduction feature. If enabled, Q Business will detect and attempt to remove Hallucinations from certain Chat requests.
1 parent 7be3674 commit a7fb9d5

9 files changed

+162
-62
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export interface ChatCommandOutput extends ChatOutput, __MetadataBearer {}
173173
* // { // ChatOutput
174174
* // outputStream: { // ChatOutputStream Union: only one key present
175175
* // textEvent: { // TextOutputEvent
176+
* // systemMessageType: "RESPONSE" || "GROUNDED_RESPONSE",
176177
* // conversationId: "STRING_VALUE",
177178
* // userMessageId: "STRING_VALUE",
178179
* // systemMessageId: "STRING_VALUE",

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ export interface GetChatControlsConfigurationCommandOutput
106106
* // creatorModeControl: "ENABLED" || "DISABLED", // required
107107
* // },
108108
* // nextToken: "STRING_VALUE",
109+
* // hallucinationReductionConfiguration: { // HallucinationReductionConfiguration
110+
* // hallucinationReductionControl: "ENABLED" || "DISABLED",
111+
* // },
109112
* // };
110113
*
111114
* ```

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { Command as $Command } from "@smithy/smithy-client";
55
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
66

77
import { commonParams } from "../endpoint/EndpointParameters";
8-
import { ListPluginActionsRequest, ListPluginActionsResponse } from "../models/models_0";
8+
import { ListPluginActionsRequest } from "../models/models_0";
9+
import { ListPluginActionsResponse } from "../models/models_1";
910
import { de_ListPluginActionsCommand, se_ListPluginActionsCommand } from "../protocols/Aws_restJson1";
1011
import { QBusinessClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QBusinessClient";
1112

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Command as $Command } from "@smithy/smithy-client";
55
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
66

77
import { commonParams } from "../endpoint/EndpointParameters";
8-
import { ListPluginTypeActionsRequest, ListPluginTypeActionsResponse } from "../models/models_0";
8+
import { ListPluginTypeActionsRequest, ListPluginTypeActionsResponse } from "../models/models_1";
99
import { de_ListPluginTypeActionsCommand, se_ListPluginTypeActionsCommand } from "../protocols/Aws_restJson1";
1010
import { QBusinessClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../QBusinessClient";
1111

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ export interface UpdateChatControlsConfigurationCommandOutput
146146
* creatorModeConfiguration: { // CreatorModeConfiguration
147147
* creatorModeControl: "ENABLED" || "DISABLED", // required
148148
* },
149+
* hallucinationReductionConfiguration: { // HallucinationReductionConfiguration
150+
* hallucinationReductionControl: "ENABLED" || "DISABLED",
151+
* },
149152
* };
150153
* const command = new UpdateChatControlsConfigurationCommand(input);
151154
* const response = await client.send(command);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ export interface UpdateUserCommandOutput extends UpdateUserResponse, __MetadataB
9191
* <p> You don't have access to perform this action. Make sure you have the required
9292
* permission policies and user accounts and try again.</p>
9393
*
94+
* @throws {@link ConflictException} (client fault)
95+
* <p>You are trying to perform an action that conflicts with the current status of your
96+
* resource. Fix any inconsistencies with your resources and try again.</p>
97+
*
9498
* @throws {@link InternalServerException} (server fault)
9599
* <p>An issue occurred with the internal server used for your Amazon Q Business service. Wait
96100
* some minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>

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

Lines changed: 73 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -6391,12 +6391,46 @@ export interface MetadataEvent {
63916391
finalTextMessage?: string | undefined;
63926392
}
63936393

6394+
/**
6395+
* @public
6396+
* @enum
6397+
*/
6398+
export const SystemMessageType = {
6399+
GROUNDED_RESPONSE: "GROUNDED_RESPONSE",
6400+
RESPONSE: "RESPONSE",
6401+
} as const;
6402+
6403+
/**
6404+
* @public
6405+
*/
6406+
export type SystemMessageType = (typeof SystemMessageType)[keyof typeof SystemMessageType];
6407+
63946408
/**
63956409
* <p>An output event for an AI-generated response in an Amazon Q Business web
63966410
* experience.</p>
63976411
* @public
63986412
*/
63996413
export interface TextOutputEvent {
6414+
/**
6415+
* <p>The type of AI-generated message in a <code>TextOutputEvent</code>. Amazon Q Business
6416+
* currently supports two types of messages:</p>
6417+
* <ul>
6418+
* <li>
6419+
* <p>
6420+
* <code>RESPONSE</code> - The Amazon Q Business system response.</p>
6421+
* </li>
6422+
* <li>
6423+
* <p>
6424+
* <code>GROUNDED_RESPONSE</code> - The corrected, hallucination-reduced,
6425+
* response returned by Amazon Q Business. Available only if hallucination reduction is
6426+
* supported and configured for the application and detected in the end user chat
6427+
* query by Amazon Q Business.</p>
6428+
* </li>
6429+
* </ul>
6430+
* @public
6431+
*/
6432+
systemMessageType?: SystemMessageType | undefined;
6433+
64006434
/**
64016435
* <p>The identifier of the conversation with which the text output event is
64026436
* associated.</p>
@@ -7327,6 +7361,39 @@ export interface GetChatControlsConfigurationRequest {
73277361
nextToken?: string | undefined;
73287362
}
73297363

7364+
/**
7365+
* @public
7366+
* @enum
7367+
*/
7368+
export const HallucinationReductionControl = {
7369+
DISABLED: "DISABLED",
7370+
ENABLED: "ENABLED",
7371+
} as const;
7372+
7373+
/**
7374+
* @public
7375+
*/
7376+
export type HallucinationReductionControl =
7377+
(typeof HallucinationReductionControl)[keyof typeof HallucinationReductionControl];
7378+
7379+
/**
7380+
* <p>Configuration information required to setup hallucination reduction. For more
7381+
* information, see <a href="amazonq/latest/qbusiness-ug/hallucination-reduction.html">hallucination reduction</a>.</p>
7382+
* <note>
7383+
* <p>The hallucination reduction feature won't work if chat orchestration controls are
7384+
* enabled for your application.</p>
7385+
* </note>
7386+
* @public
7387+
*/
7388+
export interface HallucinationReductionConfiguration {
7389+
/**
7390+
* <p>Controls whether hallucination reduction has been enabled or disabled for your
7391+
* application. The default status is <code>DISABLED</code>. </p>
7392+
* @public
7393+
*/
7394+
hallucinationReductionControl?: HallucinationReductionControl | undefined;
7395+
}
7396+
73307397
/**
73317398
* @public
73327399
* @enum
@@ -7543,6 +7610,12 @@ export interface GetChatControlsConfigurationResponse {
75437610
* @public
75447611
*/
75457612
nextToken?: string | undefined;
7613+
7614+
/**
7615+
* <p> The hallucination reduction settings for your application.</p>
7616+
* @public
7617+
*/
7618+
hallucinationReductionConfiguration?: HallucinationReductionConfiguration | undefined;
75467619
}
75477620

75487621
/**
@@ -8216,66 +8289,6 @@ export interface ListPluginActionsRequest {
82168289
maxResults?: number | undefined;
82178290
}
82188291

8219-
/**
8220-
* @public
8221-
*/
8222-
export interface ListPluginActionsResponse {
8223-
/**
8224-
* <p>If the response is truncated, Amazon Q Business returns this token, which you
8225-
* can use in a later request to list the next set of plugin actions.</p>
8226-
* @public
8227-
*/
8228-
nextToken?: string | undefined;
8229-
8230-
/**
8231-
* <p>An array of information on one or more plugin actions.</p>
8232-
* @public
8233-
*/
8234-
items?: ActionSummary[] | undefined;
8235-
}
8236-
8237-
/**
8238-
* @public
8239-
*/
8240-
export interface ListPluginTypeActionsRequest {
8241-
/**
8242-
* <p>The type of the plugin.</p>
8243-
* @public
8244-
*/
8245-
pluginType: PluginType | undefined;
8246-
8247-
/**
8248-
* <p>If the number of plugins returned exceeds <code>maxResults</code>, Amazon Q Business returns a next token as a pagination token to retrieve the next set
8249-
* of plugins.</p>
8250-
* @public
8251-
*/
8252-
nextToken?: string | undefined;
8253-
8254-
/**
8255-
* <p>The maximum number of plugins to return.</p>
8256-
* @public
8257-
*/
8258-
maxResults?: number | undefined;
8259-
}
8260-
8261-
/**
8262-
* @public
8263-
*/
8264-
export interface ListPluginTypeActionsResponse {
8265-
/**
8266-
* <p>If the response is truncated, Amazon Q Business returns this token, which you
8267-
* can use in a later request to list the next set of plugins.</p>
8268-
* @public
8269-
*/
8270-
nextToken?: string | undefined;
8271-
8272-
/**
8273-
* <p>An array of information on one or more plugins.</p>
8274-
* @public
8275-
*/
8276-
items?: ActionSummary[] | undefined;
8277-
}
8278-
82798292
/**
82808293
* @internal
82818294
*/

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { SENSITIVE_STRING } from "@smithy/smithy-client";
44
import {
55
ActionExecution,
66
ActionExecutionEvent,
7+
ActionSummary,
78
AttachmentInput,
89
AttachmentInputEvent,
910
AuthChallengeResponse,
@@ -15,6 +16,7 @@ import {
1516
CreatorModeConfiguration,
1617
DocumentAttribute,
1718
EndOfInputEvent,
19+
HallucinationReductionConfiguration,
1820
MembershipType,
1921
OrchestrationControl,
2022
PluginType,
@@ -29,6 +31,66 @@ import {
2931
UserAlias,
3032
} from "./models_0";
3133

34+
/**
35+
* @public
36+
*/
37+
export interface ListPluginActionsResponse {
38+
/**
39+
* <p>If the response is truncated, Amazon Q Business returns this token, which you
40+
* can use in a later request to list the next set of plugin actions.</p>
41+
* @public
42+
*/
43+
nextToken?: string | undefined;
44+
45+
/**
46+
* <p>An array of information on one or more plugin actions.</p>
47+
* @public
48+
*/
49+
items?: ActionSummary[] | undefined;
50+
}
51+
52+
/**
53+
* @public
54+
*/
55+
export interface ListPluginTypeActionsRequest {
56+
/**
57+
* <p>The type of the plugin.</p>
58+
* @public
59+
*/
60+
pluginType: PluginType | undefined;
61+
62+
/**
63+
* <p>If the number of plugins returned exceeds <code>maxResults</code>, Amazon Q Business returns a next token as a pagination token to retrieve the next set
64+
* of plugins.</p>
65+
* @public
66+
*/
67+
nextToken?: string | undefined;
68+
69+
/**
70+
* <p>The maximum number of plugins to return.</p>
71+
* @public
72+
*/
73+
maxResults?: number | undefined;
74+
}
75+
76+
/**
77+
* @public
78+
*/
79+
export interface ListPluginTypeActionsResponse {
80+
/**
81+
* <p>If the response is truncated, Amazon Q Business returns this token, which you
82+
* can use in a later request to list the next set of plugins.</p>
83+
* @public
84+
*/
85+
nextToken?: string | undefined;
86+
87+
/**
88+
* <p>An array of information on one or more plugins.</p>
89+
* @public
90+
*/
91+
items?: ActionSummary[] | undefined;
92+
}
93+
3294
/**
3395
* @public
3496
*/
@@ -725,6 +787,12 @@ export interface UpdateChatControlsConfigurationRequest {
725787
* @public
726788
*/
727789
creatorModeConfiguration?: CreatorModeConfiguration | undefined;
790+
791+
/**
792+
* <p> The hallucination reduction settings for your application.</p>
793+
* @public
794+
*/
795+
hallucinationReductionConfiguration?: HallucinationReductionConfiguration | undefined;
728796
}
729797

730798
/**

clients/client-qbusiness/src/protocols/Aws_restJson1.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ import {
220220
ExternalResourceException,
221221
FailedAttachmentEvent,
222222
GroupStatusDetail,
223+
HallucinationReductionConfiguration,
223224
HookConfiguration,
224225
IdcAuthConfiguration,
225226
IdentityProviderConfiguration,
@@ -1738,6 +1739,7 @@ export const se_UpdateChatControlsConfigurationCommand = async (
17381739
blockedPhrasesConfigurationUpdate: (_) => _json(_),
17391740
clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
17401741
creatorModeConfiguration: (_) => _json(_),
1742+
hallucinationReductionConfiguration: (_) => _json(_),
17411743
orchestrationConfiguration: (_) => _json(_),
17421744
responseScope: [],
17431745
topicConfigurationsToCreateOrUpdate: (_) => _json(_),
@@ -2574,6 +2576,7 @@ export const de_GetChatControlsConfigurationCommand = async (
25742576
const doc = take(data, {
25752577
blockedPhrases: _json,
25762578
creatorModeConfiguration: _json,
2579+
hallucinationReductionConfiguration: _json,
25772580
nextToken: __expectString,
25782581
orchestrationConfiguration: _json,
25792582
responseScope: __expectString,
@@ -4324,6 +4327,8 @@ const se_Documents = (input: Document[], context: __SerdeContext): any => {
43244327

43254328
// se_GroupMembers omitted.
43264329

4330+
// se_HallucinationReductionConfiguration omitted.
4331+
43274332
/**
43284333
* serializeAws_restJson1HookConfiguration
43294334
*/
@@ -5060,6 +5065,8 @@ const de_GroupStatusDetails = (output: any, context: __SerdeContext): GroupStatu
50605065

50615066
// de_GroupSummaryList omitted.
50625067

5068+
// de_HallucinationReductionConfiguration omitted.
5069+
50635070
/**
50645071
* deserializeAws_restJson1HookConfiguration
50655072
*/

0 commit comments

Comments
 (0)