wirejs-deploy-amplify-basic 0.1.139-llm → 0.1.140-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.
@@ -3,6 +3,6 @@
3
3
  "dependencies": {
4
4
  "jsdom": "^25.0.1",
5
5
  "wirejs-dom": "^1.0.42",
6
- "wirejs-resources": "^0.1.139-llm"
6
+ "wirejs-resources": "^0.1.140-llm"
7
7
  }
8
8
  }
@@ -95,6 +95,8 @@ export class LLM extends BaseLLM {
95
95
  for (let i = 0; i < maxRetries; i++) {
96
96
  try {
97
97
  const modelId = this.getModelId(model);
98
+ if (modelId !== model)
99
+ console.log(`Mapped ${model} to ${modelId}`);
98
100
  const response = await this.invokeBedrock(modelId, history, stream);
99
101
  if (stream) {
100
102
  return this.streamBedrock(response, onChunk);
@@ -130,7 +132,8 @@ export class LLM extends BaseLLM {
130
132
  throw new Error("No response from model.");
131
133
  }
132
134
  catch (error) {
133
- console.log(error);
135
+ console.log(`Attempt failed with model: ${model}`);
136
+ console.error(error);
134
137
  if (error.name === 'ValidationException' && error.message?.includes('model')) {
135
138
  continue;
136
139
  }
@@ -139,7 +142,7 @@ export class LLM extends BaseLLM {
139
142
  }
140
143
  }
141
144
  }
142
- return this.createBedrockInstructionMessage(`None of the attempted are not available or not enabled in your AWS account. ` +
145
+ const message = this.createBedrockInstructionMessage(`None of the attempted are not available or not enabled in your AWS account. ` +
143
146
  `Please enable it in the AWS Bedrock console:\n\n` +
144
147
  `1. Go to AWS Bedrock Console (https://console.aws.amazon.com/bedrock/)\n` +
145
148
  `2. Navigate to "Model access"\n` +
@@ -147,5 +150,18 @@ export class LLM extends BaseLLM {
147
150
  `4. Accept the End User License Agreement (EULA)\n\n` +
148
151
  `Available models attempted: ${this.models.join(', ')}\n` +
149
152
  `You may need to enable these models: ${this.models.map(m => this.getModelId(m)).join(', ')}`);
153
+ if (onChunk) {
154
+ try {
155
+ 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.139-llm",
3
+ "version": "0.1.140-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.139-llm"
47
+ "wirejs-resources": "^0.1.140-llm"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@aws-amplify/backend": "^1.14.0",