@mcowger/pi-plexus 1.1.0 → 1.1.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/extension.js +17 -1
- package/package.json +1 -1
package/dist/extension.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// ../plexus-models/src/convert.ts
|
|
3
3
|
var REASONING_PARAMS = new Set(["reasoning", "include_reasoning", "reasoning_effort"]);
|
|
4
|
+
var NON_CHAT_PATTERN = /(?:^|[\W_])(?:embed(?:ding|dings)?|transcri(?:be[ds]?|ptions?)|whisper|speech[\W_]*to[\W_]*text|stt|text[\W_]*to[\W_]*speech|tts|image[\W_]*(?:gen(?:eration)?|\d+)|diffusion|dall[\W_]*e|stable[\W_]*diffusion|sdxl|dream)(?:$|[\W_])/i;
|
|
4
5
|
var API_DIALECT_MAP = {
|
|
5
6
|
chat_completions: "openai-completions",
|
|
6
7
|
"openai-completions": "openai-completions",
|
|
@@ -113,10 +114,25 @@ function convertToDescriptor(raw, baseUrl) {
|
|
|
113
114
|
descriptor.piOptions = raw.pi_options;
|
|
114
115
|
return descriptor;
|
|
115
116
|
}
|
|
117
|
+
function isChatModel(model) {
|
|
118
|
+
if (!model.id)
|
|
119
|
+
return false;
|
|
120
|
+
const outputModalities = model.architecture?.output_modalities;
|
|
121
|
+
if (outputModalities !== undefined && !outputModalities.includes("text"))
|
|
122
|
+
return false;
|
|
123
|
+
const modality = model.architecture?.modality;
|
|
124
|
+
if (modality?.includes("->")) {
|
|
125
|
+
const output = modality.split("->").at(-1) ?? "";
|
|
126
|
+
if (!output.toLowerCase().includes("text"))
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
const apiHints = Array.isArray(model.preferred_api) ? model.preferred_api.join(" ") : model.preferred_api ?? "";
|
|
130
|
+
return !NON_CHAT_PATTERN.test(`${model.id} ${model.name ?? ""} ${apiHints}`);
|
|
131
|
+
}
|
|
116
132
|
function convertDescriptors(models, baseUrl) {
|
|
117
133
|
const result = [];
|
|
118
134
|
for (const m of models) {
|
|
119
|
-
if (!m
|
|
135
|
+
if (!isChatModel(m))
|
|
120
136
|
continue;
|
|
121
137
|
result.push(convertToDescriptor(m, baseUrl));
|
|
122
138
|
}
|