@drsamonline/prober 0.12.35 → 0.12.36
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/package.json +1 -1
- package/src/index.js +9 -3
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -66,11 +66,13 @@ export const PROBE_FIXTURE_VERSION = '1.0.0';
|
|
|
66
66
|
export const FIXTURES = {
|
|
67
67
|
readiness: {
|
|
68
68
|
messages: [{ role: 'user', content: 'Reply with the single word: ready' }],
|
|
69
|
-
|
|
69
|
+
// A reasoning model thinks before it speaks. 8 tokens were spent entirely on
|
|
70
|
+
// thinking, so the reply was empty and a working provider was marked unusable.
|
|
71
|
+
max_tokens: 256,
|
|
70
72
|
},
|
|
71
73
|
jsonSchema: {
|
|
72
74
|
messages: [{ role: 'user', content: 'Return JSON with exactly one key "ok", set to true.' }],
|
|
73
|
-
max_tokens:
|
|
75
|
+
max_tokens: 256,
|
|
74
76
|
response_format: { type: 'json_object' },
|
|
75
77
|
},
|
|
76
78
|
tools: {
|
|
@@ -220,7 +222,11 @@ export async function probeTarget(entry, opts = {}) {
|
|
|
220
222
|
return { ok: false, status: res.status, note: `HTTP ${res.status}: ${firstLine(body)}` };
|
|
221
223
|
}
|
|
222
224
|
const json = await res.json().catch(() => null);
|
|
223
|
-
|
|
225
|
+
const message = json?.choices?.[0]?.message ?? {};
|
|
226
|
+
// a reasoning model leaves `content` empty and puts the answer in `reasoning`
|
|
227
|
+
const content = typeof message.content === 'string' ? message.content : '';
|
|
228
|
+
const reasoning = typeof message.reasoning_content === 'string' ? message.reasoning_content : message.reasoning;
|
|
229
|
+
sample = content || (typeof reasoning === 'string' ? reasoning : '');
|
|
224
230
|
const ok = typeof sample === 'string' && sample.trim().length > 0;
|
|
225
231
|
return { ok, status: res.status, note: ok ? 'returned text' : 'empty completion' };
|
|
226
232
|
});
|