@velocirouter/pi 1.1.0 → 1.1.1
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/index.js +7 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -54,6 +54,12 @@ function toModel(row) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// Embeddings and Decisions models share /v1/models but cannot serve chat.
|
|
58
|
+
function isChatModel(row) {
|
|
59
|
+
const output = row.output_modalities
|
|
60
|
+
return !Array.isArray(output) || output.includes("text")
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
// Stored models carry the baseUrl they were fetched from; dropping it lets
|
|
58
64
|
// the provider-level one win when VELOCIROUTER_BASE_URL changes.
|
|
59
65
|
function restore(stored) {
|
|
@@ -69,7 +75,7 @@ async function refreshModels({ credential, stored, publish, allowNetwork, signal
|
|
|
69
75
|
}
|
|
70
76
|
const payload = await getJson(`${baseUrl()}/models`, credential.key, signal)
|
|
71
77
|
const rows = Array.isArray(payload?.data) ? payload.data : []
|
|
72
|
-
const models = rows.filter((row) => typeof row?.id === "string" && row.id).map(toModel)
|
|
78
|
+
const models = rows.filter((row) => typeof row?.id === "string" && row.id && isChatModel(row)).map(toModel)
|
|
73
79
|
// An empty catalog would wipe the cache; keep what was there.
|
|
74
80
|
if (!models.length) {
|
|
75
81
|
return restore(stored)
|