@openclaw/voyage-provider 2026.9.1-beta.1 → 2026.9.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-batch.js
CHANGED
|
@@ -6,7 +6,7 @@ import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtim
|
|
|
6
6
|
const VOYAGE_BATCH_ENDPOINT = EMBEDDING_BATCH_ENDPOINT;
|
|
7
7
|
const VOYAGE_BATCH_COMPLETION_WINDOW = "12h";
|
|
8
8
|
const VOYAGE_BATCH_MAX_REQUESTS = 5e4;
|
|
9
|
-
const VOYAGE_BATCH_RESPONSE_MAX_BYTES =
|
|
9
|
+
const VOYAGE_BATCH_RESPONSE_MAX_BYTES = 16777216;
|
|
10
10
|
function buildVoyageBatchRequest(params) {
|
|
11
11
|
return {
|
|
12
12
|
url: resolveEmbeddingEndpointUrl(params.client.baseUrl, params.path),
|
|
@@ -63,7 +63,8 @@ async function readVoyageBatchError(params) {
|
|
|
63
63
|
const bytes = await readResponseWithLimit(res, VOYAGE_BATCH_RESPONSE_MAX_BYTES, { onOverflow: ({ maxBytes: maxBytesLocal }) => /* @__PURE__ */ new Error(`voyage batch error file content exceeds ${maxBytesLocal} bytes`) });
|
|
64
64
|
const text = new TextDecoder().decode(bytes);
|
|
65
65
|
if (!text.trim()) return;
|
|
66
|
-
|
|
66
|
+
const lines = normalizeStringEntries(text.split("\n")).map((line) => JSON.parse(line));
|
|
67
|
+
return formatBatchErrorDetail(extractBatchErrorMessage(lines));
|
|
67
68
|
}
|
|
68
69
|
}));
|
|
69
70
|
} catch (err) {
|
|
@@ -17,7 +17,7 @@ function normalizeVoyageModel(model) {
|
|
|
17
17
|
async function createVoyageEmbeddingProvider(options) {
|
|
18
18
|
const client = await resolveVoyageEmbeddingClient(options);
|
|
19
19
|
const url = resolveEmbeddingEndpointUrl(client.baseUrl, "embeddings");
|
|
20
|
-
const
|
|
20
|
+
const embedMany = async (input, input_type, signal) => {
|
|
21
21
|
if (input.length === 0) return [];
|
|
22
22
|
const body = {
|
|
23
23
|
model: client.model,
|
|
@@ -38,11 +38,19 @@ async function createVoyageEmbeddingProvider(options) {
|
|
|
38
38
|
id: "voyage",
|
|
39
39
|
model: client.model,
|
|
40
40
|
maxInputTokens: VOYAGE_MAX_INPUT_TOKENS[client.model],
|
|
41
|
-
|
|
42
|
-
const
|
|
41
|
+
embed: async (input, optionsValue) => {
|
|
42
|
+
const text = typeof input === "string" ? input : input.text;
|
|
43
|
+
const [vec] = await embedMany([text], optionsValue?.inputType === "query" ? "query" : "document", optionsValue?.signal);
|
|
43
44
|
return vec ?? [];
|
|
44
45
|
},
|
|
45
|
-
embedBatch: async (
|
|
46
|
+
embedBatch: async (inputs, optionsLocal) => {
|
|
47
|
+
const texts = inputs.map((input) => typeof input === "string" ? input : input.text);
|
|
48
|
+
if (optionsLocal?.inputType === "query") return await Promise.all(texts.map(async (text) => {
|
|
49
|
+
const [vec] = await embedMany([text], "query", optionsLocal.signal);
|
|
50
|
+
return vec ?? [];
|
|
51
|
+
}));
|
|
52
|
+
return await embedMany(texts, "document", optionsLocal?.signal);
|
|
53
|
+
}
|
|
46
54
|
},
|
|
47
55
|
client
|
|
48
56
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { voyageMemoryEmbeddingProviderAdapter } from "./memory-embedding-adapter.js";
|
|
2
|
-
import { adaptMemoryEmbeddingProviderAdapter } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
3
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
4
3
|
//#region extensions/voyage/index.ts
|
|
5
4
|
var voyage_default = definePluginEntry({
|
|
@@ -7,7 +6,7 @@ var voyage_default = definePluginEntry({
|
|
|
7
6
|
name: "Voyage Embeddings",
|
|
8
7
|
description: "Voyage memory embedding provider plugin",
|
|
9
8
|
register(api) {
|
|
10
|
-
api.registerEmbeddingProvider(
|
|
9
|
+
api.registerEmbeddingProvider(voyageMemoryEmbeddingProviderAdapter);
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
12
|
//#endregion
|
|
@@ -27,7 +27,7 @@ const voyageMemoryEmbeddingProviderAdapter = {
|
|
|
27
27
|
headers: sanitizeEmbeddingCacheHeaders(client.headers, ["authorization"])
|
|
28
28
|
},
|
|
29
29
|
batchEmbed: async (batch) => {
|
|
30
|
-
|
|
30
|
+
const byCustomId = await runVoyageEmbeddingBatches({
|
|
31
31
|
client,
|
|
32
32
|
agentId: batch.agentId,
|
|
33
33
|
requests: batch.chunks.map((chunk, index) => ({
|
|
@@ -39,7 +39,8 @@ const voyageMemoryEmbeddingProviderAdapter = {
|
|
|
39
39
|
pollIntervalMs: batch.pollIntervalMs,
|
|
40
40
|
timeoutMs: batch.timeoutMs,
|
|
41
41
|
debug: batch.debug
|
|
42
|
-
})
|
|
42
|
+
});
|
|
43
|
+
return mapBatchEmbeddingsByIndex(byCustomId, batch.chunks.length);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/voyage-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.2",
|
|
4
4
|
"description": "OpenClaw Voyage embedding provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.7.2"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.9.
|
|
21
|
+
"pluginApi": ">=2026.9.2"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.2",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.9.
|
|
41
|
+
"openclaw": ">=2026.9.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|