wirejs-deploy-amplify-basic 0.1.139-llm → 0.1.141-llm
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.js
CHANGED
|
@@ -34,6 +34,7 @@ export class LLM extends BaseLLM {
|
|
|
34
34
|
'claude-opus': 'anthropic.claude-3-opus-20240229-v1:0',
|
|
35
35
|
'llama2': 'meta.llama2-70b-chat-v1',
|
|
36
36
|
'llama3': 'meta.llama3-70b-instruct-v1:0',
|
|
37
|
+
'llama3.2': 'meta.llama3-2-90b-instruct-v1:0'
|
|
37
38
|
};
|
|
38
39
|
return modelMap[model] || model;
|
|
39
40
|
}
|
|
@@ -95,6 +96,8 @@ export class LLM extends BaseLLM {
|
|
|
95
96
|
for (let i = 0; i < maxRetries; i++) {
|
|
96
97
|
try {
|
|
97
98
|
const modelId = this.getModelId(model);
|
|
99
|
+
if (modelId !== model)
|
|
100
|
+
console.log(`Mapped ${model} to ${modelId}`);
|
|
98
101
|
const response = await this.invokeBedrock(modelId, history, stream);
|
|
99
102
|
if (stream) {
|
|
100
103
|
return this.streamBedrock(response, onChunk);
|
|
@@ -130,7 +133,8 @@ export class LLM extends BaseLLM {
|
|
|
130
133
|
throw new Error("No response from model.");
|
|
131
134
|
}
|
|
132
135
|
catch (error) {
|
|
133
|
-
console.log(
|
|
136
|
+
console.log(`Attempt failed with model: ${model}`);
|
|
137
|
+
console.error(error);
|
|
134
138
|
if (error.name === 'ValidationException' && error.message?.includes('model')) {
|
|
135
139
|
continue;
|
|
136
140
|
}
|
|
@@ -139,13 +143,25 @@ export class LLM extends BaseLLM {
|
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
|
-
|
|
146
|
+
const message = this.createBedrockInstructionMessage(`None of the attempted models are not available in your AWS account. ` +
|
|
143
147
|
`Please enable it in the AWS Bedrock console:\n\n` +
|
|
144
148
|
`1. Go to AWS Bedrock Console (https://console.aws.amazon.com/bedrock/)\n` +
|
|
145
149
|
`2. Navigate to "Model access"\n` +
|
|
146
150
|
`3. Request access to the model\n` +
|
|
147
151
|
`4. Accept the End User License Agreement (EULA)\n\n` +
|
|
148
|
-
`Available models attempted: ${this.models.join(', ')}\n`
|
|
149
|
-
|
|
152
|
+
`Available models attempted: ${this.models.join(', ')}\n`);
|
|
153
|
+
if (onChunk) {
|
|
154
|
+
try {
|
|
155
|
+
await onChunk({
|
|
156
|
+
message,
|
|
157
|
+
done: true,
|
|
158
|
+
created_at: new Date().toISOString()
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.error(error);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return message;
|
|
150
166
|
}
|
|
151
167
|
}
|
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.141-llm",
|
|
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.42",
|
|
47
|
-
"wirejs-resources": "^0.1.
|
|
47
|
+
"wirejs-resources": "^0.1.141-llm"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@aws-amplify/backend": "^1.14.0",
|