@openclaw/amazon-bedrock-provider 2026.5.14-beta.2 → 2026.5.16-beta.2
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/embedding-provider.js +24 -8
- package/package.json +4 -4
|
@@ -167,32 +167,48 @@ function buildCohereBody(family, texts, inputType, dims) {
|
|
|
167
167
|
function parseBedrockEmbeddingResponseJson(raw) {
|
|
168
168
|
try {
|
|
169
169
|
const parsed = JSON.parse(raw);
|
|
170
|
-
|
|
170
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Amazon Bedrock embedding response returned malformed JSON");
|
|
171
|
+
return parsed;
|
|
171
172
|
} catch {
|
|
172
173
|
throw new Error("Amazon Bedrock embedding response returned malformed JSON");
|
|
173
174
|
}
|
|
174
175
|
}
|
|
176
|
+
function malformedBedrockEmbeddingResponse() {
|
|
177
|
+
return /* @__PURE__ */ new Error("Amazon Bedrock embedding response returned malformed JSON");
|
|
178
|
+
}
|
|
175
179
|
function asNumberArray(value) {
|
|
176
|
-
|
|
180
|
+
if (!Array.isArray(value)) throw malformedBedrockEmbeddingResponse();
|
|
181
|
+
for (const entry of value) if (typeof entry !== "number" || !Number.isFinite(entry)) throw malformedBedrockEmbeddingResponse();
|
|
182
|
+
return value;
|
|
183
|
+
}
|
|
184
|
+
function asRecord(value) {
|
|
185
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
177
186
|
}
|
|
178
187
|
function asNumberArrayBatch(value) {
|
|
179
|
-
|
|
188
|
+
if (!Array.isArray(value)) throw malformedBedrockEmbeddingResponse();
|
|
189
|
+
return value.map((entry) => asNumberArray(entry));
|
|
180
190
|
}
|
|
181
191
|
function parseSingle(family, raw) {
|
|
182
192
|
const data = parseBedrockEmbeddingResponseJson(raw);
|
|
183
193
|
switch (family) {
|
|
184
194
|
case "nova": return asNumberArray(Array.isArray(data.embeddings) ? data.embeddings[0]?.embedding : null);
|
|
185
|
-
case "twelvelabs":
|
|
186
|
-
if (Array.isArray(data.data)) return asNumberArray(data.data[0]?.embedding);
|
|
187
|
-
|
|
195
|
+
case "twelvelabs": {
|
|
196
|
+
if (Array.isArray(data.data)) return asNumberArray(asRecord(data.data[0])?.embedding);
|
|
197
|
+
const dataRecord = asRecord(data.data);
|
|
198
|
+
if (dataRecord) return asNumberArray(dataRecord.embedding);
|
|
188
199
|
return asNumberArray(data.embedding);
|
|
200
|
+
}
|
|
189
201
|
default: return asNumberArray(data.embedding);
|
|
190
202
|
}
|
|
191
203
|
}
|
|
192
204
|
function parseCohereBatch(family, raw) {
|
|
193
205
|
const embeddings = parseBedrockEmbeddingResponseJson(raw).embeddings;
|
|
194
|
-
if (!embeddings)
|
|
195
|
-
if (family === "cohere-v4" && !Array.isArray(embeddings))
|
|
206
|
+
if (!embeddings) throw malformedBedrockEmbeddingResponse();
|
|
207
|
+
if (family === "cohere-v4" && !Array.isArray(embeddings)) {
|
|
208
|
+
const embeddingRecord = asRecord(embeddings);
|
|
209
|
+
if (!embeddingRecord) throw malformedBedrockEmbeddingResponse();
|
|
210
|
+
return asNumberArrayBatch(embeddingRecord.float);
|
|
211
|
+
}
|
|
196
212
|
return asNumberArrayBatch(embeddings);
|
|
197
213
|
}
|
|
198
214
|
const __testing = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.16-beta.2",
|
|
4
4
|
"description": "OpenClaw Amazon Bedrock provider plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"minHostVersion": ">=2026.5.12-beta.1"
|
|
28
28
|
},
|
|
29
29
|
"compat": {
|
|
30
|
-
"pluginApi": ">=2026.5.
|
|
30
|
+
"pluginApi": ">=2026.5.16-beta.2"
|
|
31
31
|
},
|
|
32
32
|
"build": {
|
|
33
|
-
"openclawVersion": "2026.5.
|
|
33
|
+
"openclawVersion": "2026.5.16-beta.2",
|
|
34
34
|
"bundledDist": false
|
|
35
35
|
},
|
|
36
36
|
"release": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"openclaw.plugin.json"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"openclaw": ">=2026.5.
|
|
49
|
+
"openclaw": ">=2026.5.16-beta.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|