@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.
- package/dist/cjs/constants.d.ts +47 -47
- package/dist/cjs/index.cjs +70 -44
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/operate/adapters/OpenAiAdapter.d.ts +1 -1
- package/dist/cjs/tools/Toolkit.class.d.ts +1 -1
- package/dist/esm/constants.d.ts +47 -47
- package/dist/esm/index.js +70 -44
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operate/adapters/OpenAiAdapter.d.ts +1 -1
- package/dist/esm/tools/Toolkit.class.d.ts +1 -1
- package/package.json +5 -5
|
@@ -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.
|
|
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;
|
package/dist/esm/constants.d.ts
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
export declare const PROVIDER: {
|
|
2
|
-
readonly
|
|
2
|
+
readonly ANTHROPIC: {
|
|
3
|
+
readonly MAX_TOKENS: {
|
|
4
|
+
readonly DEFAULT: 4096;
|
|
5
|
+
};
|
|
3
6
|
readonly MODEL: {
|
|
4
|
-
readonly DEFAULT: "
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly TINY: "
|
|
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
|
|
41
|
+
readonly OPENAI: {
|
|
33
42
|
readonly MODEL: {
|
|
34
|
-
readonly DEFAULT: "
|
|
35
|
-
readonly LARGE: "
|
|
36
|
-
readonly SMALL: "
|
|
37
|
-
readonly TINY: "
|
|
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 ["
|
|
40
|
-
readonly NAME: "
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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.
|
|
72
|
-
readonly LARGE: "gpt-5.
|
|
73
|
-
readonly SMALL: "gpt-5
|
|
74
|
-
readonly TINY: "gpt-5
|
|
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.
|
|
79
|
-
readonly LARGE: "gpt-5.
|
|
80
|
-
readonly SMALL: "gpt-5
|
|
81
|
-
readonly TINY: "gpt-5
|
|
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.
|
|
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.
|
|
90
|
-
readonly LARGE: readonly ["claude-opus-4-5", "gemini-3-pro-preview", "gpt-5.
|
|
91
|
-
readonly SMALL: readonly ["claude-sonnet-4-5", "gemini-3-flash-preview", "gpt-5
|
|
92
|
-
readonly TINY: readonly ["claude-haiku-4-5", "gemini-3-flash-preview", "gpt-5
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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:
|
|
54
|
-
LARGE:
|
|
55
|
-
SMALL:
|
|
56
|
-
TINY:
|
|
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:
|
|
86
|
-
LARGE:
|
|
87
|
-
SMALL:
|
|
88
|
-
TINY:
|
|
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 = {
|