wirejs-deploy-amplify-basic 0.1.163-llm → 0.1.164
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/services/llm.d.ts
CHANGED
package/dist/services/llm.js
CHANGED
|
@@ -53,19 +53,37 @@ export class LLM extends BaseLLM {
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
|
|
65
|
-
'
|
|
66
|
-
'
|
|
56
|
+
getModelAliases() {
|
|
57
|
+
return {
|
|
58
|
+
// Anthropic Claude
|
|
59
|
+
'anthropic.claude-3-5-sonnet-20241022-v2:0': ['claude', 'claude-3.5-sonnet'],
|
|
60
|
+
'anthropic.claude-3-sonnet-20240229-v1:0': ['claude-3-sonnet'],
|
|
61
|
+
'anthropic.claude-3-5-haiku-20241022-v1:0': ['claude-3.5-haiku'],
|
|
62
|
+
'anthropic.claude-3-haiku-20240307-v1:0': ['claude-3-haiku'],
|
|
63
|
+
'anthropic.claude-3-opus-20240229-v1:0': ['claude-3-opus'],
|
|
64
|
+
// Meta Llama
|
|
65
|
+
'meta.llama3-2-90b-instruct-v1:0': ['llama3.2'],
|
|
66
|
+
'meta.llama3-2-8b-instruct-v1:0': ['llama3.2-8b'],
|
|
67
|
+
'meta.llama3-1-405b-instruct-v1:0': ['llama3.1'],
|
|
68
|
+
'meta.llama3-70b-instruct-v1:0': ['llama3'],
|
|
69
|
+
// Mistral
|
|
70
|
+
'mistral.mistral-large-2407-v1:0': ['mistral-large', 'mistral'],
|
|
71
|
+
'mistral.mistral-7b-instruct-v0:2': ['mistral-7b'],
|
|
72
|
+
// Amazon Nova (newer)
|
|
73
|
+
'amazon.nova-pro-v1:0': ['nova-pro'],
|
|
74
|
+
'amazon.nova-lite-v1:0': ['nova-lite'],
|
|
75
|
+
'amazon.nova-micro-v1:0': ['nova-micro']
|
|
67
76
|
};
|
|
68
|
-
|
|
77
|
+
}
|
|
78
|
+
getModelId(model) {
|
|
79
|
+
const normalized = model.trim().toLowerCase();
|
|
80
|
+
const modelAliases = this.getModelAliases();
|
|
81
|
+
for (const [canonicalModelId, aliases] of Object.entries(modelAliases)) {
|
|
82
|
+
if (normalized === canonicalModelId || aliases.includes(normalized)) {
|
|
83
|
+
return canonicalModelId;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return model;
|
|
69
87
|
}
|
|
70
88
|
async invokeBedrock(modelId, systemPrompt, messages, stream, tools, abortSignal) {
|
|
71
89
|
const toolConfig = tools && tools.length > 0 ? {
|
|
@@ -237,15 +255,16 @@ export class LLM extends BaseLLM {
|
|
|
237
255
|
async continueConversation({ history, onChunk, timeoutSeconds, systemPrompt, models, tools, }) {
|
|
238
256
|
const controller = new AbortController();
|
|
239
257
|
let timeoutId;
|
|
258
|
+
const intendedModels = models ?? this.models;
|
|
240
259
|
if (timeoutSeconds) {
|
|
241
260
|
timeoutId = setTimeout(() => {
|
|
242
261
|
controller.abort();
|
|
243
262
|
}, timeoutSeconds * 1000);
|
|
244
263
|
}
|
|
245
264
|
try {
|
|
246
|
-
// models are expected to be given in priority order.
|
|
247
|
-
// throw a fit wins.
|
|
248
|
-
for (const model of
|
|
265
|
+
// models are expected to be given in priority order.
|
|
266
|
+
// first one that doesn't throw a fit wins.
|
|
267
|
+
for (const model of intendedModels) {
|
|
249
268
|
try {
|
|
250
269
|
const result = await this.invokeModel(model, (systemPrompt ?? this.systemPrompt) ?? '', history, onChunk, controller.signal, tools ?? this.tools);
|
|
251
270
|
if (!result)
|
|
@@ -279,13 +298,14 @@ export class LLM extends BaseLLM {
|
|
|
279
298
|
if (timeoutId) {
|
|
280
299
|
clearTimeout(timeoutId);
|
|
281
300
|
}
|
|
282
|
-
const message = this.createBedrockInstructionMessage(`None of the attempted models are
|
|
283
|
-
`
|
|
301
|
+
const message = this.createBedrockInstructionMessage(`None of the attempted models are suitable for this request. ` +
|
|
302
|
+
`Review CloudWatch logs to see the reason why. If necessary:\n\n` +
|
|
284
303
|
`1. Go to AWS Bedrock Console (https://console.aws.amazon.com/bedrock/)\n` +
|
|
285
304
|
`2. Navigate to "Model access"\n` +
|
|
286
|
-
`3. Request access to the model\n` +
|
|
287
|
-
`
|
|
288
|
-
`
|
|
305
|
+
`3. Request access to and accept the model's End User License Agreement (EULA)\n\n` +
|
|
306
|
+
`Models attempted: ${intendedModels.join(', ')}\n\n` +
|
|
307
|
+
`Note: The following friendly aliases are available:\n` +
|
|
308
|
+
`${Object.entries(this.getModelAliases()).map(([name, aliases]) => `${name}: ${aliases.join(', ')}`).join('\n')}`);
|
|
289
309
|
if (onChunk) {
|
|
290
310
|
try {
|
|
291
311
|
await onChunk({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-deploy-amplify-basic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.164",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"recursive-copy": "^2.0.14",
|
|
45
45
|
"rimraf": "^6.0.1",
|
|
46
46
|
"wirejs-dom": "^1.0.44",
|
|
47
|
-
"wirejs-resources": "^0.1.
|
|
47
|
+
"wirejs-resources": "^0.1.164"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@aws-amplify/backend": "^1.14.0",
|