@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.
@@ -3,13 +3,11 @@ export interface StructuredOutputRuntimeRoute {
3
3
  provider: string;
4
4
  runtimeMode?: ModelRuntimeMode;
5
5
  }
6
- export declare function needsSeparateStructuredOutputReasoningPass(route: StructuredOutputRuntimeRoute, reasoning: string | undefined, providerOptions?: Record<string, any>): boolean;
6
+ export declare function needsSeparateStructuredOutputReasoningPass(_route: StructuredOutputRuntimeRoute, _reasoning: string | undefined, _providerOptions?: Record<string, any>): boolean;
7
7
  /**
8
- * Vercel AI Gateway currently implements Anthropic structured output as a
9
- * forced synthetic tool. Anthropic rejects forced tool choice while extended
10
- * thinking is enabled, so the terminal schema pass must omit thinking on this
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(route: StructuredOutputRuntimeRoute, reasoning: string | undefined, providerOptions: Record<string, any> | undefined): Record<string, any> | undefined;
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,KAAK,EAAE,4BAA4B,EACnC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACpC,OAAO,CAiBT;AAED;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,4BAA4B,EACnC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAC/C,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAajC"}
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(route, reasoning, providerOptions) {
2
- const anthropic = providerOptions?.anthropic;
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
- * Vercel AI Gateway currently implements Anthropic structured output as a
17
- * forced synthetic tool. Anthropic rejects forced tool choice while extended
18
- * thinking is enabled, so the terminal schema pass must omit thinking on this
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(route, reasoning, providerOptions) {
23
- if (!needsSeparateStructuredOutputReasoningPass(route, reasoning, providerOptions)) {
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,KAAmC,EACnC,SAA6B,EAC7B,eAAqC;IAErC,MAAM,SAAS,GAAG,eAAe,EAAE,SAAS,CAAC;IAC7C,MAAM,QAAQ,GAAG,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QACtF,CAAC,CAAC,SAAS,CAAC,QAAQ;QACpB,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,oBAAoB,GAAG,OAAO,CAClC,QAAQ;WACL,OAAO,QAAQ,KAAK,QAAQ;WAC5B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;WACxB,QAAQ,CAAC,IAAI,KAAK,UAAU,CAChC,CAAC;IACF,OAAO,KAAK,CAAC,QAAQ,KAAK,WAAW;WAChC,KAAK,CAAC,WAAW,KAAK,SAAS;WAC/B,CACD,oBAAoB;eACjB,CAAC,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,KAAK,CAAC,CACpD,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sCAAsC,CACpD,KAAmC,EACnC,SAA6B,EAC7B,eAAgD;IAEhD,IAAI,CAAC,0CAA0C,CAAC,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,CAAC;QACnF,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,SAAS,GAAG,eAAe,EAAE,SAAS,CAAC;IAC7C,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5E,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACjF,OAAO;QACL,GAAG,eAAe;QAClB,SAAS,EAAE,iBAAiB;KAC7B,CAAC;AACJ,CAAC"}
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("separates Anthropic Gateway reasoning from the terminal schema pass", () => {
14
- expect(needsSeparateStructuredOutputReasoningPass(gatewayAnthropic, "medium", reasoning)).toBe(true);
15
- expect(providerOptionsForStructuredOutputPass(gatewayAnthropic, "medium", reasoning)).toEqual({
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("uses the effective provider thinking when reasoning was defaulted by the host", () => {
21
- expect(needsSeparateStructuredOutputReasoningPass(gatewayAnthropic, undefined, reasoning)).toBe(true);
22
- expect(providerOptionsForStructuredOutputPass(gatewayAnthropic, undefined, reasoning)).toEqual({
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,CAAC;AAC9C,OAAO,EACL,0CAA0C,EAC1C,sCAAsC,GACvC,MAAM,gCAAgC,CAAC;AAExC,QAAQ,CAAC,mCAA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,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtF,MAAM,CAAC,sCAAsC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polpo-ai/llm",
3
- "version": "0.18.4",
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.4"
30
+ "@polpo-ai/core": "0.18.5"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@ai-sdk/gateway": ">=3.0.0",