190proof 1.0.102 → 1.0.104
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/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -289,6 +289,14 @@ function buildOpenAIRequestConfig(identifier, model, config) {
|
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
+
function filterOpenAICompatReasoningDetails(details) {
|
|
293
|
+
if (!Array.isArray(details))
|
|
294
|
+
return details || void 0;
|
|
295
|
+
const blocks = details.filter(
|
|
296
|
+
(block) => typeof (block == null ? void 0 : block.type) === "string" && block.type.startsWith("reasoning.")
|
|
297
|
+
);
|
|
298
|
+
return blocks.length ? blocks : void 0;
|
|
299
|
+
}
|
|
292
300
|
async function prepareOpenAIPayload(identifier, payload) {
|
|
293
301
|
var _a, _b;
|
|
294
302
|
const preparedPayload = {
|
|
@@ -356,8 +364,11 @@ async function prepareOpenAIPayload(identifier, payload) {
|
|
|
356
364
|
}
|
|
357
365
|
if (message.reasoning)
|
|
358
366
|
outMessage.reasoning = message.reasoning;
|
|
359
|
-
|
|
360
|
-
|
|
367
|
+
const reasoningDetails = filterOpenAICompatReasoningDetails(
|
|
368
|
+
message.reasoningDetails
|
|
369
|
+
);
|
|
370
|
+
if (reasoningDetails)
|
|
371
|
+
outMessage.reasoning_details = reasoningDetails;
|
|
361
372
|
preparedPayload.messages.push(outMessage);
|
|
362
373
|
}
|
|
363
374
|
return preparedPayload;
|
|
@@ -697,7 +708,9 @@ async function prepareAnthropicPayload(_identifier, payload) {
|
|
|
697
708
|
});
|
|
698
709
|
}
|
|
699
710
|
}
|
|
700
|
-
const leadingBlocks = message.role === "assistant" && Array.isArray(message.reasoningDetails) ? message.reasoningDetails
|
|
711
|
+
const leadingBlocks = message.role === "assistant" && Array.isArray(message.reasoningDetails) ? message.reasoningDetails.filter(
|
|
712
|
+
(block) => (block == null ? void 0 : block.type) === "thinking" || (block == null ? void 0 : block.type) === "redacted_thinking"
|
|
713
|
+
) : [];
|
|
701
714
|
const toolUseBlocks = (message.functionCalls || []).map((fc, i) => {
|
|
702
715
|
var _a;
|
|
703
716
|
return {
|
|
@@ -1196,8 +1209,11 @@ function prepareOpenAICompatMessages(messages) {
|
|
|
1196
1209
|
}
|
|
1197
1210
|
if (message.reasoning)
|
|
1198
1211
|
outMessage.reasoning = message.reasoning;
|
|
1199
|
-
|
|
1200
|
-
|
|
1212
|
+
const reasoningDetails = filterOpenAICompatReasoningDetails(
|
|
1213
|
+
message.reasoningDetails
|
|
1214
|
+
);
|
|
1215
|
+
if (reasoningDetails)
|
|
1216
|
+
outMessage.reasoning_details = reasoningDetails;
|
|
1201
1217
|
out.push(outMessage);
|
|
1202
1218
|
}
|
|
1203
1219
|
return out;
|