llm.rb 15.0.3 → 15.2.0

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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +433 -3
  3. data/README.md +188 -71
  4. data/bin/llm.rb +50 -7
  5. data/data/alibaba.json +912 -823
  6. data/data/anthropic.json +234 -187
  7. data/data/bedrock.json +3702 -2058
  8. data/data/deepinfra.json +1288 -951
  9. data/data/deepseek.json +87 -53
  10. data/data/google.json +670 -670
  11. data/data/mistral.json +501 -460
  12. data/data/moonshot.json +43 -248
  13. data/data/openai.json +1008 -914
  14. data/data/openrouter.json +14417 -0
  15. data/data/xai.json +213 -201
  16. data/data/zai.json +242 -149
  17. data/docs/deepdive/advanced/compaction.md +5 -5
  18. data/docs/deepdive/advanced/context.md +8 -6
  19. data/docs/deepdive/advanced/guard.md +2 -2
  20. data/docs/deepdive/features/builtin_tools.md +93 -22
  21. data/docs/deepdive/features/{repl.md → console.md} +28 -28
  22. data/docs/deepdive/features/database.md +3 -3
  23. data/docs/deepdive/fundamentals/agents.md +13 -12
  24. data/docs/deepdive/fundamentals/providers.md +91 -6
  25. data/docs/deepdive/fundamentals/skills.md +14 -6
  26. data/docs/deepdive/fundamentals/stream.md +4 -4
  27. data/docs/deepdive/fundamentals/tools.md +63 -31
  28. data/docs/deepdive/reference/cost.md +2 -2
  29. data/docs/deepdive/reference/model_registry.md +2 -2
  30. data/docs/deepdive/reference/tracer.md +15 -13
  31. data/docs/deepdive.md +2 -2
  32. data/lib/llm/active_record/acts_as_agent.rb +9 -5
  33. data/lib/llm/agent.rb +40 -15
  34. data/lib/llm/{repl → console}/bar.rb +3 -3
  35. data/lib/llm/{repl → console}/buffer.rb +24 -9
  36. data/lib/llm/{repl → console}/color.rb +2 -2
  37. data/lib/llm/{repl → console}/command.rb +12 -12
  38. data/lib/llm/{repl → console}/commands/exit.rb +4 -4
  39. data/lib/llm/{repl → console}/commands/help.rb +1 -1
  40. data/lib/llm/{repl/commands/compact.rb → console/commands/keep.rb} +11 -9
  41. data/lib/llm/{repl → console}/commands/model.rb +2 -2
  42. data/lib/llm/{repl → console}/input/cache.rb +2 -2
  43. data/lib/llm/{repl → console}/input/char.rb +2 -2
  44. data/lib/llm/{repl → console}/input/row.rb +1 -1
  45. data/lib/llm/{repl → console}/input.rb +18 -10
  46. data/lib/llm/console/markdown/parser.rb +78 -0
  47. data/lib/llm/{repl → console}/markdown/table.rb +8 -5
  48. data/lib/llm/{repl → console}/markdown.rb +13 -30
  49. data/lib/llm/console/node.rb +69 -0
  50. data/lib/llm/{repl → console}/status.rb +11 -11
  51. data/lib/llm/{repl → console}/stream.rb +36 -9
  52. data/lib/llm/{repl → console}/walker.rb +1 -1
  53. data/lib/llm/{repl → console}/window.rb +17 -17
  54. data/lib/llm/{repl.rb → console.rb} +39 -19
  55. data/lib/llm/context/deserializer.rb +2 -1
  56. data/lib/llm/context.rb +29 -13
  57. data/lib/llm/cost.rb +13 -0
  58. data/lib/llm/function/async/reactor.rb +20 -1
  59. data/lib/llm/function/fork/task.rb +14 -10
  60. data/lib/llm/function.rb +1 -1
  61. data/lib/llm/json_adapter.rb +40 -28
  62. data/lib/llm/message.rb +7 -0
  63. data/lib/llm/provider.rb +31 -10
  64. data/lib/llm/providers/alibaba.rb +1 -1
  65. data/lib/llm/providers/anthropic.rb +1 -1
  66. data/lib/llm/providers/bedrock/models.rb +2 -2
  67. data/lib/llm/providers/bedrock.rb +1 -1
  68. data/lib/llm/providers/deepseek.rb +1 -1
  69. data/lib/llm/providers/google.rb +1 -1
  70. data/lib/llm/providers/ollama.rb +1 -1
  71. data/lib/llm/providers/openai/responses.rb +2 -1
  72. data/lib/llm/providers/openai.rb +2 -1
  73. data/lib/llm/providers/openrouter.rb +87 -0
  74. data/lib/llm/schema/leaf.rb +34 -2
  75. data/lib/llm/schema.rb +4 -2
  76. data/lib/llm/sequel/agent.rb +9 -5
  77. data/lib/llm/skill.rb +7 -1
  78. data/lib/llm/stream.rb +8 -3
  79. data/lib/llm/tool/param.rb +5 -1
  80. data/lib/llm/tool.rb +5 -0
  81. data/lib/llm/tools/bundle.rb +53 -0
  82. data/lib/llm/tools/edit-file.rb +7 -2
  83. data/lib/llm/tools/exec.rb +78 -0
  84. data/lib/llm/tools/git.rb +27 -26
  85. data/lib/llm/tools/mkdir.rb +12 -19
  86. data/lib/llm/tools/read_file.rb +69 -9
  87. data/lib/llm/tools/rg.rb +20 -24
  88. data/lib/llm/tools/ruby.rb +17 -25
  89. data/lib/llm/tools/utils.rb +75 -2
  90. data/lib/llm/tools/write_file.rb +4 -1
  91. data/lib/llm/tracer/logger.rb +2 -2
  92. data/lib/llm/tracer/pretty_logger.rb +4 -4
  93. data/lib/llm/tracer/telemetry.rb +2 -2
  94. data/lib/llm/tracer.rb +33 -0
  95. data/lib/llm/transport/curb.rb +5 -3
  96. data/lib/llm/transport/http.rb +5 -2
  97. data/lib/llm/transport/persistent_http.rb +6 -4
  98. data/lib/llm/transport/utils.rb +8 -6
  99. data/lib/llm/version.rb +1 -1
  100. data/lib/llm.rb +18 -12
  101. data/llm.gemspec +8 -8
  102. metadata +80 -37
  103. data/lib/llm/repl/node.rb +0 -44
  104. data/lib/llm/tools/shell.rb +0 -55
