Skip to content

Commit 267b789

Browse files
committed
Commit working base version of code
1 parent 14a598c commit 267b789

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

javascriptv3/example_code/bedrock-runtime/scenarios/converse_tool_scenario/converse-tool-scenario.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,16 @@ async function HandleToolUseAsync(response, messages, max_recursions) {
162162
messages,
163163
);
164164
} catch (error) {
165-
console.log("error1 ", error);
165+
const errorString = error.toString();
166+
const searchString =
167+
"ValidationException: The toolResult blocks at messages.2.content contain duplicate Ids:";
168+
if (errorString.includes(searchString)) {
169+
console.log(
170+
"An processing error occurred with the model. Please try again.",
171+
);
172+
} else {
173+
console.log("An error occurred. ", error);
174+
}
166175
}
167176
}
168177
// Call the Weathertool

0 commit comments

Comments
 (0)