@jaypie/llm 1.2.19 → 1.2.21

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.
@@ -4,9 +4,9 @@ export declare const PROVIDER: {
4
4
  readonly DEFAULT: 4096;
5
5
  };
6
6
  readonly MODEL: {
7
- readonly DEFAULT: "claude-sonnet-4-5";
8
- readonly LARGE: "claude-opus-4-5";
9
- readonly SMALL: "claude-sonnet-4-5";
7
+ readonly DEFAULT: "claude-sonnet-4-6";
8
+ readonly LARGE: "claude-opus-4-6";
9
+ readonly SMALL: "claude-sonnet-4-6";
10
10
  readonly TINY: "claude-haiku-4-5";
11
11
  };
12
12
  readonly MODEL_MATCH_WORDS: readonly ["anthropic", "claude", "haiku", "opus", "sonnet"];
@@ -26,10 +26,10 @@ export declare const PROVIDER: {
26
26
  };
27
27
  readonly GEMINI: {
28
28
  readonly MODEL: {
29
- readonly DEFAULT: "gemini-3-pro-preview";
30
- readonly LARGE: "gemini-3-pro-preview";
29
+ readonly DEFAULT: "gemini-3.1-pro-preview";
30
+ readonly LARGE: "gemini-3.1-pro-preview";
31
31
  readonly SMALL: "gemini-3-flash-preview";
32
- readonly TINY: "gemini-3-flash-preview";
32
+ readonly TINY: "gemini-3.1-flash-lite-preview";
33
33
  };
34
34
  readonly MODEL_MATCH_WORDS: readonly ["gemini", "google"];
35
35
  readonly NAME: "google";
@@ -40,20 +40,20 @@ export declare const PROVIDER: {
40
40
  };
41
41
  readonly OPENAI: {
42
42
  readonly MODEL: {
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";
43
+ readonly DEFAULT: "gpt-5.4";
44
+ readonly LARGE: "gpt-5.4";
45
+ readonly SMALL: "gpt-5.4-mini";
46
+ readonly TINY: "gpt-5.4-nano";
47
47
  };
48
48
  readonly MODEL_MATCH_WORDS: readonly ["openai", "gpt", RegExp];
49
49
  readonly NAME: "openai";
50
50
  };
51
51
  readonly OPENROUTER: {
52
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";
53
+ readonly DEFAULT: "anthropic/claude-sonnet-4-6";
54
+ readonly LARGE: "anthropic/claude-opus-4-6";
55
+ readonly SMALL: "anthropic/claude-sonnet-4-6";
56
+ readonly TINY: "anthropic/claude-haiku-4-5";
57
57
  };
58
58
  readonly MODEL_MATCH_WORDS: readonly ["openrouter"];
59
59
  readonly NAME: "openrouter";
@@ -68,10 +68,10 @@ export declare const PROVIDER: {
68
68
  readonly API_KEY: "XAI_API_KEY";
69
69
  readonly BASE_URL: "https://api.x.ai/v1";
70
70
  readonly MODEL: {
71
- readonly DEFAULT: "grok-4-1-fast-reasoning";
72
- readonly LARGE: "grok-4-1-fast-reasoning";
73
- readonly SMALL: "grok-3";
74
- readonly TINY: "grok-3-mini";
71
+ readonly DEFAULT: "grok-4.20-0309-reasoning";
72
+ readonly LARGE: "grok-4.20-0309-reasoning";
73
+ readonly SMALL: "grok-4.20-0309-non-reasoning";
74
+ readonly TINY: "grok-4-1-fast-non-reasoning";
75
75
  };
76
76
  readonly MODEL_MATCH_WORDS: readonly ["grok", "xai"];
77
77
  readonly NAME: "xai";
@@ -80,26 +80,26 @@ export declare const PROVIDER: {
80
80
  export type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.GEMINI.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME | typeof PROVIDER.XAI.NAME;
81
81
  export declare const DEFAULT: {
82
82
  readonly MODEL: {
83
- readonly BASE: "gpt-5.2";
84
- readonly LARGE: "gpt-5.2-pro";
85
- readonly SMALL: "gpt-5-mini";
86
- readonly TINY: "gpt-5-nano";
83
+ readonly BASE: "gpt-5.4";
84
+ readonly LARGE: "gpt-5.4";
85
+ readonly SMALL: "gpt-5.4-mini";
86
+ readonly TINY: "gpt-5.4-nano";
87
87
  };
88
88
  readonly PROVIDER: {
89
89
  readonly MODEL: {
90
- readonly DEFAULT: "gpt-5.2";
91
- readonly LARGE: "gpt-5.2-pro";
92
- readonly SMALL: "gpt-5-mini";
93
- readonly TINY: "gpt-5-nano";
90
+ readonly DEFAULT: "gpt-5.4";
91
+ readonly LARGE: "gpt-5.4";
92
+ readonly SMALL: "gpt-5.4-mini";
93
+ readonly TINY: "gpt-5.4-nano";
94
94
  };
95
95
  readonly MODEL_MATCH_WORDS: readonly ["openai", "gpt", RegExp];
96
96
  readonly NAME: "openai";
97
97
  };
98
98
  };
99
99
  export declare const ALL: {
100
- readonly BASE: readonly ["claude-sonnet-4-5", "gemini-3-pro-preview", "gpt-5.2", "grok-4-1-fast-reasoning"];
101
- 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", "grok-4-1-fast-reasoning", "grok-4-1-fast-reasoning", "grok-3", "grok-3-mini"];
102
- readonly LARGE: readonly ["claude-opus-4-5", "gemini-3-pro-preview", "gpt-5.2-pro", "grok-4-1-fast-reasoning"];
103
- readonly SMALL: readonly ["claude-sonnet-4-5", "gemini-3-flash-preview", "gpt-5-mini", "grok-3"];
104
- readonly TINY: readonly ["claude-haiku-4-5", "gemini-3-flash-preview", "gpt-5-nano", "grok-3-mini"];
100
+ readonly BASE: readonly ["claude-sonnet-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-4.20-0309-reasoning"];
101
+ readonly COMBINED: readonly ["claude-sonnet-4-6", "claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", "gemini-3.1-pro-preview", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-3.1-flash-lite-preview", "gpt-5.4", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "grok-4.20-0309-reasoning", "grok-4.20-0309-reasoning", "grok-4.20-0309-non-reasoning", "grok-4-1-fast-non-reasoning"];
102
+ readonly LARGE: readonly ["claude-opus-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-4.20-0309-reasoning"];
103
+ readonly SMALL: readonly ["claude-sonnet-4-6", "gemini-3-flash-preview", "gpt-5.4-mini", "grok-4.20-0309-non-reasoning"];
104
+ readonly TINY: readonly ["claude-haiku-4-5", "gemini-3.1-flash-lite-preview", "gpt-5.4-nano", "grok-4-1-fast-non-reasoning"];
105
105
  };
@@ -14,35 +14,33 @@ var aws = require('@jaypie/aws');
14
14
  var openmeteo = require('openmeteo');
15
15
 
16
16
  const FIRST_CLASS_PROVIDER = {
17
+ // https://docs.anthropic.com/en/docs/about-claude/models/overview
17
18
  ANTHROPIC: {
18
- DEFAULT: "claude-sonnet-4-5",
19
- LARGE: "claude-opus-4-5",
20
- SMALL: "claude-sonnet-4-5",
19
+ DEFAULT: "claude-sonnet-4-6",
20
+ LARGE: "claude-opus-4-6",
21
+ SMALL: "claude-sonnet-4-6",
21
22
  TINY: "claude-haiku-4-5",
22
23
  },
24
+ // https://ai.google.dev/gemini-api/docs/models
23
25
  GEMINI: {
24
- DEFAULT: "gemini-3-pro-preview",
25
- LARGE: "gemini-3-pro-preview",
26
+ DEFAULT: "gemini-3.1-pro-preview",
27
+ LARGE: "gemini-3.1-pro-preview",
26
28
  SMALL: "gemini-3-flash-preview",
27
- TINY: "gemini-3-flash-preview",
29
+ TINY: "gemini-3.1-flash-lite-preview",
28
30
  },
31
+ // https://developers.openai.com/api/docs/models
29
32
  OPENAI: {
30
- DEFAULT: "gpt-5.2",
31
- LARGE: "gpt-5.2-pro",
32
- SMALL: "gpt-5-mini",
33
- TINY: "gpt-5-nano",
34
- },
35
- OPENROUTER: {
36
- DEFAULT: "z-ai/glm-4.7",
37
- LARGE: "z-ai/glm-4.7",
38
- SMALL: "z-ai/glm-4.7",
39
- TINY: "z-ai/glm-4.7",
33
+ DEFAULT: "gpt-5.4",
34
+ LARGE: "gpt-5.4",
35
+ SMALL: "gpt-5.4-mini",
36
+ TINY: "gpt-5.4-nano",
40
37
  },
38
+ // https://docs.x.ai/developers/models
41
39
  XAI: {
42
- DEFAULT: "grok-4-1-fast-reasoning",
43
- LARGE: "grok-4-1-fast-reasoning",
44
- SMALL: "grok-3",
45
- TINY: "grok-3-mini",
40
+ DEFAULT: "grok-4.20-0309-reasoning",
41
+ LARGE: "grok-4.20-0309-reasoning",
42
+ SMALL: "grok-4.20-0309-non-reasoning",
43
+ TINY: "grok-4-1-fast-non-reasoning",
46
44
  },
47
45
  };
48
46
  const PROVIDER = {
@@ -105,15 +103,11 @@ const PROVIDER = {
105
103
  NAME: "openai",
106
104
  },
107
105
  OPENROUTER: {
108
- // https://openrouter.ai/models
109
- // OpenRouter provides access to hundreds of models from various providers
110
- // The model format is: provider/model-name (e.g., "openai/gpt-4", "anthropic/claude-3-opus")
111
106
  MODEL: {
112
- // Default uses env var OPENROUTER_MODEL if set, otherwise a reasonable default
113
- DEFAULT: FIRST_CLASS_PROVIDER.OPENROUTER.DEFAULT,
114
- LARGE: FIRST_CLASS_PROVIDER.OPENROUTER.LARGE,
115
- SMALL: FIRST_CLASS_PROVIDER.OPENROUTER.SMALL,
116
- TINY: FIRST_CLASS_PROVIDER.OPENROUTER.TINY,
107
+ DEFAULT: `anthropic/${FIRST_CLASS_PROVIDER.ANTHROPIC.DEFAULT}`,
108
+ LARGE: `anthropic/${FIRST_CLASS_PROVIDER.ANTHROPIC.LARGE}`,
109
+ SMALL: `anthropic/${FIRST_CLASS_PROVIDER.ANTHROPIC.SMALL}`,
110
+ TINY: `anthropic/${FIRST_CLASS_PROVIDER.ANTHROPIC.TINY}`,
117
111
  },
118
112
  MODEL_MATCH_WORDS: ["openrouter"],
119
113
  NAME: "openrouter",
@@ -4427,6 +4421,19 @@ class OperateLoop {
4427
4421
  status: jaypieError.status,
4428
4422
  title: ERROR$1.BAD_FUNCTION_CALL,
4429
4423
  });
4424
+ // Add error tool_result to history so the tool_use block is not orphaned.
4425
+ // Without this, the next turn's request would have a tool_use without a
4426
+ // matching tool_result, causing Anthropic API to reject with 400.
4427
+ const errorResult = {
4428
+ callId: toolCall.callId,
4429
+ output: JSON.stringify({
4430
+ error: error.message || "Tool execution failed",
4431
+ }),
4432
+ success: false,
4433
+ error: error.message,
4434
+ };
4435
+ const toolResultFormatted = this.adapter.formatToolResult(toolCall, errorResult);
4436
+ state.responseBuilder.appendToHistory(toolResultFormatted);
4430
4437
  log$1.error(`Error executing function call ${toolCall.name}`);
4431
4438
  log$1.var({ error });
4432
4439
  }
@@ -4907,6 +4914,18 @@ class StreamLoop {
4907
4914
  title: ERROR.BAD_FUNCTION_CALL,
4908
4915
  },
4909
4916
  };
4917
+ // Add error tool_result to history so the tool_use block is not orphaned.
4918
+ // Without this, the next turn's request would have a tool_use without a
4919
+ // matching tool_result, causing Anthropic API to reject with 400.
4920
+ const errorOutput = JSON.stringify({
4921
+ error: error.message || "Tool execution failed",
4922
+ });
4923
+ state.currentInput.push({
4924
+ type: exports.LlmMessageType.FunctionCallOutput,
4925
+ output: errorOutput,
4926
+ call_id: toolCall.callId,
4927
+ name: toolCall.name,
4928
+ });
4910
4929
  log$1.error(`Error executing function call ${toolCall.name}`);
4911
4930
  log$1.var({ error });
4912
4931
  }