import { BackendOutputStorageStrategy, FunctionResources, ResourceProvider } from '@aws-amplify/plugin-types'; import { ApplicationLogLevel } from 'aws-cdk-lib/aws-lambda'; import { RetentionDays } from 'aws-cdk-lib/aws-logs'; import { Construct } from 'constructs'; import { AIConversationOutput } from '@aws-amplify/backend-output-schemas'; export type ConversationHandlerFunctionProps = { entry?: string; models: Array<{ modelId: string; region?: string; }>; /** * An amount of memory (RAM) to allocate to the function between 128 and 10240 MB. * Must be a whole number. * Default is 512MB. */ memoryMB?: number; /** * An amount of time in seconds between 1 second and 15 minutes. * Must be a whole number. * Default is 60 seconds. */ timeoutSeconds?: number; logging?: { level?: ApplicationLogLevel; retention?: RetentionDays; }; /** * @internal */ outputStorageStrategy?: BackendOutputStorageStrategy; }; export type ConversationTurnEventVersion = `1.${number}`; /** * Conversation Handler Function CDK construct. * This construct deploys resources that integrate conversation routes * defined in data schema with AI models available in AWS Bedrock. I.e. * 1. AWS Lambda function that handles conversation turn events. * With Amplify provided implementation by default and option to specify * custom handler. * 2. AWS CloudWatch log group policy with appropriate data protection policies. * 3. AWS IAM policy that grants access to selected AWS Bedrock models. */ export declare class ConversationHandlerFunction extends Construct implements ResourceProvider { private readonly props; static readonly eventVersion: ConversationTurnEventVersion; resources: FunctionResources; /** * Creates Conversation Handler Function CDK construct. */ constructor(scope: Construct, id: string, props: ConversationHandlerFunctionProps); /** * Append conversation handler to defined functions. */ private storeOutput; private resolveMemory; private resolveTimeout; /** * Adds IAM permissions for Bedrock models to the Lambda function. * Handles both regular foundation models and global cross-region inference profiles. * * For global inference profiles (modelId starts with "global."), this creates a three-part * IAM policy as required by AWS Bedrock: * 1. Access to the inference profile in the requesting region * 2. Access to the foundation model in the requesting region * 3. Access to the global foundation model (enables cross-region routing) * @see https://docs.aws.amazon.com/bedrock/latest/userguide/global-cross-region-inference.html */ private addBedrockModelPermissions; /** * Categorizes model resources into different permission groups based on model type. * Returns an object with arrays of ARNs for each permission category. */ private categorizeModelResources; private isGlobalInferenceProfile; private extractFoundationModelId; private buildInferenceProfileArn; private buildFoundationModelArn; private buildGlobalFoundationModelArn; } //# sourceMappingURL=conversation_handler_construct.d.ts.map