@@ -31,6 +31,7 @@ interface UpdateAiLabelsAndSummariesProps {
31
31
conversationId : number ;
32
32
awsAiLabelSummaryPromptArn : string | undefined ;
33
33
awsAiLabelSummaryPromptRegion : string ;
34
+ awsAiLabelSummaryPromptVariable : string ;
34
35
}
35
36
36
37
interface OpinionInsight {
@@ -59,6 +60,7 @@ export async function updateAiLabelsAndSummaries({
59
60
conversationId,
60
61
awsAiLabelSummaryPromptArn,
61
62
awsAiLabelSummaryPromptRegion,
63
+ awsAiLabelSummaryPromptVariable,
62
64
} : UpdateAiLabelsAndSummariesProps ) : Promise < void > {
63
65
if ( awsAiLabelSummaryPromptArn === undefined ) {
64
66
log . warn (
@@ -74,6 +76,7 @@ export async function updateAiLabelsAndSummaries({
74
76
conversationInsights,
75
77
awsAiLabelSummaryPromptArn,
76
78
awsAiLabelSummaryPromptRegion,
79
+ awsAiLabelSummaryPromptVariable,
77
80
} ) ;
78
81
await doUpdateAiLabelsAndSummaries ( {
79
82
db,
@@ -177,12 +180,14 @@ interface InvokeRemoteModelProps {
177
180
conversationInsights : ConversationInsights ;
178
181
awsAiLabelSummaryPromptArn : string ;
179
182
awsAiLabelSummaryPromptRegion : string ;
183
+ awsAiLabelSummaryPromptVariable : string ;
180
184
}
181
185
182
186
async function invokeRemoteModel ( {
183
187
conversationInsights,
184
188
awsAiLabelSummaryPromptArn,
185
189
awsAiLabelSummaryPromptRegion,
190
+ awsAiLabelSummaryPromptVariable,
186
191
} : InvokeRemoteModelProps ) : Promise <
187
192
GenLabelSummaryOutputStrict | GenLabelSummaryOutputLoose
188
193
> {
@@ -193,7 +198,11 @@ async function invokeRemoteModel({
193
198
modelId : awsAiLabelSummaryPromptArn ,
194
199
contentType : "application/json" ,
195
200
accept : "application/json" ,
196
- body : JSON . stringify ( conversationInsights ) ,
201
+ body : JSON . stringify ( {
202
+ promptVariables : {
203
+ [ awsAiLabelSummaryPromptVariable ] : conversationInsights ,
204
+ } ,
205
+ } ) ,
197
206
} ) ;
198
207
// we let this throw if any error occurs, it will be caught by the generic error handler
199
208
const response = await client . send ( command ) ;
0 commit comments