@jaypie/llm 1.3.1 → 1.3.3

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.
@@ -35,9 +35,12 @@ export declare class OperateLoop {
35
35
  private buildInitialRequest;
36
36
  private executeOneTurn;
37
37
  /**
38
- * Backfill declared array fields when a `format` is supplied. A declared
39
- * `format` is a schema contract: an empty array field should surface as `[]`
40
- * rather than be dropped by a provider/model that omits empty lists.
38
+ * Reconcile structured output against the declared `format` contract. A
39
+ * declared `format` is a schema contract: returned keys should match the
40
+ * declared names exactly and every declared array field should be present.
41
+ * First repairs keys a provider/model corrupted by wrapping them in literal
42
+ * double quotes (observed on OpenAI for multi-word keys), then backfills any
43
+ * declared array field a provider/model omitted, surfacing it as `[]`.
41
44
  */
42
45
  private applyFormatArrayDefaults;
43
46
  /**
@@ -1,9 +1,10 @@
1
+ import { createLogger } from "@jaypie/logger";
1
2
  import type Anthropic from "@anthropic-ai/sdk";
2
3
  import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
3
4
  import { z } from "zod/v4";
4
5
  import { JsonObject, NaturalSchema } from "@jaypie/types";
5
6
  export declare function loadSdk(): Promise<typeof import("@anthropic-ai/sdk")>;
6
- export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
7
+ export declare const getLogger: () => ReturnType<typeof createLogger>;
7
8
  export declare function initializeClient({ apiKey, }?: {
8
9
  apiKey?: string;
9
10
  }): Promise<Anthropic>;
@@ -1,6 +1,7 @@
1
+ import { createLogger } from "@jaypie/logger";
1
2
  import type { BedrockRuntimeClient } from "@aws-sdk/client-bedrock-runtime";
2
3
  export declare function loadSdk(): Promise<typeof import("@aws-sdk/client-bedrock-runtime")>;
3
- export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger").default;
4
+ export declare const getLogger: () => ReturnType<typeof createLogger>;
4
5
  export declare function initializeClient({ region, }?: {
5
6
  region?: string;
6
7
  }): Promise<BedrockRuntimeClient>;
@@ -1,7 +1,8 @@
1
+ import { createLogger } from "@jaypie/logger";
1
2
  import type { GoogleGenAI } from "@google/genai";
2
3
  import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
3
4
  export declare function loadSdk(): Promise<typeof import("@google/genai")>;
4
- export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
5
+ export declare const getLogger: () => ReturnType<typeof createLogger>;
5
6
  export declare function initializeClient({ apiKey, }?: {
6
7
  apiKey?: string;
7
8
  }): Promise<GoogleGenAI>;
@@ -1,8 +1,9 @@
1
+ import { createLogger } from "@jaypie/logger";
1
2
  import { JsonObject, NaturalSchema } from "@jaypie/types";
2
3
  import { OpenAI } from "openai";
3
4
  import { z } from "zod/v4";
4
5
  import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
5
- export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
6
+ export declare const getLogger: () => ReturnType<typeof createLogger>;
6
7
  export declare function initializeClient({ apiKey, }?: {
7
8
  apiKey?: string;
8
9
  }): Promise<OpenAI>;
@@ -1,7 +1,8 @@
1
+ import { createLogger } from "@jaypie/logger";
1
2
  import type { OpenRouter } from "@openrouter/sdk";
2
3
  import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
3
4
  export declare function loadSdk(): Promise<typeof import("@openrouter/sdk")>;
4
- export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
5
+ export declare const getLogger: () => ReturnType<typeof createLogger>;
5
6
  export declare function initializeClient({ apiKey, }?: {
6
7
  apiKey?: string;
7
8
  }): Promise<OpenRouter>;
@@ -1,5 +1,6 @@
1
+ import { createLogger } from "@jaypie/logger";
1
2
  import { OpenAI } from "openai";
2
- export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger.js").default;
3
+ export declare const getLogger: () => ReturnType<typeof createLogger>;
3
4
  export declare function initializeClient({ apiKey, }?: {
4
5
  apiKey?: string;
5
6
  }): Promise<OpenAI>;
@@ -8,4 +8,5 @@ export * from "./logger.js";
8
8
  export * from "./maxTurnsFromOptions.js";
9
9
  export * from "./naturalZodSchema.js";
10
10
  export * from "./random.js";
11
+ export * from "./repairFormatKeys.js";
11
12
  export * from "./tryParseNumber.js";
@@ -1 +1,2 @@
1
- export declare const getLogger: () => import("@jaypie/logger/dist/esm/JaypieLogger").default;
1
+ import { createLogger } from "@jaypie/logger";
2
+ export declare const getLogger: () => ReturnType<typeof createLogger>;
@@ -0,0 +1,19 @@
1
+ import { z } from "zod/v4";
2
+ import { JsonObject, NaturalSchema } from "@jaypie/types";
3
+ type Format = JsonObject | NaturalSchema | z.ZodType;
4
+ /**
5
+ * Repair structured-output keys that a provider/model corrupted by wrapping
6
+ * them in literal double quotes (observed on OpenAI for multi-word `format`
7
+ * keys: `Merchant Request` returned as `"Merchant Request"`). A declared
8
+ * `format` is a schema contract: returned keys should match the declared names
9
+ * exactly. Any returned key whose de-quoted form matches a declared key is
10
+ * renamed back to the declared key.
11
+ *
12
+ * Only mutates a (cloned) structured object; strings and non-objects pass
13
+ * through untouched.
14
+ */
15
+ export declare function repairFormatKeys({ content, format, }: {
16
+ content: JsonObject;
17
+ format: Format;
18
+ }): JsonObject;
19
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/llm",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Large language model utilities",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,9 +12,14 @@
12
12
  "type": "module",
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/esm/index.d.ts",
16
- "import": "./dist/esm/index.js",
17
- "require": "./dist/cjs/index.cjs"
15
+ "import": {
16
+ "types": "./dist/esm/index.d.ts",
17
+ "default": "./dist/esm/index.js"
18
+ },
19
+ "require": {
20
+ "types": "./dist/cjs/index.d.cts",
21
+ "default": "./dist/cjs/index.cjs"
22
+ }
18
23
  }
19
24
  },
20
25
  "main": "./dist/cjs/index.cjs",
@@ -48,7 +53,8 @@
48
53
  "@aws-sdk/client-bedrock-runtime": "^3.1045.0",
49
54
  "@google/genai": "^1.30.0",
50
55
  "@jaypie/types": "*",
51
- "@openrouter/sdk": "^0.1.27"
56
+ "@openrouter/sdk": "^0.1.27",
57
+ "rollup-plugin-dts": "^6.1.1"
52
58
  },
53
59
  "peerDependencies": {
54
60
  "@anthropic-ai/sdk": "^0.71.0",