@aws-amplify/data-schema 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai/ConversationSchemaGraphQLTypes.js +66 -66
- package/dist/cjs/ai/ConversationSchemaGraphQLTypes.js.map +1 -1
- package/dist/cjs/ai/ConversationSchemaProcessor.js +1 -1
- package/dist/cjs/ai/ConversationSchemaProcessor.js.map +1 -1
- package/dist/esm/ai/ConversationSchemaGraphQLTypes.d.ts +1 -1
- package/dist/esm/ai/ConversationSchemaGraphQLTypes.mjs +66 -66
- package/dist/esm/ai/ConversationSchemaGraphQLTypes.mjs.map +1 -1
- package/dist/esm/ai/ConversationSchemaProcessor.mjs +1 -1
- package/dist/esm/ai/ConversationSchemaProcessor.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/ai/ConversationSchemaGraphQLTypes.ts +66 -66
- package/src/ai/ConversationSchemaProcessor.ts +1 -1
|
@@ -3,173 +3,173 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.CONVERSATION_SCHEMA_GRAPHQL_TYPES = void 0;
|
|
5
5
|
exports.CONVERSATION_SCHEMA_GRAPHQL_TYPES =
|
|
6
|
-
/* GraphQL */ `enum
|
|
6
|
+
/* GraphQL */ `enum AmplifyAIConversationParticipantRole {
|
|
7
7
|
user
|
|
8
8
|
assistant
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
interface
|
|
11
|
+
interface AmplifyAIConversationMessage {
|
|
12
12
|
id: ID!
|
|
13
13
|
conversationId: ID!
|
|
14
14
|
associatedUserMessageId: ID
|
|
15
|
-
role:
|
|
16
|
-
content: [
|
|
15
|
+
role: AmplifyAIConversationParticipantRole
|
|
16
|
+
content: [AmplifyAIContentBlock]
|
|
17
17
|
aiContext: AWSJSON
|
|
18
|
-
toolConfiguration:
|
|
18
|
+
toolConfiguration: AmplifyAIToolConfiguration
|
|
19
19
|
createdAt: AWSDateTime
|
|
20
20
|
updatedAt: AWSDateTime
|
|
21
21
|
owner: String
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
input
|
|
24
|
+
input AmplifyAIDocumentBlockSourceInput {
|
|
25
25
|
bytes: String
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
input
|
|
28
|
+
input AmplifyAIDocumentBlockInput {
|
|
29
29
|
format: String!
|
|
30
30
|
name: String!
|
|
31
|
-
source:
|
|
31
|
+
source: AmplifyAIDocumentBlockSourceInput!
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
input
|
|
34
|
+
input AmplifyAIImageBlockSourceInput {
|
|
35
35
|
bytes: String
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
input
|
|
38
|
+
input AmplifyAIImageBlockInput {
|
|
39
39
|
format: String!
|
|
40
|
-
source:
|
|
40
|
+
source: AmplifyAIImageBlockSourceInput!
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
input
|
|
43
|
+
input AmplifyAIToolUseBlockInput {
|
|
44
44
|
toolUseId: String!
|
|
45
45
|
name: String!
|
|
46
46
|
input: AWSJSON!
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
input
|
|
50
|
-
document:
|
|
51
|
-
image:
|
|
49
|
+
input AmplifyAIToolResultContentBlockInput {
|
|
50
|
+
document: AmplifyAIDocumentBlockInput
|
|
51
|
+
image: AmplifyAIImageBlockInput
|
|
52
52
|
json: AWSJSON
|
|
53
53
|
text: String
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
input
|
|
57
|
-
content: [
|
|
56
|
+
input AmplifyAIToolResultBlockInput {
|
|
57
|
+
content: [AmplifyAIToolResultContentBlockInput!]!
|
|
58
58
|
toolUseId: String!
|
|
59
59
|
status: String
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
type
|
|
62
|
+
type AmplifyAIDocumentBlockSource {
|
|
63
63
|
bytes: String
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
type
|
|
66
|
+
type AmplifyAIDocumentBlock {
|
|
67
67
|
format: String!
|
|
68
68
|
name: String!
|
|
69
|
-
source:
|
|
69
|
+
source: AmplifyAIDocumentBlockSource!
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
type
|
|
72
|
+
type AmplifyAIImageBlock {
|
|
73
73
|
format: String!
|
|
74
|
-
source:
|
|
74
|
+
source: AmplifyAIImageBlockSource!
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
type
|
|
77
|
+
type AmplifyAIImageBlockSource {
|
|
78
78
|
bytes: String
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
type
|
|
81
|
+
type AmplifyAIToolUseBlock {
|
|
82
82
|
toolUseId: String!
|
|
83
83
|
name: String!
|
|
84
84
|
input: AWSJSON!
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
type
|
|
88
|
-
document:
|
|
89
|
-
image:
|
|
87
|
+
type AmplifyAIToolResultContentBlock {
|
|
88
|
+
document: AmplifyAIDocumentBlock
|
|
89
|
+
image: AmplifyAIImageBlock
|
|
90
90
|
json: AWSJSON
|
|
91
91
|
text: String
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
type
|
|
95
|
-
content: [
|
|
94
|
+
type AmplifyAIToolResultBlock {
|
|
95
|
+
content: [AmplifyAIToolResultContentBlock!]!
|
|
96
96
|
toolUseId: String!
|
|
97
97
|
status: String
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
type
|
|
100
|
+
type AmplifyAIContentBlockText {
|
|
101
101
|
text: String
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
type
|
|
105
|
-
image:
|
|
104
|
+
type AmplifyAIContentBlockImage {
|
|
105
|
+
image: AmplifyAIImageBlock
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
type
|
|
109
|
-
document:
|
|
108
|
+
type AmplifyAIContentBlockDocument {
|
|
109
|
+
document: AmplifyAIDocumentBlock
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
type
|
|
113
|
-
toolUse:
|
|
112
|
+
type AmplifyAIContentBlockToolUse {
|
|
113
|
+
toolUse: AmplifyAIToolUseBlock
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
type
|
|
117
|
-
toolResult:
|
|
116
|
+
type AmplifyAIContentBlockToolResult {
|
|
117
|
+
toolResult: AmplifyAIToolResultBlock
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
input
|
|
120
|
+
input AmplifyAIContentBlockInput {
|
|
121
121
|
text: String
|
|
122
|
-
document:
|
|
123
|
-
image:
|
|
124
|
-
toolResult:
|
|
125
|
-
toolUse:
|
|
122
|
+
document: AmplifyAIDocumentBlockInput
|
|
123
|
+
image: AmplifyAIImageBlockInput
|
|
124
|
+
toolResult: AmplifyAIToolResultBlockInput
|
|
125
|
+
toolUse: AmplifyAIToolUseBlockInput
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
type
|
|
128
|
+
type AmplifyAIContentBlock {
|
|
129
129
|
text: String
|
|
130
|
-
document:
|
|
131
|
-
image:
|
|
132
|
-
toolResult:
|
|
133
|
-
toolUse:
|
|
130
|
+
document: AmplifyAIDocumentBlock
|
|
131
|
+
image: AmplifyAIImageBlock
|
|
132
|
+
toolResult: AmplifyAIToolResultBlock
|
|
133
|
+
toolUse: AmplifyAIToolUseBlock
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
input
|
|
137
|
-
tools: [
|
|
136
|
+
input AmplifyAIToolConfigurationInput {
|
|
137
|
+
tools: [AmplifyAIToolInput]
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
input
|
|
141
|
-
toolSpec:
|
|
140
|
+
input AmplifyAIToolInput {
|
|
141
|
+
toolSpec: AmplifyAIToolSpecificationInput
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
input
|
|
144
|
+
input AmplifyAIToolSpecificationInput {
|
|
145
145
|
name: String!
|
|
146
146
|
description: String
|
|
147
|
-
inputSchema:
|
|
147
|
+
inputSchema: AmplifyAIToolInputSchemaInput!
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
input
|
|
150
|
+
input AmplifyAIToolInputSchemaInput {
|
|
151
151
|
json: AWSJSON
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
type
|
|
155
|
-
tools: [
|
|
154
|
+
type AmplifyAIToolConfiguration {
|
|
155
|
+
tools: [AmplifyAITool]
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
type
|
|
159
|
-
toolSpec:
|
|
158
|
+
type AmplifyAITool {
|
|
159
|
+
toolSpec: AmplifyAIToolSpecification
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
type
|
|
162
|
+
type AmplifyAIToolSpecification {
|
|
163
163
|
name: String!
|
|
164
164
|
description: String
|
|
165
|
-
inputSchema:
|
|
165
|
+
inputSchema: AmplifyAIToolInputSchema!
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
type
|
|
168
|
+
type AmplifyAIToolInputSchema {
|
|
169
169
|
json: AWSJSON
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
type
|
|
172
|
+
type AmplifyAIConversationMessageStreamPart @aws_cognito_user_pools {
|
|
173
173
|
id: ID!
|
|
174
174
|
owner: String
|
|
175
175
|
conversationId: ID!
|
|
@@ -177,13 +177,13 @@ type ConversationMessageStreamPart @aws_cognito_user_pools {
|
|
|
177
177
|
contentBlockIndex: Int
|
|
178
178
|
contentBlockText: String
|
|
179
179
|
contentBlockDeltaIndex: Int
|
|
180
|
-
contentBlockToolUse:
|
|
180
|
+
contentBlockToolUse: AmplifyAIToolUseBlock
|
|
181
181
|
contentBlockDoneAtIndex: Int
|
|
182
182
|
stopReason: String
|
|
183
|
-
errors: [
|
|
183
|
+
errors: [AmplifyAIConversationTurnError]
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
type
|
|
186
|
+
type AmplifyAIConversationTurnError @aws_cognito_user_pools {
|
|
187
187
|
message: String!
|
|
188
188
|
errorType: String!
|
|
189
189
|
}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationSchemaGraphQLTypes.js","sources":["../../../src/ai/ConversationSchemaGraphQLTypes.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CONVERSATION_SCHEMA_GRAPHQL_TYPES = void 0;\nexports.CONVERSATION_SCHEMA_GRAPHQL_TYPES = \n/* GraphQL */ `enum
|
|
1
|
+
{"version":3,"file":"ConversationSchemaGraphQLTypes.js","sources":["../../../src/ai/ConversationSchemaGraphQLTypes.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CONVERSATION_SCHEMA_GRAPHQL_TYPES = void 0;\nexports.CONVERSATION_SCHEMA_GRAPHQL_TYPES = \n/* GraphQL */ `enum AmplifyAIConversationParticipantRole {\n user\n assistant\n}\n\ninterface AmplifyAIConversationMessage {\n id: ID!\n conversationId: ID!\n associatedUserMessageId: ID\n role: AmplifyAIConversationParticipantRole\n content: [AmplifyAIContentBlock]\n aiContext: AWSJSON\n toolConfiguration: AmplifyAIToolConfiguration\n createdAt: AWSDateTime\n updatedAt: AWSDateTime\n owner: String\n}\n\ninput AmplifyAIDocumentBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIDocumentBlockInput {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSourceInput!\n}\n\ninput AmplifyAIImageBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIImageBlockInput {\n format: String!\n source: AmplifyAIImageBlockSourceInput!\n}\n\ninput AmplifyAIToolUseBlockInput {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ninput AmplifyAIToolResultContentBlockInput {\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n json: AWSJSON\n text: String\n}\n\ninput AmplifyAIToolResultBlockInput {\n content: [AmplifyAIToolResultContentBlockInput!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIDocumentBlockSource {\n bytes: String\n}\n\ntype AmplifyAIDocumentBlock {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSource!\n}\n\ntype AmplifyAIImageBlock {\n format: String!\n source: AmplifyAIImageBlockSource!\n}\n\ntype AmplifyAIImageBlockSource {\n bytes: String\n}\n\ntype AmplifyAIToolUseBlock {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ntype AmplifyAIToolResultContentBlock {\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n json: AWSJSON\n text: String\n}\n\ntype AmplifyAIToolResultBlock {\n content: [AmplifyAIToolResultContentBlock!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIContentBlockText {\n text: String\n}\n\ntype AmplifyAIContentBlockImage {\n image: AmplifyAIImageBlock\n}\n\ntype AmplifyAIContentBlockDocument {\n document: AmplifyAIDocumentBlock\n}\n\ntype AmplifyAIContentBlockToolUse {\n toolUse: AmplifyAIToolUseBlock\n}\n\ntype AmplifyAIContentBlockToolResult {\n toolResult: AmplifyAIToolResultBlock\n}\n\ninput AmplifyAIContentBlockInput {\n text: String\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n toolResult: AmplifyAIToolResultBlockInput\n toolUse: AmplifyAIToolUseBlockInput\n}\n\ntype AmplifyAIContentBlock {\n text: String\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n toolResult: AmplifyAIToolResultBlock\n toolUse: AmplifyAIToolUseBlock\n}\n\ninput AmplifyAIToolConfigurationInput {\n tools: [AmplifyAIToolInput]\n}\n\ninput AmplifyAIToolInput {\n toolSpec: AmplifyAIToolSpecificationInput\n}\n\ninput AmplifyAIToolSpecificationInput {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchemaInput!\n}\n\ninput AmplifyAIToolInputSchemaInput {\n json: AWSJSON\n}\n\ntype AmplifyAIToolConfiguration {\n tools: [AmplifyAITool]\n}\n\ntype AmplifyAITool {\n toolSpec: AmplifyAIToolSpecification\n}\n\ntype AmplifyAIToolSpecification {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchema!\n}\n\ntype AmplifyAIToolInputSchema {\n json: AWSJSON\n}\n\ntype AmplifyAIConversationMessageStreamPart @aws_cognito_user_pools {\n id: ID!\n owner: String\n conversationId: ID!\n associatedUserMessageId: ID!\n contentBlockIndex: Int\n contentBlockText: String\n contentBlockDeltaIndex: Int\n contentBlockToolUse: AmplifyAIToolUseBlock\n contentBlockDoneAtIndex: Int\n stopReason: String\n errors: [AmplifyAIConversationTurnError]\n}\n\ntype AmplifyAIConversationTurnError @aws_cognito_user_pools {\n message: String!\n errorType: String!\n}`;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iCAAiC,GAAG,KAAK,CAAC,CAAC;AACnD,OAAO,CAAC,iCAAiC;AACzC,cAAc,CAAC;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC;;"}
|
|
@@ -36,7 +36,7 @@ const createConversationField = (typeDef, typeName) => {
|
|
|
36
36
|
? `, tools: [${getConversationToolsString(tools)}]`
|
|
37
37
|
: '';
|
|
38
38
|
const conversationDirective = `@conversation(${argsString}${authString}${handlerString}${toolsString})`;
|
|
39
|
-
const field = `${typeName}(conversationId: ID!, content: [
|
|
39
|
+
const field = `${typeName}(conversationId: ID!, content: [AmplifyAIContentBlockInput], aiContext: AWSJSON, toolConfiguration: AmplifyAIToolConfigurationInput): AmplifyAIConversationMessage ${conversationDirective} @aws_cognito_user_pools`;
|
|
40
40
|
return { field, functionHandler };
|
|
41
41
|
};
|
|
42
42
|
exports.createConversationField = createConversationField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationSchemaProcessor.js","sources":["../../../src/ai/ConversationSchemaProcessor.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createConversationField = void 0;\nconst Authorization_1 = require(\"../Authorization\");\nconst utils_1 = require(\"../runtime/utils\");\nconst createConversationField = (typeDef, typeName) => {\n const { aiModel, systemPrompt, handler, tools } = typeDef;\n const { strategy, provider } = extractAuthorization(typeDef, typeName);\n const args = {\n aiModel: aiModel.resourcePath,\n // This is done to escape newlines in potentially multi-line system prompts\n // e.g.\n // realtorChat: a.conversation({\n // aiModel: a.ai.model('Claude 3 Haiku'),\n // systemPrompt: `You are a helpful real estate assistant\n // Respond in the poetic form of haiku.`,\n // }),\n //\n // It doesn't affect non multi-line string inputs for system prompts\n systemPrompt: systemPrompt.replace(/\\r?\\n/g, '\\\\n'),\n };\n const argsString = Object.entries(args)\n .map(([key, value]) => `${key}: \"${value}\"`)\n .join(', ');\n const authString = `, auth: { strategy: ${strategy}, provider: ${provider} }`;\n const functionHandler = {};\n let handlerString = '';\n if (handler) {\n const functionName = `Fn${(0, utils_1.capitalize)(typeName)}`;\n const eventVersion = handler.eventVersion;\n handlerString = `, handler: { functionName: \"${functionName}\", eventVersion: \"${eventVersion}\" }`;\n functionHandler[functionName] = handler;\n }\n const toolsString = tools?.length\n ? `, tools: [${getConversationToolsString(tools)}]`\n : '';\n const conversationDirective = `@conversation(${argsString}${authString}${handlerString}${toolsString})`;\n const field = `${typeName}(conversationId: ID!, content: [
|
|
1
|
+
{"version":3,"file":"ConversationSchemaProcessor.js","sources":["../../../src/ai/ConversationSchemaProcessor.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createConversationField = void 0;\nconst Authorization_1 = require(\"../Authorization\");\nconst utils_1 = require(\"../runtime/utils\");\nconst createConversationField = (typeDef, typeName) => {\n const { aiModel, systemPrompt, handler, tools } = typeDef;\n const { strategy, provider } = extractAuthorization(typeDef, typeName);\n const args = {\n aiModel: aiModel.resourcePath,\n // This is done to escape newlines in potentially multi-line system prompts\n // e.g.\n // realtorChat: a.conversation({\n // aiModel: a.ai.model('Claude 3 Haiku'),\n // systemPrompt: `You are a helpful real estate assistant\n // Respond in the poetic form of haiku.`,\n // }),\n //\n // It doesn't affect non multi-line string inputs for system prompts\n systemPrompt: systemPrompt.replace(/\\r?\\n/g, '\\\\n'),\n };\n const argsString = Object.entries(args)\n .map(([key, value]) => `${key}: \"${value}\"`)\n .join(', ');\n const authString = `, auth: { strategy: ${strategy}, provider: ${provider} }`;\n const functionHandler = {};\n let handlerString = '';\n if (handler) {\n const functionName = `Fn${(0, utils_1.capitalize)(typeName)}`;\n const eventVersion = handler.eventVersion;\n handlerString = `, handler: { functionName: \"${functionName}\", eventVersion: \"${eventVersion}\" }`;\n functionHandler[functionName] = handler;\n }\n const toolsString = tools?.length\n ? `, tools: [${getConversationToolsString(tools)}]`\n : '';\n const conversationDirective = `@conversation(${argsString}${authString}${handlerString}${toolsString})`;\n const field = `${typeName}(conversationId: ID!, content: [AmplifyAIContentBlockInput], aiContext: AWSJSON, toolConfiguration: AmplifyAIToolConfigurationInput): AmplifyAIConversationMessage ${conversationDirective} @aws_cognito_user_pools`;\n return { field, functionHandler };\n};\nexports.createConversationField = createConversationField;\nconst isRef = (query) => query?.data?.type === 'ref';\nconst extractAuthorization = (typeDef, typeName) => {\n const { authorization } = typeDef.data;\n if (authorization.length === 0) {\n throw new Error(`Conversation ${typeName} is missing authorization rules. Use .authorization((allow) => allow.owner()) to configure authorization for your conversation route.`);\n }\n const { strategy, provider } = (0, Authorization_1.accessData)(authorization[0]);\n if (strategy !== 'owner' || provider !== 'userPools') {\n throw new Error(`Conversation ${typeName} must use owner authorization with a user pool provider. Use .authorization((allow) => allow.owner()) to configure authorization for your conversation route.`);\n }\n return { strategy, provider };\n};\nconst getConversationToolsString = (tools) => tools\n .map((tool) => {\n const { name, description } = tool;\n // https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolSpecification.html\n // Pattern: ^[a-zA-Z][a-zA-Z0-9_]*$\n // Length Constraints: Minimum length of 1. Maximum length of 64.\n const isValidToolName = /^[a-zA-Z][a-zA-Z0-9_]*$/.test(name) &&\n name.length >= 1 &&\n name.length <= 64;\n if (!isValidToolName) {\n throw new Error(`Tool name must be between 1 and 64 characters, start with a letter, and contain only letters, numbers, and underscores. Found: ${name}`);\n }\n const toolDefinition = extractToolDefinition(tool);\n return `{ name: \"${name}\", description: \"${description}\", ${toolDefinition} }`;\n})\n .join(', ');\nconst extractToolDefinition = (tool) => {\n if ('model' in tool) {\n if (!isRef(tool.model))\n throw new Error(`Unexpected model was found in tool ${tool}.`);\n const { model, modelOperation } = tool;\n return `modelName: \"${model.data.link}\", modelOperation: ${modelOperation}`;\n }\n if (!isRef(tool.query))\n throw new Error(`Unexpected query was found in tool ${tool}.`);\n return `queryName: \"${tool.query.data.link}\"`;\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CONVERSATION_SCHEMA_GRAPHQL_TYPES = "enum
|
|
1
|
+
export declare const CONVERSATION_SCHEMA_GRAPHQL_TYPES = "enum AmplifyAIConversationParticipantRole {\n user\n assistant\n}\n\ninterface AmplifyAIConversationMessage {\n id: ID!\n conversationId: ID!\n associatedUserMessageId: ID\n role: AmplifyAIConversationParticipantRole\n content: [AmplifyAIContentBlock]\n aiContext: AWSJSON\n toolConfiguration: AmplifyAIToolConfiguration\n createdAt: AWSDateTime\n updatedAt: AWSDateTime\n owner: String\n}\n\ninput AmplifyAIDocumentBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIDocumentBlockInput {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSourceInput!\n}\n\ninput AmplifyAIImageBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIImageBlockInput {\n format: String!\n source: AmplifyAIImageBlockSourceInput!\n}\n\ninput AmplifyAIToolUseBlockInput {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ninput AmplifyAIToolResultContentBlockInput {\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n json: AWSJSON\n text: String\n}\n\ninput AmplifyAIToolResultBlockInput {\n content: [AmplifyAIToolResultContentBlockInput!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIDocumentBlockSource {\n bytes: String\n}\n\ntype AmplifyAIDocumentBlock {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSource!\n}\n\ntype AmplifyAIImageBlock {\n format: String!\n source: AmplifyAIImageBlockSource!\n}\n\ntype AmplifyAIImageBlockSource {\n bytes: String\n}\n\ntype AmplifyAIToolUseBlock {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ntype AmplifyAIToolResultContentBlock {\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n json: AWSJSON\n text: String\n}\n\ntype AmplifyAIToolResultBlock {\n content: [AmplifyAIToolResultContentBlock!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIContentBlockText {\n text: String\n}\n\ntype AmplifyAIContentBlockImage {\n image: AmplifyAIImageBlock\n}\n\ntype AmplifyAIContentBlockDocument {\n document: AmplifyAIDocumentBlock\n}\n\ntype AmplifyAIContentBlockToolUse {\n toolUse: AmplifyAIToolUseBlock\n}\n\ntype AmplifyAIContentBlockToolResult {\n toolResult: AmplifyAIToolResultBlock\n}\n\ninput AmplifyAIContentBlockInput {\n text: String\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n toolResult: AmplifyAIToolResultBlockInput\n toolUse: AmplifyAIToolUseBlockInput\n}\n\ntype AmplifyAIContentBlock {\n text: String\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n toolResult: AmplifyAIToolResultBlock\n toolUse: AmplifyAIToolUseBlock\n}\n\ninput AmplifyAIToolConfigurationInput {\n tools: [AmplifyAIToolInput]\n}\n\ninput AmplifyAIToolInput {\n toolSpec: AmplifyAIToolSpecificationInput\n}\n\ninput AmplifyAIToolSpecificationInput {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchemaInput!\n}\n\ninput AmplifyAIToolInputSchemaInput {\n json: AWSJSON\n}\n\ntype AmplifyAIToolConfiguration {\n tools: [AmplifyAITool]\n}\n\ntype AmplifyAITool {\n toolSpec: AmplifyAIToolSpecification\n}\n\ntype AmplifyAIToolSpecification {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchema!\n}\n\ntype AmplifyAIToolInputSchema {\n json: AWSJSON\n}\n\ntype AmplifyAIConversationMessageStreamPart @aws_cognito_user_pools {\n id: ID!\n owner: String\n conversationId: ID!\n associatedUserMessageId: ID!\n contentBlockIndex: Int\n contentBlockText: String\n contentBlockDeltaIndex: Int\n contentBlockToolUse: AmplifyAIToolUseBlock\n contentBlockDoneAtIndex: Int\n stopReason: String\n errors: [AmplifyAIConversationTurnError]\n}\n\ntype AmplifyAIConversationTurnError @aws_cognito_user_pools {\n message: String!\n errorType: String!\n}";
|
|
@@ -1,171 +1,171 @@
|
|
|
1
1
|
const CONVERSATION_SCHEMA_GRAPHQL_TYPES =
|
|
2
|
-
/* GraphQL */ `enum
|
|
2
|
+
/* GraphQL */ `enum AmplifyAIConversationParticipantRole {
|
|
3
3
|
user
|
|
4
4
|
assistant
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
interface
|
|
7
|
+
interface AmplifyAIConversationMessage {
|
|
8
8
|
id: ID!
|
|
9
9
|
conversationId: ID!
|
|
10
10
|
associatedUserMessageId: ID
|
|
11
|
-
role:
|
|
12
|
-
content: [
|
|
11
|
+
role: AmplifyAIConversationParticipantRole
|
|
12
|
+
content: [AmplifyAIContentBlock]
|
|
13
13
|
aiContext: AWSJSON
|
|
14
|
-
toolConfiguration:
|
|
14
|
+
toolConfiguration: AmplifyAIToolConfiguration
|
|
15
15
|
createdAt: AWSDateTime
|
|
16
16
|
updatedAt: AWSDateTime
|
|
17
17
|
owner: String
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
input
|
|
20
|
+
input AmplifyAIDocumentBlockSourceInput {
|
|
21
21
|
bytes: String
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
input
|
|
24
|
+
input AmplifyAIDocumentBlockInput {
|
|
25
25
|
format: String!
|
|
26
26
|
name: String!
|
|
27
|
-
source:
|
|
27
|
+
source: AmplifyAIDocumentBlockSourceInput!
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
input
|
|
30
|
+
input AmplifyAIImageBlockSourceInput {
|
|
31
31
|
bytes: String
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
input
|
|
34
|
+
input AmplifyAIImageBlockInput {
|
|
35
35
|
format: String!
|
|
36
|
-
source:
|
|
36
|
+
source: AmplifyAIImageBlockSourceInput!
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
input
|
|
39
|
+
input AmplifyAIToolUseBlockInput {
|
|
40
40
|
toolUseId: String!
|
|
41
41
|
name: String!
|
|
42
42
|
input: AWSJSON!
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
input
|
|
46
|
-
document:
|
|
47
|
-
image:
|
|
45
|
+
input AmplifyAIToolResultContentBlockInput {
|
|
46
|
+
document: AmplifyAIDocumentBlockInput
|
|
47
|
+
image: AmplifyAIImageBlockInput
|
|
48
48
|
json: AWSJSON
|
|
49
49
|
text: String
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
input
|
|
53
|
-
content: [
|
|
52
|
+
input AmplifyAIToolResultBlockInput {
|
|
53
|
+
content: [AmplifyAIToolResultContentBlockInput!]!
|
|
54
54
|
toolUseId: String!
|
|
55
55
|
status: String
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
type
|
|
58
|
+
type AmplifyAIDocumentBlockSource {
|
|
59
59
|
bytes: String
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
type
|
|
62
|
+
type AmplifyAIDocumentBlock {
|
|
63
63
|
format: String!
|
|
64
64
|
name: String!
|
|
65
|
-
source:
|
|
65
|
+
source: AmplifyAIDocumentBlockSource!
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
type
|
|
68
|
+
type AmplifyAIImageBlock {
|
|
69
69
|
format: String!
|
|
70
|
-
source:
|
|
70
|
+
source: AmplifyAIImageBlockSource!
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
type
|
|
73
|
+
type AmplifyAIImageBlockSource {
|
|
74
74
|
bytes: String
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
type
|
|
77
|
+
type AmplifyAIToolUseBlock {
|
|
78
78
|
toolUseId: String!
|
|
79
79
|
name: String!
|
|
80
80
|
input: AWSJSON!
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
type
|
|
84
|
-
document:
|
|
85
|
-
image:
|
|
83
|
+
type AmplifyAIToolResultContentBlock {
|
|
84
|
+
document: AmplifyAIDocumentBlock
|
|
85
|
+
image: AmplifyAIImageBlock
|
|
86
86
|
json: AWSJSON
|
|
87
87
|
text: String
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
type
|
|
91
|
-
content: [
|
|
90
|
+
type AmplifyAIToolResultBlock {
|
|
91
|
+
content: [AmplifyAIToolResultContentBlock!]!
|
|
92
92
|
toolUseId: String!
|
|
93
93
|
status: String
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
type
|
|
96
|
+
type AmplifyAIContentBlockText {
|
|
97
97
|
text: String
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
type
|
|
101
|
-
image:
|
|
100
|
+
type AmplifyAIContentBlockImage {
|
|
101
|
+
image: AmplifyAIImageBlock
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
type
|
|
105
|
-
document:
|
|
104
|
+
type AmplifyAIContentBlockDocument {
|
|
105
|
+
document: AmplifyAIDocumentBlock
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
type
|
|
109
|
-
toolUse:
|
|
108
|
+
type AmplifyAIContentBlockToolUse {
|
|
109
|
+
toolUse: AmplifyAIToolUseBlock
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
type
|
|
113
|
-
toolResult:
|
|
112
|
+
type AmplifyAIContentBlockToolResult {
|
|
113
|
+
toolResult: AmplifyAIToolResultBlock
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
input
|
|
116
|
+
input AmplifyAIContentBlockInput {
|
|
117
117
|
text: String
|
|
118
|
-
document:
|
|
119
|
-
image:
|
|
120
|
-
toolResult:
|
|
121
|
-
toolUse:
|
|
118
|
+
document: AmplifyAIDocumentBlockInput
|
|
119
|
+
image: AmplifyAIImageBlockInput
|
|
120
|
+
toolResult: AmplifyAIToolResultBlockInput
|
|
121
|
+
toolUse: AmplifyAIToolUseBlockInput
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
type
|
|
124
|
+
type AmplifyAIContentBlock {
|
|
125
125
|
text: String
|
|
126
|
-
document:
|
|
127
|
-
image:
|
|
128
|
-
toolResult:
|
|
129
|
-
toolUse:
|
|
126
|
+
document: AmplifyAIDocumentBlock
|
|
127
|
+
image: AmplifyAIImageBlock
|
|
128
|
+
toolResult: AmplifyAIToolResultBlock
|
|
129
|
+
toolUse: AmplifyAIToolUseBlock
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
input
|
|
133
|
-
tools: [
|
|
132
|
+
input AmplifyAIToolConfigurationInput {
|
|
133
|
+
tools: [AmplifyAIToolInput]
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
input
|
|
137
|
-
toolSpec:
|
|
136
|
+
input AmplifyAIToolInput {
|
|
137
|
+
toolSpec: AmplifyAIToolSpecificationInput
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
input
|
|
140
|
+
input AmplifyAIToolSpecificationInput {
|
|
141
141
|
name: String!
|
|
142
142
|
description: String
|
|
143
|
-
inputSchema:
|
|
143
|
+
inputSchema: AmplifyAIToolInputSchemaInput!
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
input
|
|
146
|
+
input AmplifyAIToolInputSchemaInput {
|
|
147
147
|
json: AWSJSON
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
type
|
|
151
|
-
tools: [
|
|
150
|
+
type AmplifyAIToolConfiguration {
|
|
151
|
+
tools: [AmplifyAITool]
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
type
|
|
155
|
-
toolSpec:
|
|
154
|
+
type AmplifyAITool {
|
|
155
|
+
toolSpec: AmplifyAIToolSpecification
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
type
|
|
158
|
+
type AmplifyAIToolSpecification {
|
|
159
159
|
name: String!
|
|
160
160
|
description: String
|
|
161
|
-
inputSchema:
|
|
161
|
+
inputSchema: AmplifyAIToolInputSchema!
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
type
|
|
164
|
+
type AmplifyAIToolInputSchema {
|
|
165
165
|
json: AWSJSON
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
type
|
|
168
|
+
type AmplifyAIConversationMessageStreamPart @aws_cognito_user_pools {
|
|
169
169
|
id: ID!
|
|
170
170
|
owner: String
|
|
171
171
|
conversationId: ID!
|
|
@@ -173,13 +173,13 @@ type ConversationMessageStreamPart @aws_cognito_user_pools {
|
|
|
173
173
|
contentBlockIndex: Int
|
|
174
174
|
contentBlockText: String
|
|
175
175
|
contentBlockDeltaIndex: Int
|
|
176
|
-
contentBlockToolUse:
|
|
176
|
+
contentBlockToolUse: AmplifyAIToolUseBlock
|
|
177
177
|
contentBlockDoneAtIndex: Int
|
|
178
178
|
stopReason: String
|
|
179
|
-
errors: [
|
|
179
|
+
errors: [AmplifyAIConversationTurnError]
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
type
|
|
182
|
+
type AmplifyAIConversationTurnError @aws_cognito_user_pools {
|
|
183
183
|
message: String!
|
|
184
184
|
errorType: String!
|
|
185
185
|
}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationSchemaGraphQLTypes.mjs","sources":["../../../src/ai/ConversationSchemaGraphQLTypes.ts"],"sourcesContent":["export const CONVERSATION_SCHEMA_GRAPHQL_TYPES = \n/* GraphQL */ `enum
|
|
1
|
+
{"version":3,"file":"ConversationSchemaGraphQLTypes.mjs","sources":["../../../src/ai/ConversationSchemaGraphQLTypes.ts"],"sourcesContent":["export const CONVERSATION_SCHEMA_GRAPHQL_TYPES = \n/* GraphQL */ `enum AmplifyAIConversationParticipantRole {\n user\n assistant\n}\n\ninterface AmplifyAIConversationMessage {\n id: ID!\n conversationId: ID!\n associatedUserMessageId: ID\n role: AmplifyAIConversationParticipantRole\n content: [AmplifyAIContentBlock]\n aiContext: AWSJSON\n toolConfiguration: AmplifyAIToolConfiguration\n createdAt: AWSDateTime\n updatedAt: AWSDateTime\n owner: String\n}\n\ninput AmplifyAIDocumentBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIDocumentBlockInput {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSourceInput!\n}\n\ninput AmplifyAIImageBlockSourceInput {\n bytes: String\n}\n\ninput AmplifyAIImageBlockInput {\n format: String!\n source: AmplifyAIImageBlockSourceInput!\n}\n\ninput AmplifyAIToolUseBlockInput {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ninput AmplifyAIToolResultContentBlockInput {\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n json: AWSJSON\n text: String\n}\n\ninput AmplifyAIToolResultBlockInput {\n content: [AmplifyAIToolResultContentBlockInput!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIDocumentBlockSource {\n bytes: String\n}\n\ntype AmplifyAIDocumentBlock {\n format: String!\n name: String!\n source: AmplifyAIDocumentBlockSource!\n}\n\ntype AmplifyAIImageBlock {\n format: String!\n source: AmplifyAIImageBlockSource!\n}\n\ntype AmplifyAIImageBlockSource {\n bytes: String\n}\n\ntype AmplifyAIToolUseBlock {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}\n\ntype AmplifyAIToolResultContentBlock {\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n json: AWSJSON\n text: String\n}\n\ntype AmplifyAIToolResultBlock {\n content: [AmplifyAIToolResultContentBlock!]!\n toolUseId: String!\n status: String\n}\n\ntype AmplifyAIContentBlockText {\n text: String\n}\n\ntype AmplifyAIContentBlockImage {\n image: AmplifyAIImageBlock\n}\n\ntype AmplifyAIContentBlockDocument {\n document: AmplifyAIDocumentBlock\n}\n\ntype AmplifyAIContentBlockToolUse {\n toolUse: AmplifyAIToolUseBlock\n}\n\ntype AmplifyAIContentBlockToolResult {\n toolResult: AmplifyAIToolResultBlock\n}\n\ninput AmplifyAIContentBlockInput {\n text: String\n document: AmplifyAIDocumentBlockInput\n image: AmplifyAIImageBlockInput\n toolResult: AmplifyAIToolResultBlockInput\n toolUse: AmplifyAIToolUseBlockInput\n}\n\ntype AmplifyAIContentBlock {\n text: String\n document: AmplifyAIDocumentBlock\n image: AmplifyAIImageBlock\n toolResult: AmplifyAIToolResultBlock\n toolUse: AmplifyAIToolUseBlock\n}\n\ninput AmplifyAIToolConfigurationInput {\n tools: [AmplifyAIToolInput]\n}\n\ninput AmplifyAIToolInput {\n toolSpec: AmplifyAIToolSpecificationInput\n}\n\ninput AmplifyAIToolSpecificationInput {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchemaInput!\n}\n\ninput AmplifyAIToolInputSchemaInput {\n json: AWSJSON\n}\n\ntype AmplifyAIToolConfiguration {\n tools: [AmplifyAITool]\n}\n\ntype AmplifyAITool {\n toolSpec: AmplifyAIToolSpecification\n}\n\ntype AmplifyAIToolSpecification {\n name: String!\n description: String\n inputSchema: AmplifyAIToolInputSchema!\n}\n\ntype AmplifyAIToolInputSchema {\n json: AWSJSON\n}\n\ntype AmplifyAIConversationMessageStreamPart @aws_cognito_user_pools {\n id: ID!\n owner: String\n conversationId: ID!\n associatedUserMessageId: ID!\n contentBlockIndex: Int\n contentBlockText: String\n contentBlockDeltaIndex: Int\n contentBlockToolUse: AmplifyAIToolUseBlock\n contentBlockDoneAtIndex: Int\n stopReason: String\n errors: [AmplifyAIConversationTurnError]\n}\n\ntype AmplifyAIConversationTurnError @aws_cognito_user_pools {\n message: String!\n errorType: String!\n}`;\n"],"names":[],"mappings":"AAAY,MAAC,iCAAiC;AAC9C,cAAc,CAAC;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;"}
|
|
@@ -33,7 +33,7 @@ const createConversationField = (typeDef, typeName) => {
|
|
|
33
33
|
? `, tools: [${getConversationToolsString(tools)}]`
|
|
34
34
|
: '';
|
|
35
35
|
const conversationDirective = `@conversation(${argsString}${authString}${handlerString}${toolsString})`;
|
|
36
|
-
const field = `${typeName}(conversationId: ID!, content: [
|
|
36
|
+
const field = `${typeName}(conversationId: ID!, content: [AmplifyAIContentBlockInput], aiContext: AWSJSON, toolConfiguration: AmplifyAIToolConfigurationInput): AmplifyAIConversationMessage ${conversationDirective} @aws_cognito_user_pools`;
|
|
37
37
|
return { field, functionHandler };
|
|
38
38
|
};
|
|
39
39
|
const isRef = (query) => query?.data?.type === 'ref';
|