Skip to content

Commit 2086ac5

Browse files
committed
fix missing field
1 parent 237cd47 commit 2086ac5

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

typescript/src/agents/amazonBedrockAgent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Logger } from "../utils/logger";
88
* Extends base AgentOptions with specific parameters required for Amazon Bedrock.
99
*/
1010
export interface AmazonBedrockAgentOptions extends AgentOptions {
11+
region?: string;
1112
agentId: string; // The ID of the Amazon Bedrock agent.
1213
agentAliasId: string; // The alias ID of the Amazon Bedrock agent.
1314
client?: BedrockAgentRuntimeClient; // Client for interacting with the Bedrock agent runtime.

typescript/src/agents/bedrockFlowsAgent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from "../types";
77

88
export interface BedrockFlowsAgentOptions extends AgentOptions {
9+
region?: string;
910
flowIdentifier: string;
1011
flowAliasIdentifier: string;
1112
bedrockAgentClient?: BedrockAgentRuntimeClient;

typescript/src/agents/bedrockTranslatorAgent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { BedrockRuntimeClient, ConverseCommand, ContentBlock } from "@aws-sdk/cl
44
import { Logger } from "../utils/logger";
55

66
interface BedrockTranslatorAgentOptions extends AgentOptions {
7+
region?: string;
78
sourceLanguage?: string;
89
targetLanguage?: string;
910
modelId?: string;

typescript/src/agents/comprehendFilterAgent.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Agent, AgentOptions } from "./agent";
22
import { ConversationMessage, ParticipantRole } from "../types";
33
import { Logger } from "../utils/logger";
4-
import {
5-
ComprehendClient,
6-
DetectSentimentCommand,
7-
DetectPiiEntitiesCommand,
4+
import {
5+
ComprehendClient,
6+
DetectSentimentCommand,
7+
DetectPiiEntitiesCommand,
88
DetectToxicContentCommand,
99
DetectSentimentCommandOutput,
1010
DetectPiiEntitiesCommandOutput,
@@ -29,6 +29,7 @@ type CheckFunction = (input: string) => Promise<string | null>;
2929

3030
// Extended options for ComprehendContentFilterAgent
3131
export interface ComprehendFilterAgentOptions extends AgentOptions {
32+
region?: string;
3233
enableSentimentCheck?: boolean;
3334
enablePiiCheck?: boolean;
3435
enableToxicityCheck?: boolean;
@@ -40,7 +41,7 @@ export interface ComprehendFilterAgentOptions extends AgentOptions {
4041

4142
/**
4243
* ComprehendContentFilterAgent class
43-
*
44+
*
4445
* This agent uses Amazon Comprehend to analyze and filter content based on
4546
* sentiment, PII, and toxicity. It can be configured to enable/disable specific
4647
* checks and allows for the addition of custom checks.
@@ -78,8 +79,8 @@ export class ComprehendFilterAgent extends Agent {
7879
this.languageCode = this.validateLanguageCode(options.languageCode) ?? 'en';
7980

8081
// Ensure at least one check is enabled
81-
if (!this.enableSentimentCheck &&
82-
!this.enablePiiCheck &&
82+
if (!this.enableSentimentCheck &&
83+
!this.enablePiiCheck &&
8384
!this.enableToxicityCheck) {
8485
this.enableToxicityCheck = true;
8586
}
@@ -165,7 +166,7 @@ export class ComprehendFilterAgent extends Agent {
165166
* @returns A string describing the issue if sentiment is negative, null otherwise
166167
*/
167168
private checkSentiment(result: DetectSentimentCommandOutput): string | null {
168-
if (result.Sentiment === 'NEGATIVE' &&
169+
if (result.Sentiment === 'NEGATIVE' &&
169170
result.SentimentScore?.Negative > this.sentimentThreshold) {
170171
return `Negative sentiment detected (${result.SentimentScore.Negative.toFixed(2)})`;
171172
}
@@ -276,11 +277,11 @@ export class ComprehendFilterAgent extends Agent {
276277
*/
277278
private validateLanguageCode(languageCode: LanguageCode | undefined): LanguageCode | undefined {
278279
if (!languageCode) return undefined;
279-
280+
280281
const validLanguageCodes: LanguageCode[] = [
281282
'en', 'es', 'fr', 'de', 'it', 'pt', 'ar', 'hi', 'ja', 'ko', 'zh', 'zh-TW'
282283
];
283-
284+
284285
return validLanguageCodes.includes(languageCode) ? languageCode : undefined;
285286
}
286287
}

typescript/src/agents/lexBotAgent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Logger } from "../utils/logger";
1212
* Extends base AgentOptions with specific parameters required for Amazon Lex.
1313
*/
1414
export interface LexBotAgentOptions extends AgentOptions {
15+
region?: string;
1516
botId: string; // The ID of the Lex Bot
1617
botAliasId: string; // The alias ID of the Lex Bot
1718
localeId: string; // The locale of the bot (e.g., en_US)

0 commit comments

Comments
 (0)