data/data/deepseek.json CHANGED
@@ -8,12 +8,12 @@
8
8
  "name": "DeepSeek",
9
9
  "doc": "https://api-docs.deepseek.com/quick_start/pricing",
10
10
  "models": {
11
- "deepseek-v4-flash": {
12
- "id": "deepseek-v4-flash",
13
- "name": "DeepSeek V4 Flash",
14
- "description": "Official DeepSeek V4 Flash release with enhanced agentic capabilities and integrated DSpark speculative decoding",
11
+ "deepseek-v4-flash-vision-exp": {
12
+ "id": "deepseek-v4-flash-vision-exp",
13
+ "name": "DeepSeek V4 Flash Vision Exp",
14
+ "description": "DeepSeek V4.1 Flash model for reasoning and agentic coding",
15
15
  "family": "deepseek-flash",
16
- "attachment": false,
16
+ "attachment": true,
17
17
  "reasoning": true,
18
18
  "reasoning_options": [
19
19
  {
@@ -35,11 +35,12 @@
35
35
  "structured_output": true,
36
36
  "temperature": true,
37
37
  "knowledge": "2025-05",
38
- "release_date": "2026-07-31",
39
- "last_updated": "2026-07-31",
38
+ "release_date": "2026-09-10",
39
+ "last_updated": "2026-09-10",
40
40
  "modalities": {
41
41
  "input": [
42
- "text"
42
+ "text",
43
+ "image"
43
44
  ],
44
45
  "output": [
45
46
  "text"
@@ -51,18 +52,18 @@
51
52
  "output": 384000
52
53
  },
53
54
  "cost": {
54
- "input": 0.14,
55
- "output": 0.28,
56
- "reasoning": 0.28,
57
- "cache_read": 0.0028
55
+ "input": 0.15,
56
+ "output": 0.6,
57
+ "reasoning": 0.6,
58
+ "cache_read": 0.003
58
59
  }
59
60
  },
60
- "deepseek-v4-pro": {
61
- "id": "deepseek-v4-pro",
62
- "name": "DeepSeek V4 Pro",
63
- "description": "DeepSeek V4 Pro snapshot with million-token context and support for thinking and non-thinking modes",
64
- "family": "deepseek-thinking",
65
- "attachment": false,
61
+ "deepseek-v4-flash": {
62
+ "id": "deepseek-v4-flash",
63
+ "name": "DeepSeek V4 Flash",
64
+ "description": "DeepSeek V4.1 Flash model for reasoning and agentic coding",
65
+ "family": "deepseek-flash",
66
+ "attachment": true,
66
67
  "reasoning": true,
67
68
  "reasoning_options": [
68
69
  {
@@ -71,6 +72,7 @@
71
72
  {
72
73
  "type": "effort",
73
74
  "values": [
75
+ "low",
74
76
  "high",
75
77
  "max"
76
78
  ]
@@ -82,40 +84,57 @@
82
84
  },
83
85
  "structured_output": true,
84
86
  "temperature": true,
85
- "release_date": "2026-08-12",
86
- "last_updated": "2026-08-12",
87
+ "knowledge": "2025-05",
88
+ "release_date": "2026-09-10",
89
+ "last_updated": "2026-09-10",
87
90
  "modalities": {
88
91
  "input": [
89
- "text"
92
+ "text",
93
+ "image"
90
94
  ],
91
95
  "output": [
92
96
  "text"
93
97
  ]
94
98
  },
95
- "open_weights": false,
99
+ "open_weights": true,
96
100
  "limit": {
97
101
  "context": 1000000,
98
102
  "output": 384000
99
103
  },
100
104
  "cost": {
101
- "input": 0.435,
102
- "output": 0.87,
103
- "reasoning": 0.87,
104
- "cache_read": 0.003625
105
+ "input": 0.15,
106
+ "output": 0.6,
107
+ "reasoning": 0.6,
108
+ "cache_read": 0.003
105
109
  }
106
110
  },
107
- "deepseek-chat": {
108
- "id": "deepseek-chat",
109
- "name": "DeepSeek Chat",
110
- "description": "DeepSeek chat model for instruction following, coding, and analysis",
111
- "family": "deepseek",
112
- "attachment": true,
113
- "reasoning": false,
111
+ "deepseek-v4-pro": {
112
+ "id": "deepseek-v4-pro",
113
+ "name": "DeepSeek V4 Pro",
114
+ "description": "DeepSeek V4 Pro snapshot with million-token context and support for thinking and non-thinking modes",
115
+ "family": "deepseek-thinking",
116
+ "attachment": false,
117
+ "reasoning": true,
118
+ "reasoning_options": [
119
+ {
120
+ "type": "toggle"
121
+ },
122
+ {
123
+ "type": "effort",
124
+ "values": [
125
+ "high",
126
+ "max"
127
+ ]
128
+ }
129
+ ],
114
130
  "tool_call": true,
131
+ "interleaved": {
132
+ "field": "reasoning_content"
133
+ },
134
+ "structured_output": true,
115
135
  "temperature": true,
116
- "knowledge": "2025-09",
117
- "release_date": "2025-12-01",
118
- "last_updated": "2026-02-28",
136
+ "release_date": "2026-08-12",
137
+ "last_updated": "2026-08-22",
119
138
  "modalities": {
120
139
  "input": [
121
140
  "text"
@@ -130,30 +149,45 @@
130
149
  "output": 384000
131
150
  },
132
151
  "cost": {
133
- "input": 0.14,
134
- "output": 0.28,
135
- "cache_read": 0.0028
152
+ "input": 0.435,
153
+ "output": 0.87,
154
+ "reasoning": 0.87,
155
+ "cache_read": 0.003625
136
156
  }
137
157
  },
138
- "deepseek-reasoner": {
139
- "id": "deepseek-reasoner",
140
- "name": "DeepSeek Reasoner",
141
- "description": "DeepSeek reasoning model for multi-step analysis, math, coding, and tools",
142
- "family": "deepseek-thinking",
158
+ "deepseek-flash": {
159
+ "id": "deepseek-flash",
160
+ "name": "DeepSeek V4.1 Flash",
161
+ "description": "DeepSeek V4.1 Flash model for reasoning and agentic coding",
162
+ "family": "deepseek-flash",
143
163
  "attachment": true,
144
164
  "reasoning": true,
145
- "reasoning_options": [],
165
+ "reasoning_options": [
166
+ {
167
+ "type": "toggle"
168
+ },
169
+ {
170
+ "type": "effort",
171
+ "values": [
172
+ "low",
173
+ "high",
174
+ "max"
175
+ ]
176
+ }
177
+ ],
146
178
  "tool_call": true,
147
179
  "interleaved": {
148
180
  "field": "reasoning_content"
149
181
  },
182
+ "structured_output": true,
150
183
  "temperature": true,
151
- "knowledge": "2025-09",
152
- "release_date": "2025-12-01",
153
- "last_updated": "2026-02-28",
184
+ "knowledge": "2025-05",
185
+ "release_date": "2026-09-10",
186
+ "last_updated": "2026-09-10",
154
187
  "modalities": {
155
188
  "input": [
156
- "text"
189
+ "text",
190
+ "image"
157
191
  ],
158
192
  "output": [
159
193
  "text"
@@ -165,10 +199,10 @@
165
199
  "output": 384000
166
200
  },
167
201
  "cost": {
168
- "input": 0.14,
169
- "output": 0.28,
170
- "reasoning": 0.28,
171
- "cache_read": 0.0028
202
+ "input": 0.15,
203
+ "output": 0.6,
204
+ "reasoning": 0.6,
205
+ "cache_read": 0.003
172
206
  }
173
207
  }
174
208
  }