@aws-amplify/data-schema 1.25.2 → 1.25.4
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/CombineSchema.js.map +1 -1
- package/dist/cjs/ModelRelationshipField.js.map +1 -1
- package/dist/cjs/RefType.js.map +1 -1
- package/dist/cjs/ai/ConversationSchemaProcessor.js +28 -4
- package/dist/cjs/ai/ConversationSchemaProcessor.js.map +1 -1
- package/dist/cjs/ai/ModelType.js +3 -0
- package/dist/cjs/ai/ModelType.js.map +1 -1
- package/dist/cjs/runtime/internals/APIClient.js +0 -5
- package/dist/cjs/runtime/internals/APIClient.js.map +1 -1
- package/dist/cjs/runtime/internals/operations/indexQuery.js +2 -0
- package/dist/cjs/runtime/internals/operations/indexQuery.js.map +1 -1
- package/dist/esm/CombineSchema.d.ts +2 -2
- package/dist/esm/CombineSchema.mjs.map +1 -1
- package/dist/esm/ModelRelationshipField.d.ts +2 -2
- package/dist/esm/ModelRelationshipField.mjs.map +1 -1
- package/dist/esm/RefType.d.ts +2 -2
- package/dist/esm/RefType.mjs.map +1 -1
- package/dist/esm/ai/ConversationSchemaProcessor.mjs +28 -4
- package/dist/esm/ai/ConversationSchemaProcessor.mjs.map +1 -1
- package/dist/esm/ai/ModelType.d.ts +2 -0
- package/dist/esm/ai/ModelType.mjs +3 -0
- package/dist/esm/ai/ModelType.mjs.map +1 -1
- package/dist/esm/runtime/internals/APIClient.mjs +0 -5
- package/dist/esm/runtime/internals/APIClient.mjs.map +1 -1
- package/dist/esm/runtime/internals/operations/indexQuery.mjs +2 -0
- package/dist/esm/runtime/internals/operations/indexQuery.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/CombineSchema.ts +2 -2
- package/src/ModelRelationshipField.ts +4 -4
- package/src/RefType.ts +2 -2
- package/src/ai/ConversationSchemaProcessor.ts +37 -4
- package/src/ai/ModelType.ts +3 -0
- package/src/runtime/internals/APIClient.ts +0 -5
- package/src/runtime/internals/operations/indexQuery.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CombineSchema.js","sources":["../../src/CombineSchema.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.combinedSchemaBrand = void 0;\nexports.combine = combine;\nconst util_1 = require(\"./util\");\nconst
|
|
1
|
+
{"version":3,"file":"CombineSchema.js","sources":["../../src/CombineSchema.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.combinedSchemaBrand = void 0;\nexports.combine = combine;\nconst util_1 = require(\"./util\");\nconst _COMBINED_SCHEMA_LIMIT = 50;\nconst CombinedSchemaBrandName = 'CombinedSchema';\nexports.combinedSchemaBrand = (0, util_1.brand)(CombinedSchemaBrandName);\n/**\n * The interface for merging up to 50 schemas into a single API.\n * @param schemas The schemas to combine into a single API\n * @returns An API and data model definition to be deployed with Amplify (Gen 2) experience (`processSchema(...)`)\n * or with the Amplify Data CDK construct (`@aws-amplify/data-construct`)\n */\nfunction combine(schemas) {\n return internalCombine(schemas);\n}\nfunction internalCombine(schemas) {\n validateDuplicateTypeNames(schemas);\n const combined = {\n ...exports.combinedSchemaBrand,\n schemas: schemas,\n };\n for (const schema of combined.schemas) {\n schema.context = combined;\n }\n return combined;\n}\nfunction validateDuplicateTypeNames(schemas) {\n const allSchemaKeys = schemas.flatMap((s) => Object.keys(s.data.types));\n const keySet = new Set();\n const duplicateKeySet = new Set();\n allSchemaKeys.forEach((key) => {\n if (keySet.has(key)) {\n duplicateKeySet.add(key);\n }\n else {\n keySet.add(key);\n }\n });\n if (duplicateKeySet.size > 0) {\n throw new Error(`The schemas you are attempting to combine have a name collision. Please remove or rename ${Array.from(duplicateKeySet).join(', ')}.`);\n }\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAA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I,CAAC,CAAC;AACN,IAAI,IAAI,eAAe,CAAC,IAAI,GAAG,CAAC,EAAE;AAClC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,yFAAyF,EAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9J,IAAI;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelRelationshipField.js","sources":["../../src/ModelRelationshipField.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ModelRelationshipTypes = exports.__auth = void 0;\nexports.hasOne = hasOne;\nexports.hasMany = hasMany;\nexports.belongsTo = belongsTo;\nconst Authorization_1 = require(\"./Authorization\");\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexports.__auth = Symbol('__auth');\nconst
|
|
1
|
+
{"version":3,"file":"ModelRelationshipField.js","sources":["../../src/ModelRelationshipField.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ModelRelationshipTypes = exports.__auth = void 0;\nexports.hasOne = hasOne;\nexports.hasMany = hasMany;\nexports.belongsTo = belongsTo;\nconst Authorization_1 = require(\"./Authorization\");\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexports.__auth = Symbol('__auth');\nconst _brandName = 'modelRelationshipField';\n/**\n * Model relationship types\n */\nvar ModelRelationshipTypes;\n(function (ModelRelationshipTypes) {\n ModelRelationshipTypes[\"hasOne\"] = \"hasOne\";\n ModelRelationshipTypes[\"hasMany\"] = \"hasMany\";\n ModelRelationshipTypes[\"belongsTo\"] = \"belongsTo\";\n})(ModelRelationshipTypes || (exports.ModelRelationshipTypes = ModelRelationshipTypes = {}));\nconst _relationshipModifiers = [\n 'required',\n 'valueRequired',\n 'authorization',\n];\nconst relationModifierMap = {\n belongsTo: ['authorization'],\n hasMany: ['valueRequired', 'authorization'],\n hasOne: ['required', 'authorization'],\n};\nfunction _modelRelationshipField(type, relatedModel, references) {\n const data = {\n relatedModel,\n type,\n fieldType: 'model',\n array: false,\n valueRequired: false,\n arrayRequired: false,\n references,\n authorization: [],\n };\n data.array = type === 'hasMany';\n const relationshipBuilderFunctions = {\n required() {\n data.arrayRequired = true;\n return this;\n },\n valueRequired() {\n data.valueRequired = true;\n return this;\n },\n authorization(callback) {\n const rules = callback(Authorization_1.allow);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n };\n const builder = Object.fromEntries(relationModifierMap[type].map((key) => [\n key,\n relationshipBuilderFunctions[key],\n ]));\n return {\n ...builder,\n data,\n };\n}\n/**\n * Create one-to-one relationship between two models using the `hasOne(\"MODEL_NAME\", \"REFERENCE_FIELD(s)\")` method.\n * A hasOne relationship always uses a reference to the related model's identifier. Typically this is the `id` field\n * unless overwritten with the `identifier()` method.\n * @example\n * const schema = a.schema({\n * Cart: a.model({\n * items: a.string().required().array(),\n * // 1. Create reference field\n * customerId: a.id(),\n * // 2. Create relationship field with the reference field\n * customer: a.belongsTo('Customer', 'customerId'),\n * }),\n * Customer: a.model({\n * name: a.string(),\n * // 3. Create relationship field with the reference field\n * // from the Cart model\n * activeCart: a.hasOne('Cart', 'customerId')\n * }),\n * });\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-a-one-to-one-relationship}\n * @param relatedModel the name of the related model\n * @param references the field(s) that should be used to reference the related model\n * @returns a one-to-one relationship definition\n */\nfunction hasOne(relatedModel, references) {\n return _modelRelationshipField(ModelRelationshipTypes.hasOne, relatedModel, Array.isArray(references) ? references : [references]);\n}\n/**\n * Create a one-directional one-to-many relationship between two models using the `hasMany(\"MODEL_NAME\", \"REFERENCE_FIELD(s)\")` method.\n * @example\n * const schema = a.schema({\n * Member: a.model({\n * name: a.string().required(),\n * // 1. Create a reference field\n * teamId: a.id(),\n * // 2. Create a belongsTo relationship with the reference field\n * team: a.belongsTo('Team', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n *\n * Team: a.model({\n * mantra: a.string().required(),\n * // 3. Create a hasMany relationship with the reference field\n * // from the `Member`s model.\n * members: a.hasMany('Member', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n * });\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-one-to-many-relationships}\n * @param relatedModel the name of the related model\n * @param references the field(s) that should be used to reference the related model\n * @returns a one-to-many relationship definition\n */\nfunction hasMany(relatedModel, references) {\n return _modelRelationshipField(ModelRelationshipTypes.hasMany, relatedModel, Array.isArray(references) ? references : [references]);\n}\n/**\n * Use `belongsTo()` to create a field to query the related `hasOne()` or `hasMany()` relationship.\n * The belongsTo() method requires that a hasOne() or hasMany() relationship already exists from\n * parent to the related model.\n *\n * @example\n * // one-to-many relationship\n * const schema = a.schema({\n * Member: a.model({\n * name: a.string().required(),\n * // 1. Create a reference field\n * teamId: a.id(),\n * // 2. Create a belongsTo relationship with the reference field\n * team: a.belongsTo('Team', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n *\n * Team: a.model({\n * mantra: a.string().required(),\n * // 3. Create a hasMany relationship with the reference field\n * // from the `Member`s model.\n * members: a.hasMany('Member', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n * });\n * @example\n * // one-to-one relationship\n * const schema = a.schema({\n * Cart: a.model({\n * items: a.string().required().array(),\n * // 1. Create reference field\n * customerId: a.id(),\n * // 2. Create relationship field with the reference field\n * customer: a.belongsTo('Customer', 'customerId'),\n * }),\n * Customer: a.model({\n * name: a.string(),\n * // 3. Create relationship field with the reference field\n * // from the Cart model\n * activeCart: a.hasOne('Cart', 'customerId')\n * }),\n * });\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/}\n * @param relatedModel name of the related `.hasOne()` or `.hasMany()` model\n * @param references the field(s) that should be used to reference the related model\n * @returns a belong-to relationship definition\n */\nfunction belongsTo(relatedModel, references) {\n return _modelRelationshipField(ModelRelationshipTypes.belongsTo, relatedModel, Array.isArray(references) ? references : [references]);\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM;AACxD,OAAO,CAAC,MAAM,GAAG,MAAM;AACvB,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAClD;AACA;AACA;AACA,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;AAEjC;AACA;AACA;AACA,IAAI,sBAAsB;AAC1B,CAAC,UAAU,sBAAsB,EAAE;AACnC,IAAI,sBAAsB,CAAC,QAAQ,CAAC,GAAG,QAAQ;AAC/C,IAAI,sBAAsB,CAAC,SAAS,CAAC,GAAG,SAAS;AACjD,IAAI,sBAAsB,CAAC,WAAW,CAAC,GAAG,WAAW;AACrD,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,GAAG,sBAAsB,GAAG,EAAE,CAAC,CAAC;AAM5F,MAAM,mBAAmB,GAAG;AAC5B,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC;AAChC,IAAI,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;AAC/C,IAAI,MAAM,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC;AACzC,CAAC;AACD,SAAS,uBAAuB,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE;AACjE,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,YAAY;AACpB,QAAQ,IAAI;AACZ,QAAQ,SAAS,EAAE,OAAO;AAC1B,QAAQ,KAAK,EAAE,KAAK;AACpB,QAAQ,aAAa,EAAE,KAAK;AAC5B,QAAQ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,UAAU,CAAC,CAAC;AACtI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,YAAY,EAAE,UAAU,EAAE;AAC3C,IAAI,OAAO,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC,UAAU,CAAC,CAAC;AACvI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS,CAAC,YAAY,EAAE,UAAU,EAAE;AAC7C,IAAI,OAAO,uBAAuB,CAAC,sBAAsB,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC,UAAU,CAAC,CAAC;AACzI;;"}
|
package/dist/cjs/RefType.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefType.js","sources":["../../src/RefType.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ref = ref;\nconst Authorization_1 = require(\"./Authorization\");\nconst ModelField_1 = require(\"./ModelField\");\nconst
|
|
1
|
+
{"version":3,"file":"RefType.js","sources":["../../src/RefType.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ref = ref;\nconst Authorization_1 = require(\"./Authorization\");\nconst ModelField_1 = require(\"./ModelField\");\nconst _brandName = 'ref';\nfunction brandedBuilder(builder) {\n return builder;\n}\nfunction _ref(link) {\n const data = {\n type: 'ref',\n link,\n valueRequired: false,\n array: false,\n arrayRequired: false,\n mutationOperations: [],\n authorization: [],\n };\n const builder = brandedBuilder({\n required() {\n if (data.array) {\n data.arrayRequired = true;\n }\n else {\n data.valueRequired = true;\n }\n return this;\n },\n array() {\n data.array = true;\n return this;\n },\n authorization(callback) {\n const rules = callback(Authorization_1.allow);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n mutations(operations) {\n data.mutationOperations = operations;\n return this;\n },\n });\n return { ...builder, data };\n}\nfunction ref(link) {\n return _ref(link);\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,GAAG,GAAG,GAAG;AACjB,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC7B,OAAO,CAAC,cAAc;AAE3C,SAAS,cAAc,CAAC,OAAO,EAAE;AACjC,IAAI,OAAO,OAAO;AAClB;AACA,SAAS,IAAI,CAAC,IAAI,EAAE;AACpB,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,EAAE,KAAK;AACnB,QAAQ,IAAI;AACZ,QAAQ,aAAa,EAAE,KAAK;AAC5B,QAAQ,KAAK,EAAE,KAAK;AACpB,QAAQ,aAAa,EAAE,KAAK;AAC5B,QAAQ,kBAAkB,EAAE,EAAE;AAC9B,QAAQ,aAAa,EAAE,EAAE;AACzB,KAAK;AACL,IAAI,MAAM,OAAO,GAAG,cAAc,CAAC;AACnC,QAAQ,QAAQ,GAAG;AACnB,YAAY,IAAI,IAAI,CAAC,KAAK,EAAE;AAC5B,gBAAgB,IAAI,CAAC,aAAa,GAAG,IAAI;AACzC,YAAY;AACZ,iBAAiB;AACjB,gBAAgB,IAAI,CAAC,aAAa,GAAG,IAAI;AACzC,YAAY;AACZ,YAAY,OAAO,IAAI;AACvB,QAAQ,CAAC;AACT,QAAQ,KAAK,GAAG;AAChB,YAAY,IAAI,CAAC,KAAK,GAAG,IAAI;AAC7B,YAAY,OAAO,IAAI;AACvB,QAAQ,CAAC;AACT,QAAQ,aAAa,CAAC,QAAQ,EAAE;AAChC,YAAY,MAAM,KAAK,GAAG,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC;AACzD,YAAY,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AACvE,YAAY,OAAO,IAAI;AACvB,QAAQ,CAAC;AACT,QAAQ,SAAS,CAAC,UAAU,EAAE;AAC9B,YAAY,IAAI,CAAC,kBAAkB,GAAG,UAAU;AAChD,YAAY,OAAO,IAAI;AACvB,QAAQ,CAAC;AACT,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE;AAC/B;AACA,SAAS,GAAG,CAAC,IAAI,EAAE;AACnB,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC;AACrB;;"}
|
|
@@ -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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
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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,CAAC;AACf,MAAM,qBAAqB,GAAG,CAAC,IAAI,KAAK;AACxC,IAAI,IAAI,OAAO,IAAI,IAAI,EAAE;AACzB,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC9B,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1E,QAAQ,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI;AAC9C,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;;"}
|
package/dist/cjs/ai/ModelType.js
CHANGED
|
@@ -23,6 +23,9 @@ const supportedModelsLookup = {
|
|
|
23
23
|
'Claude Haiku 4.5': 'global.anthropic.claude-haiku-4-5-20251001-v1:0',
|
|
24
24
|
'Claude Sonnet 4.5': 'global.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
25
25
|
'Claude Opus 4.5': 'global.anthropic.claude-opus-4-5-20251101-v1:0',
|
|
26
|
+
// Claude 4.6 models (require global inference profiles)
|
|
27
|
+
'Claude Sonnet 4.6': 'global.anthropic.claude-sonnet-4-6',
|
|
28
|
+
'Claude Opus 4.6': 'global.anthropic.claude-opus-4-6-v1',
|
|
26
29
|
// Cohere models
|
|
27
30
|
'Cohere Command R': 'cohere.command-r-v1:0',
|
|
28
31
|
'Cohere Command R+': 'cohere.command-r-plus-v1:0',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelType.js","sources":["../../../src/ai/ModelType.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.model = model;\nconst supportedModelsLookup = {\n // Amazon Nova models\n 'Amazon Nova Pro': 'amazon.nova-pro-v1:0',\n 'Amazon Nova Lite': 'amazon.nova-lite-v1:0',\n 'Amazon Nova Micro': 'amazon.nova-micro-v1:0',\n // Anthropic models\n 'Claude 3 Haiku': 'anthropic.claude-3-haiku-20240307-v1:0',\n 'Claude 3 Opus': 'anthropic.claude-3-opus-20240229-v1:0',\n 'Claude 3 Sonnet': 'anthropic.claude-3-sonnet-20240229-v1:0',\n 'Claude 3.5 Haiku': 'anthropic.claude-3-5-haiku-20241022-v1:0',\n 'Claude 3.5 Sonnet': 'anthropic.claude-3-5-sonnet-20240620-v1:0',\n 'Claude 3.5 Sonnet v2': 'anthropic.claude-3-5-sonnet-20241022-v2:0',\n 'Claude 3.7 Sonnet': 'anthropic.claude-3-7-sonnet-20250219-v1:0',\n 'Claude Opus 4': 'anthropic.claude-opus-4-20250514-v1:0',\n 'Claude Sonnet 4': 'anthropic.claude-sonnet-4-20250514-v1:0',\n // Claude 4.5 models (require global inference profiles)\n 'Claude Haiku 4.5': 'global.anthropic.claude-haiku-4-5-20251001-v1:0',\n 'Claude Sonnet 4.5': 'global.anthropic.claude-sonnet-4-5-20250929-v1:0',\n 'Claude Opus 4.5': 'global.anthropic.claude-opus-4-5-20251101-v1:0',\n // Cohere models\n 'Cohere Command R': 'cohere.command-r-v1:0',\n 'Cohere Command R+': 'cohere.command-r-plus-v1:0',\n // Meta models\n 'Llama 3.1 8B Instruct': 'meta.llama3-1-8b-instruct-v1:0',\n 'Llama 3.1 70B Instruct': 'meta.llama3-1-70b-instruct-v1:0',\n 'Llama 3.1 405B Instruct': 'meta.llama3-1-405b-instruct-v1:0',\n // Mistral AI models\n 'Mistral Large': 'mistral.mistral-large-2402-v1:0',\n 'Mistral Large 2': 'mistral.mistral-large-2407-v1:0',\n 'Mistral Small': 'mistral.mistral-small-2402-v1:0',\n};\n/**\n * Bedrock models currently supporting Converse API and Tool use\n * @see {@link https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features}\n */\nfunction model(modelName) {\n return {\n resourcePath: supportedModelsLookup[modelName],\n };\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,MAAM,qBAAqB,GAAG;AAC9B;AACA,IAAI,iBAAiB,EAAE,sBAAsB;AAC7C,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,wBAAwB;AACjD;AACA,IAAI,gBAAgB,EAAE,wCAAwC;AAC9D,IAAI,eAAe,EAAE,uCAAuC;AAC5D,IAAI,iBAAiB,EAAE,yCAAyC;AAChE,IAAI,kBAAkB,EAAE,0CAA0C;AAClE,IAAI,mBAAmB,EAAE,2CAA2C;AACpE,IAAI,sBAAsB,EAAE,2CAA2C;AACvE,IAAI,mBAAmB,EAAE,2CAA2C;AACpE,IAAI,eAAe,EAAE,uCAAuC;AAC5D,IAAI,iBAAiB,EAAE,yCAAyC;AAChE;AACA,IAAI,kBAAkB,EAAE,iDAAiD;AACzE,IAAI,mBAAmB,EAAE,kDAAkD;AAC3E,IAAI,iBAAiB,EAAE,gDAAgD;AACvE;AACA,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,4BAA4B;AACrD;AACA,IAAI,uBAAuB,EAAE,gCAAgC;AAC7D,IAAI,wBAAwB,EAAE,iCAAiC;AAC/D,IAAI,yBAAyB,EAAE,kCAAkC;AACjE;AACA,IAAI,eAAe,EAAE,iCAAiC;AACtD,IAAI,iBAAiB,EAAE,iCAAiC;AACxD,IAAI,eAAe,EAAE,iCAAiC;AACtD,CAAC;AACD;AACA;AACA;AACA;AACA,SAAS,KAAK,CAAC,SAAS,EAAE;AAC1B,IAAI,OAAO;AACX,QAAQ,YAAY,EAAE,qBAAqB,CAAC,SAAS,CAAC;AACtD,KAAK;AACL;;"}
|
|
1
|
+
{"version":3,"file":"ModelType.js","sources":["../../../src/ai/ModelType.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.model = model;\nconst supportedModelsLookup = {\n // Amazon Nova models\n 'Amazon Nova Pro': 'amazon.nova-pro-v1:0',\n 'Amazon Nova Lite': 'amazon.nova-lite-v1:0',\n 'Amazon Nova Micro': 'amazon.nova-micro-v1:0',\n // Anthropic models\n 'Claude 3 Haiku': 'anthropic.claude-3-haiku-20240307-v1:0',\n 'Claude 3 Opus': 'anthropic.claude-3-opus-20240229-v1:0',\n 'Claude 3 Sonnet': 'anthropic.claude-3-sonnet-20240229-v1:0',\n 'Claude 3.5 Haiku': 'anthropic.claude-3-5-haiku-20241022-v1:0',\n 'Claude 3.5 Sonnet': 'anthropic.claude-3-5-sonnet-20240620-v1:0',\n 'Claude 3.5 Sonnet v2': 'anthropic.claude-3-5-sonnet-20241022-v2:0',\n 'Claude 3.7 Sonnet': 'anthropic.claude-3-7-sonnet-20250219-v1:0',\n 'Claude Opus 4': 'anthropic.claude-opus-4-20250514-v1:0',\n 'Claude Sonnet 4': 'anthropic.claude-sonnet-4-20250514-v1:0',\n // Claude 4.5 models (require global inference profiles)\n 'Claude Haiku 4.5': 'global.anthropic.claude-haiku-4-5-20251001-v1:0',\n 'Claude Sonnet 4.5': 'global.anthropic.claude-sonnet-4-5-20250929-v1:0',\n 'Claude Opus 4.5': 'global.anthropic.claude-opus-4-5-20251101-v1:0',\n // Claude 4.6 models (require global inference profiles)\n 'Claude Sonnet 4.6': 'global.anthropic.claude-sonnet-4-6',\n 'Claude Opus 4.6': 'global.anthropic.claude-opus-4-6-v1',\n // Cohere models\n 'Cohere Command R': 'cohere.command-r-v1:0',\n 'Cohere Command R+': 'cohere.command-r-plus-v1:0',\n // Meta models\n 'Llama 3.1 8B Instruct': 'meta.llama3-1-8b-instruct-v1:0',\n 'Llama 3.1 70B Instruct': 'meta.llama3-1-70b-instruct-v1:0',\n 'Llama 3.1 405B Instruct': 'meta.llama3-1-405b-instruct-v1:0',\n // Mistral AI models\n 'Mistral Large': 'mistral.mistral-large-2402-v1:0',\n 'Mistral Large 2': 'mistral.mistral-large-2407-v1:0',\n 'Mistral Small': 'mistral.mistral-small-2402-v1:0',\n};\n/**\n * Bedrock models currently supporting Converse API and Tool use\n * @see {@link https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features}\n */\nfunction model(modelName) {\n return {\n resourcePath: supportedModelsLookup[modelName],\n };\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,MAAM,qBAAqB,GAAG;AAC9B;AACA,IAAI,iBAAiB,EAAE,sBAAsB;AAC7C,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,wBAAwB;AACjD;AACA,IAAI,gBAAgB,EAAE,wCAAwC;AAC9D,IAAI,eAAe,EAAE,uCAAuC;AAC5D,IAAI,iBAAiB,EAAE,yCAAyC;AAChE,IAAI,kBAAkB,EAAE,0CAA0C;AAClE,IAAI,mBAAmB,EAAE,2CAA2C;AACpE,IAAI,sBAAsB,EAAE,2CAA2C;AACvE,IAAI,mBAAmB,EAAE,2CAA2C;AACpE,IAAI,eAAe,EAAE,uCAAuC;AAC5D,IAAI,iBAAiB,EAAE,yCAAyC;AAChE;AACA,IAAI,kBAAkB,EAAE,iDAAiD;AACzE,IAAI,mBAAmB,EAAE,kDAAkD;AAC3E,IAAI,iBAAiB,EAAE,gDAAgD;AACvE;AACA,IAAI,mBAAmB,EAAE,oCAAoC;AAC7D,IAAI,iBAAiB,EAAE,qCAAqC;AAC5D;AACA,IAAI,kBAAkB,EAAE,uBAAuB;AAC/C,IAAI,mBAAmB,EAAE,4BAA4B;AACrD;AACA,IAAI,uBAAuB,EAAE,gCAAgC;AAC7D,IAAI,wBAAwB,EAAE,iCAAiC;AAC/D,IAAI,yBAAyB,EAAE,kCAAkC;AACjE;AACA,IAAI,eAAe,EAAE,iCAAiC;AACtD,IAAI,iBAAiB,EAAE,iCAAiC;AACxD,IAAI,eAAe,EAAE,iCAAiC;AACtD,CAAC;AACD;AACA;AACA;AACA;AACA,SAAS,KAAK,CAAC,SAAS,EAAE;AAC1B,IAAI,OAAO;AACX,QAAQ,YAAY,EAAE,qBAAqB,CAAC,SAAS,CAAC;AACtD,KAAK;AACL;;"}
|
|
@@ -176,7 +176,6 @@ function initializeModel(client, modelName, result, modelIntrospection, authMode
|
|
|
176
176
|
case connectionType.BELONGS_TO: {
|
|
177
177
|
const sortKeyValues = relatedModelSKFieldNames.reduce(
|
|
178
178
|
// TODO(Eslint): is this implementation correct?
|
|
179
|
-
// eslint-disable-next-line array-callback-return
|
|
180
179
|
(acc, curVal) => {
|
|
181
180
|
if (record[curVal]) {
|
|
182
181
|
acc[curVal] = record[curVal];
|
|
@@ -732,12 +731,10 @@ function generateGraphQLDocument(modelIntrospection, modelDefinition, modelOpera
|
|
|
732
731
|
});
|
|
733
732
|
graphQLOperationType ?? (graphQLOperationType = 'mutation');
|
|
734
733
|
// TODO(Eslint): this this case clause correct without the break statement?
|
|
735
|
-
// eslint-disable-next-line no-fallthrough
|
|
736
734
|
case 'GET':
|
|
737
735
|
graphQLArguments ?? (graphQLArguments = getPkArgs);
|
|
738
736
|
graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);
|
|
739
737
|
// TODO(Eslint): this this case clause correct without the break statement?
|
|
740
|
-
// eslint-disable-next-line no-fallthrough
|
|
741
738
|
case 'LIST':
|
|
742
739
|
graphQLArguments ??
|
|
743
740
|
(graphQLArguments = {
|
|
@@ -756,7 +753,6 @@ function generateGraphQLDocument(modelIntrospection, modelDefinition, modelOpera
|
|
|
756
753
|
graphQLSelectionSet ??
|
|
757
754
|
(graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);
|
|
758
755
|
// TODO(Eslint): this this case clause correct without the break statement?
|
|
759
|
-
// eslint-disable-next-line no-fallthrough
|
|
760
756
|
case 'INDEX_QUERY':
|
|
761
757
|
graphQLArguments ??
|
|
762
758
|
(graphQLArguments = {
|
|
@@ -770,7 +766,6 @@ function generateGraphQLDocument(modelIntrospection, modelDefinition, modelOpera
|
|
|
770
766
|
graphQLSelectionSet ??
|
|
771
767
|
(graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);
|
|
772
768
|
// TODO(Eslint): this this case clause correct without the break statement?
|
|
773
|
-
// eslint-disable-next-line no-fallthrough
|
|
774
769
|
case 'ONCREATE':
|
|
775
770
|
case 'ONUPDATE':
|
|
776
771
|
case 'ONDELETE':
|