@oh-my-pi/pi-ai 14.7.0 → 14.7.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-ai",
|
|
4
|
-
"version": "14.7.
|
|
4
|
+
"version": "14.7.1",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -41,24 +41,24 @@
|
|
|
41
41
|
"generate-models": "bun scripts/generate-models.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@anthropic-ai/sdk": "^0.
|
|
45
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
46
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
44
|
+
"@anthropic-ai/sdk": "^0.94.0",
|
|
45
|
+
"@aws-sdk/client-bedrock-runtime": "^3.1043.0",
|
|
46
|
+
"@aws-sdk/credential-provider-node": "^3.972.39",
|
|
47
47
|
"@bufbuild/protobuf": "^2.12.0",
|
|
48
|
-
"@google/genai": "^1.
|
|
49
|
-
"@oh-my-pi/pi-natives": "14.7.
|
|
50
|
-
"@oh-my-pi/pi-utils": "14.7.
|
|
48
|
+
"@google/genai": "^1.52.0",
|
|
49
|
+
"@oh-my-pi/pi-natives": "14.7.1",
|
|
50
|
+
"@oh-my-pi/pi-utils": "14.7.1",
|
|
51
51
|
"@sinclair/typebox": "^0.34.49",
|
|
52
52
|
"@smithy/node-http-handler": "^4.6.1",
|
|
53
53
|
"ajv": "^8.20.0",
|
|
54
54
|
"ajv-formats": "^3.0.1",
|
|
55
|
-
"openai": "^6.
|
|
55
|
+
"openai": "^6.36.0",
|
|
56
56
|
"partial-json": "^0.1.7",
|
|
57
57
|
"proxy-agent": "^8.0.1",
|
|
58
|
-
"zod": "4.3
|
|
58
|
+
"zod": "4.4.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/bun": "^1.3"
|
|
61
|
+
"@types/bun": "^1.3.13"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"bun": ">=1.3.7"
|
|
@@ -119,6 +119,7 @@ export function detectOpenAICompat(model: Model<"openai-completions">, resolvedB
|
|
|
119
119
|
reasoningEffortMap,
|
|
120
120
|
supportsUsageInStreaming: !isCerebras,
|
|
121
121
|
disableReasoningOnForcedToolChoice: isKimiModel || isAnthropicModel,
|
|
122
|
+
disableReasoningOnToolChoice: isDeepseekFamily && Boolean(model.reasoning),
|
|
122
123
|
supportsToolChoice: true,
|
|
123
124
|
maxTokensField: useMaxTokens ? "max_tokens" : "max_completion_tokens",
|
|
124
125
|
requiresToolResultName: isMistral,
|
|
@@ -195,6 +196,7 @@ export function resolveOpenAICompat(
|
|
|
195
196
|
model.compat.requiresAssistantContentForToolCalls ?? detected.requiresAssistantContentForToolCalls,
|
|
196
197
|
disableReasoningOnForcedToolChoice:
|
|
197
198
|
model.compat.disableReasoningOnForcedToolChoice ?? detected.disableReasoningOnForcedToolChoice,
|
|
199
|
+
disableReasoningOnToolChoice: model.compat.disableReasoningOnToolChoice ?? detected.disableReasoningOnToolChoice,
|
|
198
200
|
openRouterRouting: model.compat.openRouterRouting ?? detected.openRouterRouting,
|
|
199
201
|
vercelGatewayRouting: model.compat.vercelGatewayRouting ?? detected.vercelGatewayRouting,
|
|
200
202
|
supportsStrictMode: model.compat.supportsStrictMode ?? detected.supportsStrictMode,
|
|
@@ -996,6 +996,14 @@ function buildParams(
|
|
|
996
996
|
params.reasoning_effort = mapReasoningEffort(options.reasoning, compat.reasoningEffortMap) as Effort;
|
|
997
997
|
}
|
|
998
998
|
|
|
999
|
+
if (compat.disableReasoningOnToolChoice && params.tool_choice !== undefined) {
|
|
1000
|
+
// DeepSeek reasoning models accept tools/tool_choice, but reject that
|
|
1001
|
+
// control field while thinking is enabled. Keep the tool-selection
|
|
1002
|
+
// contract and suppress reasoning for this single request.
|
|
1003
|
+
delete params.reasoning_effort;
|
|
1004
|
+
delete params.reasoning;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
999
1007
|
if (compat.disableReasoningOnForcedToolChoice && isForcedToolChoice(params.tool_choice)) {
|
|
1000
1008
|
// Mirrors anthropic.ts:disableThinkingIfToolChoiceForced — backends like
|
|
1001
1009
|
// Kimi 400 with `tool_choice 'specified' is incompatible with thinking
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type Context,
|
|
14
14
|
type MessageAttribution,
|
|
15
15
|
type Model,
|
|
16
|
+
type OpenAICompat,
|
|
16
17
|
type ProviderSessionState,
|
|
17
18
|
type ServiceTier,
|
|
18
19
|
type StreamFunction,
|
|
@@ -431,7 +432,9 @@ function buildParams(
|
|
|
431
432
|
|
|
432
433
|
if (options?.reasoning || options?.reasoningSummary) {
|
|
433
434
|
params.reasoning = {
|
|
434
|
-
effort: options?.reasoning || "medium",
|
|
435
|
+
effort: mapReasoningEffort(options?.reasoning || "medium", model.compat?.reasoningEffortMap) as NonNullable<
|
|
436
|
+
OpenAIResponsesSamplingParams["reasoning"]
|
|
437
|
+
>["effort"],
|
|
435
438
|
summary: options?.reasoningSummary || "auto",
|
|
436
439
|
};
|
|
437
440
|
} else if (model.name.startsWith("gpt-5")) {
|
|
@@ -451,6 +454,13 @@ function buildParams(
|
|
|
451
454
|
return { conversationMessages, params };
|
|
452
455
|
}
|
|
453
456
|
|
|
457
|
+
function mapReasoningEffort(
|
|
458
|
+
effort: NonNullable<OpenAIResponsesOptions["reasoning"]>,
|
|
459
|
+
reasoningEffortMap: OpenAICompat["reasoningEffortMap"] | undefined,
|
|
460
|
+
): string {
|
|
461
|
+
return reasoningEffortMap?.[effort] ?? effort;
|
|
462
|
+
}
|
|
463
|
+
|
|
454
464
|
function isAzureOpenAIBaseUrl(baseUrl: string): boolean {
|
|
455
465
|
return baseUrl.includes(".openai.azure.com") || baseUrl.includes("azure.com/openai");
|
|
456
466
|
}
|
package/src/types.ts
CHANGED
|
@@ -576,6 +576,13 @@ export interface OpenAICompat {
|
|
|
576
576
|
* enabled` whenever both are present. Default: auto-detected (Kimi).
|
|
577
577
|
*/
|
|
578
578
|
disableReasoningOnForcedToolChoice?: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Drop reasoning fields (`reasoning_effort`, OpenRouter `reasoning`) for
|
|
581
|
+
* any request that sends `tool_choice`. Use for providers/models that accept
|
|
582
|
+
* tools and `tool_choice`, but reject `tool_choice` while thinking is enabled.
|
|
583
|
+
* Default: auto-detected (DeepSeek reasoning models).
|
|
584
|
+
*/
|
|
585
|
+
disableReasoningOnToolChoice?: boolean;
|
|
579
586
|
/** OpenRouter-specific routing preferences. Only used when baseUrl points to OpenRouter. */
|
|
580
587
|
openRouterRouting?: OpenRouterRouting;
|
|
581
588
|
/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */
|
|
@@ -666,7 +673,7 @@ export interface Model<TApi extends Api = any> {
|
|
|
666
673
|
/** Canonical thinking capability metadata for this model. */
|
|
667
674
|
thinking?: ThinkingConfig;
|
|
668
675
|
/** Compatibility overrides per API. If not set, auto-detected from baseUrl. */
|
|
669
|
-
compat?: TApi extends "openai-completions"
|
|
676
|
+
compat?: TApi extends "openai-completions" | "openai-responses"
|
|
670
677
|
? OpenAICompat
|
|
671
678
|
: TApi extends "anthropic-messages"
|
|
672
679
|
? AnthropicCompat
|