@caupulican/pi-ai 0.91.4 → 0.93.0
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/providers/amazon-bedrock.js +12 -1
- package/dist/providers/amazon-bedrock.js.map +1 -1
- package/dist/providers/google-shared.d.ts.map +1 -1
- package/dist/providers/google-shared.js +1 -0
- package/dist/providers/google-shared.js.map +1 -1
- package/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/dist/providers/openai-codex-responses.js +33 -8
- package/dist/providers/openai-codex-responses.js.map +1 -1
- package/dist/providers/openai-responses-shared.d.ts +5 -0
- package/dist/providers/openai-responses-shared.d.ts.map +1 -1
- package/dist/providers/openai-responses-shared.js +53 -13
- package/dist/providers/openai-responses-shared.js.map +1 -1
- package/dist/providers/openai-responses.d.ts.map +1 -1
- package/dist/providers/openai-responses.js +9 -4
- package/dist/providers/openai-responses.js.map +1 -1
- package/dist/providers/simple-options.d.ts.map +1 -1
- package/dist/providers/simple-options.js +1 -0
- package/dist/providers/simple-options.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/oauth/xai.d.ts.map +1 -1
- package/dist/utils/oauth/xai.js +16 -0
- package/dist/utils/oauth/xai.js.map +1 -1
- package/package.json +9 -8
|
@@ -415,12 +415,15 @@ function buildRequestBody(model, context, options, cacheSessionId) {
|
|
|
415
415
|
const toolNameMap = createOpenAIResponsesToolNameMap(context.tools ?? []);
|
|
416
416
|
const messages = convertResponsesMessages(model, context, CODEX_TOOL_CALL_PROVIDERS, {
|
|
417
417
|
imageDetail: lite ? null : "auto",
|
|
418
|
+
includeMessageType: lite,
|
|
418
419
|
toolNameMap,
|
|
419
420
|
});
|
|
420
|
-
const
|
|
421
|
-
const
|
|
422
|
-
|
|
421
|
+
const configuredInstructions = buildResponsesInstructions(context);
|
|
422
|
+
const instructions = configuredInstructions || "You are a helpful assistant.";
|
|
423
|
+
const convertedTools = context.tools && context.tools.length > 0
|
|
424
|
+
? convertResponsesTools(context.tools, { strict: lite ? false : null, toolNameMap })
|
|
423
425
|
: [];
|
|
426
|
+
const tools = lite ? groupCodexResponsesLiteTools(convertedTools) : convertedTools;
|
|
424
427
|
const input = lite
|
|
425
428
|
? [
|
|
426
429
|
{
|
|
@@ -428,11 +431,15 @@ function buildRequestBody(model, context, options, cacheSessionId) {
|
|
|
428
431
|
role: "developer",
|
|
429
432
|
tools,
|
|
430
433
|
},
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
...(configuredInstructions
|
|
435
|
+
? [
|
|
436
|
+
{
|
|
437
|
+
type: "message",
|
|
438
|
+
role: "developer",
|
|
439
|
+
content: [{ type: "input_text", text: configuredInstructions }],
|
|
440
|
+
},
|
|
441
|
+
]
|
|
442
|
+
: []),
|
|
436
443
|
...messages,
|
|
437
444
|
]
|
|
438
445
|
: messages;
|
|
@@ -475,6 +482,24 @@ function buildRequestBody(model, context, options, cacheSessionId) {
|
|
|
475
482
|
}
|
|
476
483
|
return body;
|
|
477
484
|
}
|
|
485
|
+
function groupCodexResponsesLiteTools(tools) {
|
|
486
|
+
if (tools.length === 0)
|
|
487
|
+
return [];
|
|
488
|
+
const functions = tools.map((tool) => {
|
|
489
|
+
if (tool.type !== "function") {
|
|
490
|
+
throw new Error(`Unsupported Responses Lite tool type: ${tool.type}`);
|
|
491
|
+
}
|
|
492
|
+
return tool;
|
|
493
|
+
});
|
|
494
|
+
return [
|
|
495
|
+
{
|
|
496
|
+
type: "namespace",
|
|
497
|
+
name: "functions",
|
|
498
|
+
description: "",
|
|
499
|
+
tools: functions,
|
|
500
|
+
},
|
|
501
|
+
];
|
|
502
|
+
}
|
|
478
503
|
function resolveCodexServiceTier(responseServiceTier, requestServiceTier) {
|
|
479
504
|
if (responseServiceTier === "default" && (requestServiceTier === "flex" || requestServiceTier === "priority")) {
|
|
480
505
|
return requestServiceTier;
|