@polpo-ai/llm 0.18.4 → 0.18.5
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/structured-output-routing.d.ts +5 -7
- package/dist/structured-output-routing.d.ts.map +1 -1
- package/dist/structured-output-routing.js +7 -31
- package/dist/structured-output-routing.js.map +1 -1
- package/dist/structured-output-routing.test.js +6 -12
- package/dist/structured-output-routing.test.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,13 +3,11 @@ export interface StructuredOutputRuntimeRoute {
|
|
|
3
3
|
provider: string;
|
|
4
4
|
runtimeMode?: ModelRuntimeMode;
|
|
5
5
|
}
|
|
6
|
-
export declare function needsSeparateStructuredOutputReasoningPass(
|
|
6
|
+
export declare function needsSeparateStructuredOutputReasoningPass(_route: StructuredOutputRuntimeRoute, _reasoning: string | undefined, _providerOptions?: Record<string, any>): boolean;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* concrete route. Direct Anthropic adapters use native output_config and keep
|
|
12
|
-
* reasoning and structured output in one request.
|
|
8
|
+
* @deprecated Native Anthropic structured outputs retain thinking. Keep the
|
|
9
|
+
* provider options unchanged and start any terminal schema pass as a new user
|
|
10
|
+
* turn instead of treating the last assistant message as a response prefill.
|
|
13
11
|
*/
|
|
14
|
-
export declare function providerOptionsForStructuredOutputPass(
|
|
12
|
+
export declare function providerOptionsForStructuredOutputPass(_route: StructuredOutputRuntimeRoute, _reasoning: string | undefined, providerOptions: Record<string, any> | undefined): Record<string, any> | undefined;
|
|
15
13
|
//# sourceMappingURL=structured-output-routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output-routing.d.ts","sourceRoot":"","sources":["../src/structured-output-routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED,wBAAgB,0CAA0C,CACxD,
|
|
1
|
+
{"version":3,"file":"structured-output-routing.d.ts","sourceRoot":"","sources":["../src/structured-output-routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,4BAA4B,EACpC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACrC,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,4BAA4B,EACpC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAC/C,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAEjC"}
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
export function needsSeparateStructuredOutputReasoningPass(
|
|
2
|
-
|
|
3
|
-
const thinking = anthropic && typeof anthropic === "object" && !Array.isArray(anthropic)
|
|
4
|
-
? anthropic.thinking
|
|
5
|
-
: undefined;
|
|
6
|
-
const hasEffectiveThinking = Boolean(thinking
|
|
7
|
-
&& typeof thinking === "object"
|
|
8
|
-
&& !Array.isArray(thinking)
|
|
9
|
-
&& thinking.type !== "disabled");
|
|
10
|
-
return route.provider === "anthropic"
|
|
11
|
-
&& route.runtimeMode === "gateway"
|
|
12
|
-
&& (hasEffectiveThinking
|
|
13
|
-
|| (reasoning !== undefined && reasoning !== "off"));
|
|
1
|
+
export function needsSeparateStructuredOutputReasoningPass(_route, _reasoning, _providerOptions) {
|
|
2
|
+
return false;
|
|
14
3
|
}
|
|
15
4
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* concrete route. Direct Anthropic adapters use native output_config and keep
|
|
20
|
-
* reasoning and structured output in one request.
|
|
5
|
+
* @deprecated Native Anthropic structured outputs retain thinking. Keep the
|
|
6
|
+
* provider options unchanged and start any terminal schema pass as a new user
|
|
7
|
+
* turn instead of treating the last assistant message as a response prefill.
|
|
21
8
|
*/
|
|
22
|
-
export function providerOptionsForStructuredOutputPass(
|
|
23
|
-
|
|
24
|
-
return providerOptions;
|
|
25
|
-
}
|
|
26
|
-
const anthropic = providerOptions?.anthropic;
|
|
27
|
-
if (!anthropic || typeof anthropic !== "object" || Array.isArray(anthropic)) {
|
|
28
|
-
return providerOptions;
|
|
29
|
-
}
|
|
30
|
-
const { thinking: _thinking, effort: _effort, ...terminalAnthropic } = anthropic;
|
|
31
|
-
return {
|
|
32
|
-
...providerOptions,
|
|
33
|
-
anthropic: terminalAnthropic,
|
|
34
|
-
};
|
|
9
|
+
export function providerOptionsForStructuredOutputPass(_route, _reasoning, providerOptions) {
|
|
10
|
+
return providerOptions;
|
|
35
11
|
}
|
|
36
12
|
//# sourceMappingURL=structured-output-routing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output-routing.js","sourceRoot":"","sources":["../src/structured-output-routing.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,0CAA0C,CACxD,
|
|
1
|
+
{"version":3,"file":"structured-output-routing.js","sourceRoot":"","sources":["../src/structured-output-routing.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,0CAA0C,CACxD,MAAoC,EACpC,UAA8B,EAC9B,gBAAsC;IAEtC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sCAAsC,CACpD,MAAoC,EACpC,UAA8B,EAC9B,eAAgD;IAEhD,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -10,19 +10,13 @@ describe("structured output runtime routing", () => {
|
|
|
10
10
|
},
|
|
11
11
|
gateway: { order: ["anthropic"] },
|
|
12
12
|
};
|
|
13
|
-
it("
|
|
14
|
-
expect(needsSeparateStructuredOutputReasoningPass(gatewayAnthropic, "medium", reasoning)).toBe(
|
|
15
|
-
expect(providerOptionsForStructuredOutputPass(gatewayAnthropic, "medium", reasoning)).
|
|
16
|
-
anthropic: { structuredOutputMode: "auto" },
|
|
17
|
-
gateway: { order: ["anthropic"] },
|
|
18
|
-
});
|
|
13
|
+
it("keeps Anthropic Gateway thinking on native structured-output turns", () => {
|
|
14
|
+
expect(needsSeparateStructuredOutputReasoningPass(gatewayAnthropic, "medium", reasoning)).toBe(false);
|
|
15
|
+
expect(providerOptionsForStructuredOutputPass(gatewayAnthropic, "medium", reasoning)).toBe(reasoning);
|
|
19
16
|
});
|
|
20
|
-
it("
|
|
21
|
-
expect(needsSeparateStructuredOutputReasoningPass(gatewayAnthropic, undefined, reasoning)).toBe(
|
|
22
|
-
expect(providerOptionsForStructuredOutputPass(gatewayAnthropic, undefined, reasoning)).
|
|
23
|
-
anthropic: { structuredOutputMode: "auto" },
|
|
24
|
-
gateway: { order: ["anthropic"] },
|
|
25
|
-
});
|
|
17
|
+
it("keeps effective provider thinking when reasoning was defaulted by the host", () => {
|
|
18
|
+
expect(needsSeparateStructuredOutputReasoningPass(gatewayAnthropic, undefined, reasoning)).toBe(false);
|
|
19
|
+
expect(providerOptionsForStructuredOutputPass(gatewayAnthropic, undefined, reasoning)).toBe(reasoning);
|
|
26
20
|
});
|
|
27
21
|
it.each([
|
|
28
22
|
[{ provider: "anthropic", runtimeMode: "provider" }, "medium", reasoning],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output-routing.test.js","sourceRoot":"","sources":["../src/structured-output-routing.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,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package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polpo-ai/llm",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"description": "LLM abstraction for Polpo — multi-provider model resolution, streaming, cost tracking, and failover built on Vercel AI SDK + AI Gateway",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@hyperjump/browser": "1.4.0",
|
|
28
28
|
"@hyperjump/json-schema": "1.17.7",
|
|
29
29
|
"zod": "^4.3.6",
|
|
30
|
-
"@polpo-ai/core": "0.18.
|
|
30
|
+
"@polpo-ai/core": "0.18.5"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@ai-sdk/gateway": ">=3.0.0",
|