@aws-amplify/data-schema 1.25.1 → 1.25.3

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.
@@ -5,7 +5,7 @@ exports.createConversationField = void 0;
5
5
  const Authorization_1 = require("../Authorization");
6
6
  const utils_1 = require("../runtime/utils");
7
7
  const createConversationField = (typeDef, typeName) => {
8
- const { aiModel, systemPrompt, handler, tools } = typeDef;
8
+ const { aiModel, systemPrompt, inferenceConfiguration, handler, tools } = typeDef;
9
9
  const { strategy, provider } = extractAuthorization(typeDef, typeName);
10
10
  const args = {
11
11
  aiModel: aiModel.resourcePath,
@@ -20,9 +20,17 @@ const createConversationField = (typeDef, typeName) => {
20
20
  // It doesn't affect non multi-line string inputs for system prompts
21
21
  systemPrompt: systemPrompt.replace(/\r?\n/g, '\\n'),
22
22
  };
23
- const argsString = Object.entries(args)
24
- .map(([key, value]) => `${key}: "${value}"`)
25
- .join(', ');
23
+ // Add each arg with quotes (aiModel and systemPrompt)
24
+ const argsParts = [];
25
+ for (const [key, value] of Object.entries(args)) {
26
+ argsParts.push(`${key}: "${value}"`);
27
+ }
28
+ // Add inferenceConfiguration (do nothing if it doesn't exist or is empty)
29
+ const formattedInferenceConfig = formatInferenceConfig(inferenceConfiguration);
30
+ if (formattedInferenceConfig) {
31
+ argsParts.push(`inferenceConfiguration: ${formattedInferenceConfig}`);
32
+ }
33
+ const argsString = argsParts.join(', ');
26
34
  const authString = `, auth: { strategy: ${strategy}, provider: ${provider} }`;
27
35
  const functionHandler = {};
28
36
  let handlerString = '';
@@ -40,6 +48,22 @@ const createConversationField = (typeDef, typeName) => {
40
48
  return { field, functionHandler };
41
49
  };
42
50
  exports.createConversationField = createConversationField;
51
+ /**
52
+ * Format inferenceConfiguration as GraphQL input syntax.
53
+ * Returns null if config is undefined or has no valid properties.
54
+ */
55
+ const formatInferenceConfig = (config) => {
56
+ if (!config)
57
+ return null;
58
+ const parts = [];
59
+ if (config.temperature !== undefined)
60
+ parts.push(`temperature: ${config.temperature}`);
61
+ if (config.maxTokens !== undefined)
62
+ parts.push(`maxTokens: ${config.maxTokens}`);
63
+ if (config.topP !== undefined)
64
+ parts.push(`topP: ${config.topP}`);
65
+ return parts.length > 0 ? `{ ${parts.join(', ')} }` : null;
66
+ };
43
67
  const isRef = (query) => query?.data?.type === 'ref';
44
68
  const extractAuthorization = (typeDef, typeName) => {
45
69
  const { authorization } = typeDef.data;
@@ -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: [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":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,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,KAAK,CAAC,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC;;"}
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, inferenceConfiguration, 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 // Add each arg with quotes (aiModel and systemPrompt)\n const argsParts = [];\n for (const [key, value] of Object.entries(args)) {\n argsParts.push(`${key}: \"${value}\"`);\n }\n // Add inferenceConfiguration (do nothing if it doesn't exist or is empty)\n const formattedInferenceConfig = formatInferenceConfig(inferenceConfiguration);\n if (formattedInferenceConfig) {\n argsParts.push(`inferenceConfiguration: ${formattedInferenceConfig}`);\n }\n const argsString = argsParts.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;\n/**\n * Format inferenceConfiguration as GraphQL input syntax.\n * Returns null if config is undefined or has no valid properties.\n */\nconst formatInferenceConfig = (config) => {\n if (!config)\n return null;\n const parts = [];\n if (config.temperature !== undefined)\n parts.push(`temperature: ${config.temperature}`);\n if (config.maxTokens !== undefined)\n parts.push(`maxTokens: ${config.maxTokens}`);\n if (config.topP !== undefined)\n parts.push(`topP: ${config.topP}`);\n return parts.length > 0 ? `{ ${parts.join(', ')} }` : null;\n};\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":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uBAAuB,GAAG,MAAM;AACxC,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACnD,MAAM,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAC3C,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK;AACvD,IAAI,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO;AACrF,IAAI,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC1E,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;AACL;AACA,IAAI,MAAM,SAAS,GAAG,EAAE;AACxB,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACrD,QAAQ,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,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,QAAQ,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;AACnF,IAAI;AACJ,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1B,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC;;"}
@@ -1179,13 +1179,19 @@ const schemaPreprocessor = (schema) => {
1179
1179
  const refersToString = typeDef.data.originalName
1180
1180
  ? ` @refersTo(name: "${typeDef.data.originalName}")`
1181
1181
  : '';
1182
- // TODO: update @model(timestamps: null) once a longer term solution gets
1183
- // determined.
1184
- //
1185
- // Context: SQL schema should not be automatically inserted with timestamp fields,
1186
- // passing (timestamps: null) to @model to suppress this behavior as a short
1187
- // term solution.
1188
- const model = `type ${typeName} @model(timestamps: null) ${authString}${refersToString}\n{\n ${joined}\n}`;
1182
+ const disabledAttrs = modelAttributesFromDisabledOps(typeDef.data.disabledOperations);
1183
+ const modelAttrs = disabledAttrs
1184
+ ? `timestamps: null, ${disabledAttrs}`
1185
+ : 'timestamps: null';
1186
+ /*
1187
+ * TODO: update @model(timestamps: null) once a longer term solution gets
1188
+ * determined.
1189
+ *
1190
+ * Context: SQL schema should not be automatically inserted with timestamp
1191
+ * fields, passing (timestamps: null) to @model to suppress this behavior
1192
+ * as a short term solution.
1193
+ */
1194
+ const model = `type ${typeName} @model(${modelAttrs}) ${authString}${refersToString}\n{\n ${joined}\n}`;
1189
1195
  gqlModels.push(model);
1190
1196
  }
1191
1197
  else {