@jaypie/llm 1.2.6 → 1.2.7

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.
@@ -12,7 +12,7 @@ import { BaseProviderAdapter } from "./ProviderAdapter.interface.js";
12
12
  */
13
13
  export declare class OpenAiAdapter extends BaseProviderAdapter {
14
14
  readonly name: "openai";
15
- readonly defaultModel: "gpt-5.1";
15
+ readonly defaultModel: "gpt-5.2";
16
16
  buildRequest(request: OperateRequest): unknown;
17
17
  formatTools(toolkit: Toolkit, _outputSchema?: JsonObject): ProviderToolDefinition[];
18
18
  formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
@@ -17,7 +17,7 @@ export declare class Toolkit {
17
17
  call({ name, arguments: args }: {
18
18
  name: string;
19
19
  arguments: string;
20
- }): Promise<any>;
20
+ }): Promise<import("@jaypie/types").AnyValue>;
21
21
  extend(tools: LlmTool[], options?: {
22
22
  warn?: boolean;
23
23
  replace?: boolean;
@@ -1,19 +1,28 @@
1
1
  export declare const PROVIDER: {
2
- readonly OPENROUTER: {
2
+ readonly ANTHROPIC: {
3
+ readonly MAX_TOKENS: {
4
+ readonly DEFAULT: 4096;
5
+ };
3
6
  readonly MODEL: {
4
- readonly DEFAULT: "z-ai/glm-4.7";
5
- readonly SMALL: "z-ai/glm-4.7";
6
- readonly LARGE: "z-ai/glm-4.7";
7
- readonly TINY: "z-ai/glm-4.7";
7
+ readonly DEFAULT: "claude-sonnet-4-5";
8
+ readonly LARGE: "claude-opus-4-5";
9
+ readonly SMALL: "claude-sonnet-4-5";
10
+ readonly TINY: "claude-haiku-4-5";
11
+ };
12
+ readonly MODEL_MATCH_WORDS: readonly ["anthropic", "claude", "haiku", "opus", "sonnet"];
13
+ readonly NAME: "anthropic";
14
+ readonly PROMPT: {
15
+ readonly AI: "\n\nAssistant:";
16
+ readonly HUMAN: "\n\nHuman:";
8
17
  };
9
- readonly MODEL_MATCH_WORDS: readonly ["openrouter"];
10
- readonly NAME: "openrouter";
11
18
  readonly ROLE: {
12
19
  readonly ASSISTANT: "assistant";
13
20
  readonly SYSTEM: "system";
14
- readonly TOOL: "tool";
15
21
  readonly USER: "user";
16
22
  };
23
+ readonly TOOLS: {
24
+ readonly SCHEMA_VERSION: "v2";
25
+ };
17
26
  };
18
27
  readonly GEMINI: {
19
28
  readonly MODEL: {
@@ -29,65 +38,56 @@ export declare const PROVIDER: {
29
38
  readonly USER: "user";
30
39
  };
31
40
  };
32
- readonly ANTHROPIC: {
41
+ readonly OPENAI: {
33
42
  readonly MODEL: {
34
- readonly DEFAULT: "claude-sonnet-4-5";
35
- readonly LARGE: "claude-opus-4-5";
36
- readonly SMALL: "claude-sonnet-4-5";
37
- readonly TINY: "claude-haiku-4-5";
43
+ readonly DEFAULT: "gpt-5.2";
44
+ readonly LARGE: "gpt-5.2-pro";
45
+ readonly SMALL: "gpt-5-mini";
46
+ readonly TINY: "gpt-5-nano";
38
47
  };
39
- readonly MODEL_MATCH_WORDS: readonly ["anthropic", "claude", "haiku", "opus", "sonnet"];
40
- readonly NAME: "anthropic";
41
- readonly PROMPT: {
42
- readonly AI: "\n\nAssistant:";
43
- readonly HUMAN: "\n\nHuman:";
48
+ readonly MODEL_MATCH_WORDS: readonly ["openai", "gpt", RegExp];
49
+ readonly NAME: "openai";
50
+ };
51
+ readonly OPENROUTER: {
52
+ readonly MODEL: {
53
+ readonly DEFAULT: "z-ai/glm-4.7";
54
+ readonly LARGE: "z-ai/glm-4.7";
55
+ readonly SMALL: "z-ai/glm-4.7";
56
+ readonly TINY: "z-ai/glm-4.7";
44
57
  };
58
+ readonly MODEL_MATCH_WORDS: readonly ["openrouter"];
59
+ readonly NAME: "openrouter";
45
60
  readonly ROLE: {
46
61
  readonly ASSISTANT: "assistant";
47
62
  readonly SYSTEM: "system";
63
+ readonly TOOL: "tool";
48
64
  readonly USER: "user";
49
65
  };
50
- readonly MAX_TOKENS: {
51
- readonly DEFAULT: 4096;
52
- };
53
- readonly TOOLS: {
54
- readonly SCHEMA_VERSION: "v2";
55
- };
56
- };
57
- readonly OPENAI: {
58
- readonly MODEL: {
59
- readonly DEFAULT: "gpt-5.1";
60
- readonly LARGE: "gpt-5.1";
61
- readonly SMALL: "gpt-5.1-mini";
62
- readonly TINY: "gpt-5.1-nano";
63
- };
64
- readonly MODEL_MATCH_WORDS: readonly ["openai", "gpt", RegExp];
65
- readonly NAME: "openai";
66
66
  };
67
67
  };
68
68
  export type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.GEMINI.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME;
69
69
  export declare const DEFAULT: {
70
70
  readonly MODEL: {
71
- readonly BASE: "gpt-5.1";
72
- readonly LARGE: "gpt-5.1";
73
- readonly SMALL: "gpt-5.1-mini";
74
- readonly TINY: "gpt-5.1-nano";
71
+ readonly BASE: "gpt-5.2";
72
+ readonly LARGE: "gpt-5.2-pro";
73
+ readonly SMALL: "gpt-5-mini";
74
+ readonly TINY: "gpt-5-nano";
75
75
  };
76
76
  readonly PROVIDER: {
77
77
  readonly MODEL: {
78
- readonly DEFAULT: "gpt-5.1";
79
- readonly LARGE: "gpt-5.1";
80
- readonly SMALL: "gpt-5.1-mini";
81
- readonly TINY: "gpt-5.1-nano";
78
+ readonly DEFAULT: "gpt-5.2";
79
+ readonly LARGE: "gpt-5.2-pro";
80
+ readonly SMALL: "gpt-5-mini";
81
+ readonly TINY: "gpt-5-nano";
82
82
  };
83
83
  readonly MODEL_MATCH_WORDS: readonly ["openai", "gpt", RegExp];
84
84
  readonly NAME: "openai";
85
85
  };
86
86
  };
87
87
  export declare const ALL: {
88
- readonly BASE: readonly ["claude-sonnet-4-5", "gemini-3-pro-preview", "gpt-5.1"];
89
- readonly COMBINED: readonly ["claude-sonnet-4-5", "claude-opus-4-5", "claude-sonnet-4-5", "claude-haiku-4-5", "gemini-3-pro-preview", "gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-3-flash-preview", "gpt-5.1", "gpt-5.1", "gpt-5.1-mini", "gpt-5.1-nano"];
90
- readonly LARGE: readonly ["claude-opus-4-5", "gemini-3-pro-preview", "gpt-5.1"];
91
- readonly SMALL: readonly ["claude-sonnet-4-5", "gemini-3-flash-preview", "gpt-5.1-mini"];
92
- readonly TINY: readonly ["claude-haiku-4-5", "gemini-3-flash-preview", "gpt-5.1-nano"];
88
+ readonly BASE: readonly ["claude-sonnet-4-5", "gemini-3-pro-preview", "gpt-5.2"];
89
+ readonly COMBINED: readonly ["claude-sonnet-4-5", "claude-opus-4-5", "claude-sonnet-4-5", "claude-haiku-4-5", "gemini-3-pro-preview", "gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-3-flash-preview", "gpt-5.2", "gpt-5.2-pro", "gpt-5-mini", "gpt-5-nano"];
90
+ readonly LARGE: readonly ["claude-opus-4-5", "gemini-3-pro-preview", "gpt-5.2-pro"];
91
+ readonly SMALL: readonly ["claude-sonnet-4-5", "gemini-3-flash-preview", "gpt-5-mini"];
92
+ readonly TINY: readonly ["claude-haiku-4-5", "gemini-3-flash-preview", "gpt-5-nano"];
93
93
  };
package/dist/esm/index.js CHANGED
@@ -11,49 +11,43 @@ import { resolve } from 'path';
11
11
  import { getS3FileBuffer, getEnvSecret } from '@jaypie/aws';
12
12
  import { fetchWeatherApi } from 'openmeteo';
13
13
 
14
- const PROVIDER = {
15
- OPENROUTER: {
16
- // https://openrouter.ai/models
17
- // OpenRouter provides access to hundreds of models from various providers
18
- // The model format is: provider/model-name (e.g., "openai/gpt-4", "anthropic/claude-3-opus")
19
- MODEL: {
20
- // Default uses env var OPENROUTER_MODEL if set, otherwise a reasonable default
21
- DEFAULT: "z-ai/glm-4.7",
22
- SMALL: "z-ai/glm-4.7",
23
- LARGE: "z-ai/glm-4.7",
24
- TINY: "z-ai/glm-4.7",
25
- },
26
- MODEL_MATCH_WORDS: ["openrouter"],
27
- NAME: "openrouter",
28
- ROLE: {
29
- ASSISTANT: "assistant",
30
- SYSTEM: "system",
31
- TOOL: "tool",
32
- USER: "user",
33
- },
14
+ const FIRST_CLASS_PROVIDER = {
15
+ ANTHROPIC: {
16
+ DEFAULT: "claude-sonnet-4-5",
17
+ LARGE: "claude-opus-4-5",
18
+ SMALL: "claude-sonnet-4-5",
19
+ TINY: "claude-haiku-4-5",
34
20
  },
35
21
  GEMINI: {
36
- // https://ai.google.dev/gemini-api/docs/models
37
- MODEL: {
38
- DEFAULT: "gemini-3-pro-preview",
39
- LARGE: "gemini-3-pro-preview",
40
- SMALL: "gemini-3-flash-preview",
41
- TINY: "gemini-3-flash-preview",
42
- },
43
- MODEL_MATCH_WORDS: ["gemini", "google"],
44
- NAME: "gemini",
45
- ROLE: {
46
- MODEL: "model",
47
- USER: "user",
48
- },
22
+ DEFAULT: "gemini-3-pro-preview",
23
+ LARGE: "gemini-3-pro-preview",
24
+ SMALL: "gemini-3-flash-preview",
25
+ TINY: "gemini-3-flash-preview",
26
+ },
27
+ OPENAI: {
28
+ DEFAULT: "gpt-5.2",
29
+ LARGE: "gpt-5.2-pro",
30
+ SMALL: "gpt-5-mini",
31
+ TINY: "gpt-5-nano",
32
+ },
33
+ OPENROUTER: {
34
+ DEFAULT: "z-ai/glm-4.7",
35
+ LARGE: "z-ai/glm-4.7",
36
+ SMALL: "z-ai/glm-4.7",
37
+ TINY: "z-ai/glm-4.7",
49
38
  },
39
+ };
40
+ const PROVIDER = {
50
41
  ANTHROPIC: {
51
42
  // https://docs.anthropic.com/en/docs/about-claude/models/overview
43
+ MAX_TOKENS: {
44
+ DEFAULT: 4096,
45
+ },
52
46
  MODEL: {
53
- DEFAULT: "claude-sonnet-4-5",
54
- LARGE: "claude-opus-4-5",
55
- SMALL: "claude-sonnet-4-5",
56
- TINY: "claude-haiku-4-5",
47
+ DEFAULT: FIRST_CLASS_PROVIDER.ANTHROPIC.DEFAULT,
48
+ LARGE: FIRST_CLASS_PROVIDER.ANTHROPIC.LARGE,
49
+ SMALL: FIRST_CLASS_PROVIDER.ANTHROPIC.SMALL,
50
+ TINY: FIRST_CLASS_PROVIDER.ANTHROPIC.TINY,
57
51
  },
58
52
  MODEL_MATCH_WORDS: [
59
53
  "anthropic",
@@ -72,24 +66,56 @@ const PROVIDER = {
72
66
  SYSTEM: "system",
73
67
  USER: "user",
74
68
  },
75
- MAX_TOKENS: {
76
- DEFAULT: 4096,
77
- },
78
69
  TOOLS: {
79
70
  SCHEMA_VERSION: "v2",
80
71
  },
81
72
  },
73
+ GEMINI: {
74
+ // https://ai.google.dev/gemini-api/docs/models
75
+ MODEL: {
76
+ DEFAULT: FIRST_CLASS_PROVIDER.GEMINI.DEFAULT,
77
+ LARGE: FIRST_CLASS_PROVIDER.GEMINI.LARGE,
78
+ SMALL: FIRST_CLASS_PROVIDER.GEMINI.SMALL,
79
+ TINY: FIRST_CLASS_PROVIDER.GEMINI.TINY,
80
+ },
81
+ MODEL_MATCH_WORDS: ["gemini", "google"],
82
+ NAME: "gemini",
83
+ ROLE: {
84
+ MODEL: "model",
85
+ USER: "user",
86
+ },
87
+ },
82
88
  OPENAI: {
83
89
  // https://platform.openai.com/docs/models
84
90
  MODEL: {
85
- DEFAULT: "gpt-5.1",
86
- LARGE: "gpt-5.1",
87
- SMALL: "gpt-5.1-mini",
88
- TINY: "gpt-5.1-nano",
91
+ DEFAULT: FIRST_CLASS_PROVIDER.OPENAI.DEFAULT,
92
+ LARGE: FIRST_CLASS_PROVIDER.OPENAI.LARGE,
93
+ SMALL: FIRST_CLASS_PROVIDER.OPENAI.SMALL,
94
+ TINY: FIRST_CLASS_PROVIDER.OPENAI.TINY,
89
95
  },
90
96
  MODEL_MATCH_WORDS: ["openai", "gpt", /^o\d/],
91
97
  NAME: "openai",
92
98
  },
99
+ OPENROUTER: {
100
+ // https://openrouter.ai/models
101
+ // OpenRouter provides access to hundreds of models from various providers
102
+ // The model format is: provider/model-name (e.g., "openai/gpt-4", "anthropic/claude-3-opus")
103
+ MODEL: {
104
+ // Default uses env var OPENROUTER_MODEL if set, otherwise a reasonable default
105
+ DEFAULT: FIRST_CLASS_PROVIDER.OPENROUTER.DEFAULT,
106
+ LARGE: FIRST_CLASS_PROVIDER.OPENROUTER.LARGE,
107
+ SMALL: FIRST_CLASS_PROVIDER.OPENROUTER.SMALL,
108
+ TINY: FIRST_CLASS_PROVIDER.OPENROUTER.TINY,
109
+ },
110
+ MODEL_MATCH_WORDS: ["openrouter"],
111
+ NAME: "openrouter",
112
+ ROLE: {
113
+ ASSISTANT: "assistant",
114
+ SYSTEM: "system",
115
+ TOOL: "tool",
116
+ USER: "user",
117
+ },
118
+ },
93
119
  };
94
120
  // Last: Defaults
95
121
  const DEFAULT = {