@aws-amplify/data-schema
Advanced tools
Comparing version 0.0.0-ai-streaming-20241018163616 to 0.0.0-ai-streaming-20241018204811
@@ -193,3 +193,3 @@ 'use strict'; | ||
contentBlockDeltaIndex: Int | ||
contentBlockToolUse: AWSJSON | ||
contentBlockToolUse: ToolUseBlock | ||
contentBlockDoneAtIndex: Int | ||
@@ -196,0 +196,0 @@ stopReason: String |
@@ -13,4 +13,4 @@ 'use strict'; | ||
contentBlockDeltaIndex, | ||
contentBlockText, | ||
contentBlockToolUse: deserializeToolUseBlock(contentBlockToolUse), | ||
text: contentBlockText, | ||
toolUse: deserializeToolUseBlock(contentBlockToolUse), | ||
stopReason, | ||
@@ -20,8 +20,11 @@ id, | ||
exports.convertItemToConversationStreamEvent = convertItemToConversationStreamEvent; | ||
const deserializeToolUseBlock = ({ toolUse }) => toolUse | ||
? { | ||
...toolUse, | ||
input: JSON.parse(toolUse.input), | ||
const deserializeToolUseBlock = (contentBlockToolUse) => { | ||
if (contentBlockToolUse) { | ||
const toolUseBlock = { | ||
...contentBlockToolUse, | ||
input: JSON.parse(contentBlockToolUse.input), | ||
}; | ||
return toolUseBlock; | ||
} | ||
: null; | ||
}; | ||
//# sourceMappingURL=conversationStreamEventDeserializers.js.map |
@@ -26,4 +26,4 @@ import type { Subscription } from 'rxjs'; | ||
contentBlockDeltaIndex?: number; | ||
contentBlockText?: string; | ||
contentBlockToolUse?: ToolUseBlock; | ||
text?: string; | ||
toolUse?: ToolUseBlock; | ||
stopReason?: string; | ||
@@ -30,0 +30,0 @@ } |
{ | ||
"name": "@aws-amplify/data-schema", | ||
"version": "0.0.0-ai-streaming-20241018163616", | ||
"version": "0.0.0-ai-streaming-20241018204811", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -239,3 +239,3 @@ import { LambdaFunctionDefinition } from '@aws-amplify/data-schema-types'; | ||
contentBlockDeltaIndex: Int | ||
contentBlockToolUse: AWSJSON | ||
contentBlockToolUse: ToolUseBlock | ||
contentBlockDoneAtIndex: Int | ||
@@ -242,0 +242,0 @@ stopReason: String |
@@ -36,4 +36,4 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
contentBlockDeltaIndex?: number; | ||
contentBlockText?: string; | ||
contentBlockToolUse?: ToolUseBlock; | ||
text?: string; | ||
toolUse?: ToolUseBlock; | ||
stopReason?: string; | ||
@@ -40,0 +40,0 @@ } |
@@ -5,2 +5,3 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
import { ConversationStreamEvent } from "../../../ai/ConversationType"; | ||
import { ToolUseBlock } from "../../../ai/types/contentBlocks"; | ||
@@ -23,4 +24,4 @@ export const convertItemToConversationStreamEvent = ({ | ||
contentBlockDeltaIndex, | ||
contentBlockText, | ||
contentBlockToolUse: deserializeToolUseBlock(contentBlockToolUse), | ||
text: contentBlockText, | ||
toolUse: deserializeToolUseBlock(contentBlockToolUse), | ||
stopReason, | ||
@@ -30,8 +31,13 @@ id, | ||
const deserializeToolUseBlock = ({ toolUse }: Record<'toolUse', any>) => | ||
toolUse | ||
? { | ||
...toolUse, | ||
input: JSON.parse(toolUse.input), | ||
} | ||
: null; | ||
const deserializeToolUseBlock = ( | ||
contentBlockToolUse: any, | ||
): ToolUseBlock | undefined => { | ||
if (contentBlockToolUse) { | ||
const toolUseBlock = { | ||
...contentBlockToolUse, | ||
input: JSON.parse(contentBlockToolUse.input), | ||
}; | ||
return toolUseBlock; | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2247072
30668