@aws-amplify/data-schema 1.9.1 → 1.9.2
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/SchemaProcessor.js +3 -1
- package/dist/cjs/SchemaProcessor.js.map +1 -1
- package/dist/cjs/ai/ConversationSchemaTypes.js +6 -7
- package/dist/cjs/ai/ConversationSchemaTypes.js.map +1 -1
- package/dist/esm/SchemaProcessor.mjs +3 -1
- package/dist/esm/SchemaProcessor.mjs.map +1 -1
- package/dist/esm/ai/ConversationSchemaTypes.d.ts +5 -1
- package/dist/esm/ai/ConversationSchemaTypes.mjs +6 -7
- package/dist/esm/ai/ConversationSchemaTypes.mjs.map +1 -1
- package/dist/esm/ai/ConversationType.d.ts +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/SchemaProcessor.ts +3 -1
- package/src/ai/ConversationSchemaTypes.ts +8 -7
- package/src/ai/ConversationType.ts +1 -1
|
@@ -18,13 +18,11 @@ const createConversationField = (typeDef, typeName) => {
|
|
|
18
18
|
// It doesn't affect non multi-line string inputs for system prompts
|
|
19
19
|
systemPrompt: systemPrompt.replace(/\r?\n/g, '\\n'),
|
|
20
20
|
};
|
|
21
|
+
const functionHandler = {};
|
|
21
22
|
if (handler) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
else if (typeof handler.getInstance === 'function') {
|
|
26
|
-
args['functionName'] = `Fn${(0, utils_1.capitalize)(typeName)}`;
|
|
27
|
-
}
|
|
23
|
+
const functionName = `Fn${(0, utils_1.capitalize)(typeName)}`;
|
|
24
|
+
args['functionName'] = functionName;
|
|
25
|
+
functionHandler[functionName] = handler;
|
|
28
26
|
}
|
|
29
27
|
const argsString = Object.entries(args)
|
|
30
28
|
.map(([key, value]) => `${key}: "${value}"`)
|
|
@@ -33,7 +31,8 @@ const createConversationField = (typeDef, typeName) => {
|
|
|
33
31
|
? `, tools: [${getConversationToolsString(tools)}]`
|
|
34
32
|
: '';
|
|
35
33
|
const conversationDirective = `@conversation(${argsString}${toolsString})`;
|
|
36
|
-
|
|
34
|
+
const field = `${typeName}(conversationId: ID!, content: [ContentBlockInput], aiContext: AWSJSON, toolConfiguration: ToolConfigurationInput): ConversationMessage ${conversationDirective} @aws_cognito_user_pools`;
|
|
35
|
+
return { field, functionHandler };
|
|
37
36
|
};
|
|
38
37
|
exports.createConversationField = createConversationField;
|
|
39
38
|
const isRef = (query) => query?.data?.type === 'ref';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationSchemaTypes.js","sources":["../../../src/ai/ConversationSchemaTypes.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.conversationTypes = exports.createConversationField = void 0;\nconst utils_1 = require(\"../runtime/utils\");\nconst createConversationField = (typeDef, typeName) => {\n const { aiModel, systemPrompt, handler, tools } = typeDef;\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 if (handler) {\n if (typeof handler === 'string') {\n args['functionName'] = handler;\n }\n else if (typeof handler.getInstance === 'function') {\n args['functionName'] = `Fn${(0, utils_1.capitalize)(typeName)}`;\n }\n }\n const argsString = Object.entries(args)\n .map(([key, value]) => `${key}: \"${value}\"`)\n .join(', ');\n const toolsString = tools?.length\n ? `, tools: [${getConversationToolsString(tools)}]`\n : '';\n const conversationDirective = `@conversation(${argsString}${toolsString})`;\n return `${typeName}(conversationId: ID!, content: [ContentBlockInput], aiContext: AWSJSON, toolConfiguration: ToolConfigurationInput): ConversationMessage ${conversationDirective} @aws_cognito_user_pools`;\n};\nexports.createConversationField = createConversationField;\nconst isRef = (query) => query?.data?.type === 'ref';\nconst getConversationToolsString = (tools) => tools\n .map((tool) => {\n const { query, description } = tool;\n if (!isRef(query)) {\n throw new Error(`Unexpected query was found in tool ${tool}.`);\n }\n // TODO: add validation for query / auth (cup) / etc\n const queryName = query.data.link;\n return `{ name: \"${queryName}\", description: \"${description}\" }`;\n})\n .join(', ');\nconst ConversationParticipantRole = `enum ConversationParticipantRole {\n user\n assistant\n}`;\nconst ConversationMessage = `interface ConversationMessage {\n id: ID!\n conversationId: ID!\n role: ConversationParticipantRole\n content: [ContentBlock]\n aiContext: AWSJSON\n toolConfiguration: ToolConfiguration\n createdAt: AWSDateTime\n updatedAt: AWSDateTime\n owner: String\n}`;\nconst DocumentBlockSourceInput = `input DocumentBlockSourceInput {\n bytes: String\n}`;\nconst DocumentBlockInput = `input DocumentBlockInput {\n format: String!\n name: String!\n source: DocumentBlockSourceInput!\n}`;\nconst ImageBlockSourceInput = `input ImageBlockSourceInput {\n bytes: String\n}`;\nconst ImageBlockInput = `input ImageBlockInput {\n format: String!\n source: ImageBlockSourceInput!\n}`;\nconst ToolResultContentBlockInput = `input ToolResultContentBlockInput {\n document: DocumentBlockInput\n image: ImageBlockInput\n json: AWSJSON\n text: String\n}`;\nconst ToolResultBlockInput = `input ToolResultBlockInput {\n content: [ToolResultContentBlockInput!]!\n toolUseId: String!\n status: String\n}`;\nconst DocumentBlockSource = `type DocumentBlockSource {\n bytes: String\n}\n`;\nconst DocumentBlock = `type DocumentBlock {\n format: String!\n name: String!\n source: DocumentBlockSource!\n}`;\nconst ImageBlock = `type ImageBlock {\n format: String!\n source: ImageBlockSource!\n}`;\nconst ImageBlockSource = `type ImageBlockSource {\n bytes: String\n}`;\nconst ToolUseBlockInput = `input ToolUseBlockInput {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}`;\nconst ToolUseBlock = `type ToolUseBlock {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}`;\nconst ToolResultContentBlock = `type ToolResultContentBlock {\n document: DocumentBlock\n image: ImageBlock\n json: AWSJSON\n text: String\n}`;\nconst ToolResultBlock = `type ToolResultBlock {\n content: [ToolResultContentBlock!]!\n toolUseId: String!\n status: String\n}`;\nconst ContentBlockText = `type ContentBlockText {\n text: String\n}`;\nconst ContentBlockImage = `type ContentBlockImage {\n image: ImageBlock\n}`;\nconst ContentBlockDocument = `type ContentBlockDocument {\n document: DocumentBlock\n}`;\nconst ContentBlockToolUse = `type ContentBlockToolUse {\n toolUse: ToolUseBlock\n}`;\nconst ContentBlockToolResult = `type ContentBlockToolResult {\n toolResult: ToolResultBlock\n}`;\nconst ContentBlockInput = `input ContentBlockInput {\n text: String\n document: DocumentBlockInput\n image: ImageBlockInput\n toolResult: ToolResultBlockInput\n toolUse: ToolUseBlockInput\n}`;\nconst ContentBlock = `type ContentBlock {\n text: String\n document: DocumentBlock\n image: ImageBlock\n toolResult: ToolResultBlock\n toolUse: ToolUseBlock\n}`;\nconst ToolConfigurationInput = `input ToolConfigurationInput {\n tools: [ToolInput]\n}`;\nconst ToolInput = `input ToolInput {\n toolSpec: ToolSpecificationInput\n}`;\nconst ToolSpecificationInput = `input ToolSpecificationInput {\n name: String!\n description: String\n inputSchema: ToolInputSchemaInput!\n}`;\nconst ToolInputSchemaInput = `input ToolInputSchemaInput {\n json: AWSJSON\n}`;\nconst ToolConfiguration = `type ToolConfiguration {\n tools: [Tool]\n}`;\nconst Tool = `type Tool {\n toolSpec: ToolSpecification\n}`;\nconst ToolSpecification = `type ToolSpecification {\n name: String!\n description: String\n inputSchema: ToolInputSchema!\n}`;\nconst ToolInputSchema = `type ToolInputSchema {\n json: AWSJSON\n}`;\nexports.conversationTypes = [\n ConversationParticipantRole,\n ConversationMessage,\n DocumentBlockSourceInput,\n DocumentBlockInput,\n ImageBlockSourceInput,\n ImageBlockInput,\n ToolUseBlockInput,\n ToolResultContentBlockInput,\n ToolResultBlockInput,\n DocumentBlockSource,\n DocumentBlock,\n ImageBlock,\n ImageBlockSource,\n ToolUseBlock,\n ToolResultContentBlock,\n ToolResultBlock,\n ContentBlockText,\n ContentBlockImage,\n ContentBlockDocument,\n ContentBlockToolUse,\n ContentBlockToolResult,\n ContentBlockInput,\n ContentBlock,\n ToolConfigurationInput,\n ToolInput,\n ToolSpecificationInput,\n ToolInputSchemaInput,\n ToolConfiguration,\n Tool,\n ToolSpecification,\n ToolInputSchema,\n];\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACrE,MAAM,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5C,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK;AACvD,IAAI,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;AAC9D,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,EAAE,OAAO,CAAC,YAAY;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC;AAC3D,KAAK,CAAC;AACN,IAAI,IAAI,OAAO,EAAE;AACjB,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AACzC,YAAY,IAAI,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC;AAC3C,SAAS;AACT,aAAa,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE;AAC5D,YAAY,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5E,SAAS;AACT,KAAK;AACL,IAAI,MAAM,UAAU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BAAiB;AACrB,IAAI,oBAAoB;AACxB,IAAI,mBAAmB;AACvB,IAAI,sBAAsB;AAC1B,IAAI,iBAAiB;AACrB,IAAI,YAAY;AAChB,IAAI,sBAAsB;AAC1B,IAAI,SAAS;AACb,IAAI,sBAAsB;AAC1B,IAAI,oBAAoB;AACxB,IAAI,iBAAiB;AACrB,IAAI,IAAI;AACR,IAAI,iBAAiB;AACrB,IAAI,eAAe;AACnB,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"ConversationSchemaTypes.js","sources":["../../../src/ai/ConversationSchemaTypes.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.conversationTypes = exports.createConversationField = void 0;\nconst utils_1 = require(\"../runtime/utils\");\nconst createConversationField = (typeDef, typeName) => {\n const { aiModel, systemPrompt, handler, tools } = typeDef;\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 functionHandler = {};\n if (handler) {\n const functionName = `Fn${(0, utils_1.capitalize)(typeName)}`;\n args['functionName'] = functionName;\n functionHandler[functionName] = handler;\n }\n const argsString = Object.entries(args)\n .map(([key, value]) => `${key}: \"${value}\"`)\n .join(', ');\n const toolsString = tools?.length\n ? `, tools: [${getConversationToolsString(tools)}]`\n : '';\n const conversationDirective = `@conversation(${argsString}${toolsString})`;\n const field = `${typeName}(conversationId: ID!, content: [ContentBlockInput], aiContext: AWSJSON, toolConfiguration: ToolConfigurationInput): ConversationMessage ${conversationDirective} @aws_cognito_user_pools`;\n return { field, functionHandler };\n};\nexports.createConversationField = createConversationField;\nconst isRef = (query) => query?.data?.type === 'ref';\nconst getConversationToolsString = (tools) => tools\n .map((tool) => {\n const { query, description } = tool;\n if (!isRef(query)) {\n throw new Error(`Unexpected query was found in tool ${tool}.`);\n }\n // TODO: add validation for query / auth (cup) / etc\n const queryName = query.data.link;\n return `{ name: \"${queryName}\", description: \"${description}\" }`;\n})\n .join(', ');\nconst ConversationParticipantRole = `enum ConversationParticipantRole {\n user\n assistant\n}`;\nconst ConversationMessage = `interface ConversationMessage {\n id: ID!\n conversationId: ID!\n role: ConversationParticipantRole\n content: [ContentBlock]\n aiContext: AWSJSON\n toolConfiguration: ToolConfiguration\n createdAt: AWSDateTime\n updatedAt: AWSDateTime\n owner: String\n}`;\nconst DocumentBlockSourceInput = `input DocumentBlockSourceInput {\n bytes: String\n}`;\nconst DocumentBlockInput = `input DocumentBlockInput {\n format: String!\n name: String!\n source: DocumentBlockSourceInput!\n}`;\nconst ImageBlockSourceInput = `input ImageBlockSourceInput {\n bytes: String\n}`;\nconst ImageBlockInput = `input ImageBlockInput {\n format: String!\n source: ImageBlockSourceInput!\n}`;\nconst ToolResultContentBlockInput = `input ToolResultContentBlockInput {\n document: DocumentBlockInput\n image: ImageBlockInput\n json: AWSJSON\n text: String\n}`;\nconst ToolResultBlockInput = `input ToolResultBlockInput {\n content: [ToolResultContentBlockInput!]!\n toolUseId: String!\n status: String\n}`;\nconst DocumentBlockSource = `type DocumentBlockSource {\n bytes: String\n}\n`;\nconst DocumentBlock = `type DocumentBlock {\n format: String!\n name: String!\n source: DocumentBlockSource!\n}`;\nconst ImageBlock = `type ImageBlock {\n format: String!\n source: ImageBlockSource!\n}`;\nconst ImageBlockSource = `type ImageBlockSource {\n bytes: String\n}`;\nconst ToolUseBlockInput = `input ToolUseBlockInput {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}`;\nconst ToolUseBlock = `type ToolUseBlock {\n toolUseId: String!\n name: String!\n input: AWSJSON!\n}`;\nconst ToolResultContentBlock = `type ToolResultContentBlock {\n document: DocumentBlock\n image: ImageBlock\n json: AWSJSON\n text: String\n}`;\nconst ToolResultBlock = `type ToolResultBlock {\n content: [ToolResultContentBlock!]!\n toolUseId: String!\n status: String\n}`;\nconst ContentBlockText = `type ContentBlockText {\n text: String\n}`;\nconst ContentBlockImage = `type ContentBlockImage {\n image: ImageBlock\n}`;\nconst ContentBlockDocument = `type ContentBlockDocument {\n document: DocumentBlock\n}`;\nconst ContentBlockToolUse = `type ContentBlockToolUse {\n toolUse: ToolUseBlock\n}`;\nconst ContentBlockToolResult = `type ContentBlockToolResult {\n toolResult: ToolResultBlock\n}`;\nconst ContentBlockInput = `input ContentBlockInput {\n text: String\n document: DocumentBlockInput\n image: ImageBlockInput\n toolResult: ToolResultBlockInput\n toolUse: ToolUseBlockInput\n}`;\nconst ContentBlock = `type ContentBlock {\n text: String\n document: DocumentBlock\n image: ImageBlock\n toolResult: ToolResultBlock\n toolUse: ToolUseBlock\n}`;\nconst ToolConfigurationInput = `input ToolConfigurationInput {\n tools: [ToolInput]\n}`;\nconst ToolInput = `input ToolInput {\n toolSpec: ToolSpecificationInput\n}`;\nconst ToolSpecificationInput = `input ToolSpecificationInput {\n name: String!\n description: String\n inputSchema: ToolInputSchemaInput!\n}`;\nconst ToolInputSchemaInput = `input ToolInputSchemaInput {\n json: AWSJSON\n}`;\nconst ToolConfiguration = `type ToolConfiguration {\n tools: [Tool]\n}`;\nconst Tool = `type Tool {\n toolSpec: ToolSpecification\n}`;\nconst ToolSpecification = `type ToolSpecification {\n name: String!\n description: String\n inputSchema: ToolInputSchema!\n}`;\nconst ToolInputSchema = `type ToolInputSchema {\n json: AWSJSON\n}`;\nexports.conversationTypes = [\n ConversationParticipantRole,\n ConversationMessage,\n DocumentBlockSourceInput,\n DocumentBlockInput,\n ImageBlockSourceInput,\n ImageBlockInput,\n ToolUseBlockInput,\n ToolResultContentBlockInput,\n ToolResultBlockInput,\n DocumentBlockSource,\n DocumentBlock,\n ImageBlock,\n ImageBlockSource,\n ToolUseBlock,\n ToolResultContentBlock,\n ToolResultBlock,\n ContentBlockText,\n ContentBlockImage,\n ContentBlockDocument,\n ContentBlockToolUse,\n ContentBlockToolResult,\n ContentBlockInput,\n ContentBlock,\n ToolConfigurationInput,\n ToolInput,\n ToolSpecificationInput,\n ToolInputSchemaInput,\n ToolConfiguration,\n Tool,\n ToolSpecification,\n ToolInputSchema,\n];\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACrE,MAAM,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5C,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK;AACvD,IAAI,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;AAC9D,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,EAAE,OAAO,CAAC,YAAY;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC;AAC3D,KAAK,CAAC;AACN,IAAI,MAAM,eAAe,GAAG,EAAE,CAAC;AAC/B,IAAI,IAAI,OAAO,EAAE;AACjB,QAAQ,MAAM,YAAY,GAAG,CAAC,EAAE,EAAE,IAAI,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACtE,QAAQ,IAAI,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;AAC5C,QAAQ,eAAe,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;AAChD,KAAK;AACL,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;AAC3C,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,K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mBAAmB;AACvB,IAAI,sBAAsB;AAC1B,IAAI,iBAAiB;AACrB,IAAI,YAAY;AAChB,IAAI,sBAAsB;AAC1B,IAAI,SAAS;AACb,IAAI,sBAAsB;AAC1B,IAAI,oBAAoB;AACxB,IAAI,iBAAiB;AACrB,IAAI,IAAI;AACR,IAAI,iBAAiB;AACrB,IAAI,eAAe;AACnB,CAAC;;"}
|
|
@@ -912,7 +912,9 @@ const schemaPreprocessor = (schema) => {
|
|
|
912
912
|
}
|
|
913
913
|
else if (isConversationRoute(typeDef)) {
|
|
914
914
|
// TODO: add inferenceConfiguration values to directive.
|
|
915
|
-
|
|
915
|
+
const { field, functionHandler } = createConversationField(typeDef, typeName);
|
|
916
|
+
customMutations.push(field);
|
|
917
|
+
Object.assign(lambdaFunctions, functionHandler);
|
|
916
918
|
shouldAddConversationTypes = true;
|
|
917
919
|
}
|
|
918
920
|
}
|