llm.rb 13.0.0 → 14.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +505 -14
- data/README.md +484 -50
- data/bin/llm.rb +148 -0
- data/data/anthropic.json +206 -263
- data/data/bedrock.json +2138 -1860
- data/data/deepinfra.json +1003 -624
- data/data/deepseek.json +38 -34
- data/data/google.json +1079 -371
- data/data/mistral.json +448 -368
- data/data/moonshot.json +384 -0
- data/data/openai.json +974 -1343
- data/data/xai.json +154 -126
- data/data/zai.json +191 -191
- data/lib/llm/agent.rb +123 -20
- data/lib/llm/context.rb +71 -88
- data/lib/llm/cost.rb +23 -17
- data/lib/llm/error.rb +0 -8
- data/lib/llm/function/array.rb +3 -3
- data/lib/llm/function/async/task.rb +2 -0
- data/lib/llm/function/fiber/task.rb +2 -0
- data/lib/llm/function/fork/task.rb +2 -0
- data/lib/llm/function/ractor/task.rb +2 -0
- data/lib/llm/function/sequential/group.rb +4 -1
- data/lib/llm/function/sequential/task.rb +1 -1
- data/lib/llm/function/task.rb +4 -0
- data/lib/llm/function/thread/task.rb +2 -0
- data/lib/llm/function.rb +33 -6
- data/lib/llm/guard/loop.rb +89 -0
- data/lib/llm/guard/null.rb +19 -0
- data/lib/llm/guard.rb +61 -0
- data/lib/llm/provider.rb +36 -0
- data/lib/llm/providers/anthropic/stream_parser.rb +1 -0
- data/lib/llm/providers/anthropic.rb +2 -9
- data/lib/llm/providers/bedrock/request_adapter.rb +1 -1
- data/lib/llm/providers/bedrock/stream_parser.rb +1 -0
- data/lib/llm/providers/bedrock.rb +1 -8
- data/lib/llm/providers/google/stream_parser.rb +1 -0
- data/lib/llm/providers/google.rb +1 -8
- data/lib/llm/providers/mistral.rb +1 -1
- data/lib/llm/providers/moonshot.rb +76 -0
- data/lib/llm/providers/ollama.rb +2 -9
- data/lib/llm/providers/openai/responses/stream_parser.rb +1 -0
- data/lib/llm/providers/openai/responses.rb +7 -9
- data/lib/llm/providers/openai/stream_parser.rb +1 -0
- data/lib/llm/providers/openai.rb +4 -11
- data/lib/llm/repl/bar.rb +4 -3
- data/lib/llm/repl/{transcript.rb → buffer.rb} +69 -29
- data/lib/llm/repl/color.rb +78 -0
- data/lib/llm/repl/command.rb +12 -5
- data/lib/llm/repl/commands/compact.rb +2 -2
- data/lib/llm/repl/commands/help.rb +3 -5
- data/lib/llm/repl/input/char.rb +46 -0
- data/lib/llm/repl/input/row.rb +39 -0
- data/lib/llm/repl/input.rb +251 -66
- data/lib/llm/repl/markdown/table.rb +11 -3
- data/lib/llm/repl/markdown.rb +34 -8
- data/lib/llm/repl/node.rb +37 -0
- data/lib/llm/repl/status.rb +42 -7
- data/lib/llm/repl/stream.rb +18 -6
- data/lib/llm/repl/walker.rb +3 -2
- data/lib/llm/repl/window.rb +54 -35
- data/lib/llm/repl.rb +74 -32
- data/lib/llm/skill.rb +20 -4
- data/lib/llm/stream.rb +8 -7
- data/lib/llm/tool.rb +29 -0
- data/lib/llm/tools/{swap_text.rb → edit-file.rb} +3 -3
- data/lib/llm/tools/git.rb +3 -0
- data/lib/llm/tools/mkdir.rb +3 -0
- data/lib/llm/tools/rg.rb +3 -0
- data/lib/llm/tools/ruby.rb +46 -0
- data/lib/llm/tools/shell.rb +3 -0
- data/lib/llm/tracer/pretty_logger.rb +127 -0
- data/lib/llm/tracer.rb +1 -0
- data/lib/llm/transformer/null.rb +21 -0
- data/lib/llm/transformer.rb +55 -0
- data/lib/llm/version.rb +1 -1
- data/lib/llm.rb +12 -2
- data/llm.gemspec +9 -2
- data/resources/deepdive/advanced/cancellation.md +74 -0
- data/resources/deepdive/advanced/compaction.md +83 -0
- data/resources/deepdive/advanced/context.md +267 -0
- data/resources/deepdive/advanced/guard.md +371 -0
- data/resources/deepdive/advanced/tracer.md +180 -0
- data/resources/deepdive/advanced/transformer.md +67 -0
- data/resources/deepdive/advanced/transports.md +45 -0
- data/resources/deepdive/everything_else/audio.md +122 -0
- data/resources/deepdive/everything_else/cost.md +99 -0
- data/resources/deepdive/everything_else/images.md +89 -0
- data/resources/deepdive/everything_else/object.md +108 -0
- data/resources/deepdive/everything_else/ocr.md +48 -0
- data/resources/deepdive/fundamentals/agents.md +202 -0
- data/resources/deepdive/fundamentals/builtin_tools.md +191 -0
- data/resources/deepdive/fundamentals/concurrency.md +104 -0
- data/resources/deepdive/fundamentals/database.md +449 -0
- data/resources/deepdive/fundamentals/embeddings.md +157 -0
- data/resources/deepdive/fundamentals/repl.md +87 -0
- data/resources/deepdive/fundamentals/schema.md +61 -0
- data/resources/deepdive/fundamentals/skills.md +106 -0
- data/resources/deepdive/fundamentals/stream.md +110 -0
- data/resources/deepdive/fundamentals/tools.md +265 -0
- data/resources/deepdive/protocols/a2a.md +106 -0
- data/resources/deepdive/protocols/mcp.md +111 -0
- data/resources/deepdive.md +58 -1792
- metadata +51 -7
- data/lib/llm/loop_guard.rb +0 -107
data/data/xai.json
CHANGED
|
@@ -35,47 +35,29 @@
|
|
|
35
35
|
"output": 0
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"grok-
|
|
39
|
-
"id": "grok-
|
|
40
|
-
"name": "Grok
|
|
41
|
-
"description": "
|
|
42
|
-
"family": "grok",
|
|
43
|
-
"attachment": true,
|
|
44
|
-
"reasoning": false,
|
|
45
|
-
"tool_call": false,
|
|
46
|
-
"temperature": false,
|
|
47
|
-
"release_date": "2026-04-03",
|
|
48
|
-
"last_updated": "2026-04-03",
|
|
49
|
-
"modalities": {
|
|
50
|
-
"input": [
|
|
51
|
-
"text",
|
|
52
|
-
"image",
|
|
53
|
-
"pdf"
|
|
54
|
-
],
|
|
55
|
-
"output": [
|
|
56
|
-
"image",
|
|
57
|
-
"pdf"
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
"open_weights": false,
|
|
61
|
-
"limit": {
|
|
62
|
-
"context": 8000,
|
|
63
|
-
"output": 0
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"grok-4.20-0309-reasoning": {
|
|
67
|
-
"id": "grok-4.20-0309-reasoning",
|
|
68
|
-
"name": "Grok 4.20 (Reasoning)",
|
|
69
|
-
"description": "Reasoning Grok for document-heavy analysis and long-horizon tool use",
|
|
38
|
+
"grok-4.3": {
|
|
39
|
+
"id": "grok-4.3",
|
|
40
|
+
"name": "Grok 4.3",
|
|
41
|
+
"description": "xAI's Grok for chat, coding, agentic tools, and lower hallucination risk",
|
|
70
42
|
"family": "grok",
|
|
71
43
|
"attachment": true,
|
|
72
44
|
"reasoning": true,
|
|
73
|
-
"reasoning_options": [
|
|
45
|
+
"reasoning_options": [
|
|
46
|
+
{
|
|
47
|
+
"type": "effort",
|
|
48
|
+
"values": [
|
|
49
|
+
"none",
|
|
50
|
+
"low",
|
|
51
|
+
"medium",
|
|
52
|
+
"high"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
],
|
|
74
56
|
"tool_call": true,
|
|
75
57
|
"structured_output": true,
|
|
76
58
|
"temperature": true,
|
|
77
|
-
"release_date": "2026-
|
|
78
|
-
"last_updated": "2026-
|
|
59
|
+
"release_date": "2026-04-17",
|
|
60
|
+
"last_updated": "2026-04-17",
|
|
79
61
|
"modalities": {
|
|
80
62
|
"input": [
|
|
81
63
|
"text",
|
|
@@ -113,19 +95,18 @@
|
|
|
113
95
|
}
|
|
114
96
|
}
|
|
115
97
|
},
|
|
116
|
-
"grok-
|
|
117
|
-
"id": "grok-
|
|
118
|
-
"name": "Grok
|
|
119
|
-
"description": "
|
|
120
|
-
"family": "grok
|
|
98
|
+
"grok-4.20-0309-non-reasoning": {
|
|
99
|
+
"id": "grok-4.20-0309-non-reasoning",
|
|
100
|
+
"name": "Grok 4.20 (Non-Reasoning)",
|
|
101
|
+
"description": "Grok model for agentic tool use, reasoning, coding, and live assistance",
|
|
102
|
+
"family": "grok",
|
|
121
103
|
"attachment": true,
|
|
122
|
-
"reasoning":
|
|
123
|
-
"reasoning_options": [],
|
|
104
|
+
"reasoning": false,
|
|
124
105
|
"tool_call": true,
|
|
125
106
|
"structured_output": true,
|
|
126
107
|
"temperature": true,
|
|
127
|
-
"release_date": "2026-
|
|
128
|
-
"last_updated": "2026-
|
|
108
|
+
"release_date": "2026-03-09",
|
|
109
|
+
"last_updated": "2026-03-09",
|
|
129
110
|
"modalities": {
|
|
130
111
|
"input": [
|
|
131
112
|
"text",
|
|
@@ -138,17 +119,17 @@
|
|
|
138
119
|
},
|
|
139
120
|
"open_weights": false,
|
|
140
121
|
"limit": {
|
|
141
|
-
"context":
|
|
142
|
-
"output":
|
|
122
|
+
"context": 1000000,
|
|
123
|
+
"output": 30000
|
|
143
124
|
},
|
|
144
125
|
"cost": {
|
|
145
|
-
"input": 1,
|
|
146
|
-
"output": 2,
|
|
126
|
+
"input": 1.25,
|
|
127
|
+
"output": 2.5,
|
|
147
128
|
"cache_read": 0.2,
|
|
148
129
|
"tiers": [
|
|
149
130
|
{
|
|
150
|
-
"input": 2,
|
|
151
|
-
"output":
|
|
131
|
+
"input": 2.5,
|
|
132
|
+
"output": 5,
|
|
152
133
|
"cache_read": 0.4,
|
|
153
134
|
"tier": {
|
|
154
135
|
"type": "context",
|
|
@@ -157,16 +138,44 @@
|
|
|
157
138
|
}
|
|
158
139
|
],
|
|
159
140
|
"context_over_200k": {
|
|
160
|
-
"input": 2,
|
|
161
|
-
"output":
|
|
141
|
+
"input": 2.5,
|
|
142
|
+
"output": 5,
|
|
162
143
|
"cache_read": 0.4
|
|
163
144
|
}
|
|
164
145
|
}
|
|
165
146
|
},
|
|
166
|
-
"grok-
|
|
167
|
-
"id": "grok-
|
|
168
|
-
"name": "Grok
|
|
169
|
-
"description": "
|
|
147
|
+
"grok-imagine-video-1.5": {
|
|
148
|
+
"id": "grok-imagine-video-1.5",
|
|
149
|
+
"name": "Grok Imagine Video 1.5",
|
|
150
|
+
"description": "Video model for image-to-video generation, editing, and extension workflows",
|
|
151
|
+
"family": "grok",
|
|
152
|
+
"attachment": true,
|
|
153
|
+
"reasoning": false,
|
|
154
|
+
"tool_call": false,
|
|
155
|
+
"temperature": false,
|
|
156
|
+
"release_date": "2026-05-30",
|
|
157
|
+
"last_updated": "2026-05-30",
|
|
158
|
+
"modalities": {
|
|
159
|
+
"input": [
|
|
160
|
+
"text",
|
|
161
|
+
"image",
|
|
162
|
+
"audio",
|
|
163
|
+
"pdf"
|
|
164
|
+
],
|
|
165
|
+
"output": [
|
|
166
|
+
"video"
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
"open_weights": false,
|
|
170
|
+
"limit": {
|
|
171
|
+
"context": 1024,
|
|
172
|
+
"output": 0
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"grok-4.20-multi-agent-0309": {
|
|
176
|
+
"id": "grok-4.20-multi-agent-0309",
|
|
177
|
+
"name": "Grok 4.20 Multi-Agent",
|
|
178
|
+
"description": "Grok model for agentic tool use, reasoning, coding, and live assistance",
|
|
170
179
|
"family": "grok",
|
|
171
180
|
"attachment": true,
|
|
172
181
|
"reasoning": true,
|
|
@@ -174,18 +183,18 @@
|
|
|
174
183
|
{
|
|
175
184
|
"type": "effort",
|
|
176
185
|
"values": [
|
|
177
|
-
"none",
|
|
178
186
|
"low",
|
|
179
187
|
"medium",
|
|
180
|
-
"high"
|
|
188
|
+
"high",
|
|
189
|
+
"xhigh"
|
|
181
190
|
]
|
|
182
191
|
}
|
|
183
192
|
],
|
|
184
|
-
"tool_call":
|
|
193
|
+
"tool_call": false,
|
|
185
194
|
"structured_output": true,
|
|
186
195
|
"temperature": true,
|
|
187
|
-
"release_date": "2026-
|
|
188
|
-
"last_updated": "2026-
|
|
196
|
+
"release_date": "2026-03-09",
|
|
197
|
+
"last_updated": "2026-03-09",
|
|
189
198
|
"modalities": {
|
|
190
199
|
"input": [
|
|
191
200
|
"text",
|
|
@@ -223,18 +232,17 @@
|
|
|
223
232
|
}
|
|
224
233
|
}
|
|
225
234
|
},
|
|
226
|
-
"grok-
|
|
227
|
-
"id": "grok-
|
|
228
|
-
"name": "Grok
|
|
229
|
-
"description": "
|
|
235
|
+
"grok-imagine-image-quality": {
|
|
236
|
+
"id": "grok-imagine-image-quality",
|
|
237
|
+
"name": "Grok Imagine Image Quality",
|
|
238
|
+
"description": "Image model for prompt-driven generation, editing, and visual design workflows",
|
|
230
239
|
"family": "grok",
|
|
231
240
|
"attachment": true,
|
|
232
241
|
"reasoning": false,
|
|
233
|
-
"tool_call":
|
|
234
|
-
"
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"last_updated": "2026-03-09",
|
|
242
|
+
"tool_call": false,
|
|
243
|
+
"temperature": false,
|
|
244
|
+
"release_date": "2026-04-03",
|
|
245
|
+
"last_updated": "2026-04-03",
|
|
238
246
|
"modalities": {
|
|
239
247
|
"input": [
|
|
240
248
|
"text",
|
|
@@ -242,34 +250,14 @@
|
|
|
242
250
|
"pdf"
|
|
243
251
|
],
|
|
244
252
|
"output": [
|
|
245
|
-
"
|
|
253
|
+
"image",
|
|
254
|
+
"pdf"
|
|
246
255
|
]
|
|
247
256
|
},
|
|
248
257
|
"open_weights": false,
|
|
249
258
|
"limit": {
|
|
250
|
-
"context":
|
|
251
|
-
"output":
|
|
252
|
-
},
|
|
253
|
-
"cost": {
|
|
254
|
-
"input": 1.25,
|
|
255
|
-
"output": 2.5,
|
|
256
|
-
"cache_read": 0.2,
|
|
257
|
-
"tiers": [
|
|
258
|
-
{
|
|
259
|
-
"input": 2.5,
|
|
260
|
-
"output": 5,
|
|
261
|
-
"cache_read": 0.4,
|
|
262
|
-
"tier": {
|
|
263
|
-
"type": "context",
|
|
264
|
-
"size": 200000
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
],
|
|
268
|
-
"context_over_200k": {
|
|
269
|
-
"input": 2.5,
|
|
270
|
-
"output": 5,
|
|
271
|
-
"cache_read": 0.4
|
|
272
|
-
}
|
|
259
|
+
"context": 8000,
|
|
260
|
+
"output": 0
|
|
273
261
|
}
|
|
274
262
|
},
|
|
275
263
|
"grok-4.5": {
|
|
@@ -317,7 +305,7 @@
|
|
|
317
305
|
{
|
|
318
306
|
"input": 4,
|
|
319
307
|
"output": 12,
|
|
320
|
-
"cache_read":
|
|
308
|
+
"cache_read": 0.6,
|
|
321
309
|
"tier": {
|
|
322
310
|
"type": "context",
|
|
323
311
|
"size": 200000
|
|
@@ -327,21 +315,23 @@
|
|
|
327
315
|
"context_over_200k": {
|
|
328
316
|
"input": 4,
|
|
329
317
|
"output": 12,
|
|
330
|
-
"cache_read":
|
|
318
|
+
"cache_read": 0.6
|
|
331
319
|
}
|
|
332
320
|
}
|
|
333
321
|
},
|
|
334
|
-
"grok-
|
|
335
|
-
"id": "grok-
|
|
336
|
-
"name": "Grok
|
|
337
|
-
"description": "
|
|
338
|
-
"family": "grok",
|
|
322
|
+
"grok-build-0.1": {
|
|
323
|
+
"id": "grok-build-0.1",
|
|
324
|
+
"name": "Grok Build 0.1",
|
|
325
|
+
"description": "Fast Grok coding model tuned for agentic engineering and iterative edits",
|
|
326
|
+
"family": "grok-build",
|
|
339
327
|
"attachment": true,
|
|
340
|
-
"reasoning":
|
|
341
|
-
"
|
|
342
|
-
"
|
|
343
|
-
"
|
|
344
|
-
"
|
|
328
|
+
"reasoning": true,
|
|
329
|
+
"reasoning_options": [],
|
|
330
|
+
"tool_call": true,
|
|
331
|
+
"structured_output": true,
|
|
332
|
+
"temperature": true,
|
|
333
|
+
"release_date": "2026-04-16",
|
|
334
|
+
"last_updated": "2026-04-16",
|
|
345
335
|
"modalities": {
|
|
346
336
|
"input": [
|
|
347
337
|
"text",
|
|
@@ -349,35 +339,45 @@
|
|
|
349
339
|
"pdf"
|
|
350
340
|
],
|
|
351
341
|
"output": [
|
|
352
|
-
"
|
|
353
|
-
"pdf"
|
|
342
|
+
"text"
|
|
354
343
|
]
|
|
355
344
|
},
|
|
356
345
|
"open_weights": false,
|
|
357
346
|
"limit": {
|
|
358
|
-
"context":
|
|
359
|
-
"output":
|
|
347
|
+
"context": 256000,
|
|
348
|
+
"output": 256000
|
|
349
|
+
},
|
|
350
|
+
"cost": {
|
|
351
|
+
"input": 1,
|
|
352
|
+
"output": 2,
|
|
353
|
+
"cache_read": 0.2,
|
|
354
|
+
"tiers": [
|
|
355
|
+
{
|
|
356
|
+
"input": 2,
|
|
357
|
+
"output": 4,
|
|
358
|
+
"cache_read": 0.4,
|
|
359
|
+
"tier": {
|
|
360
|
+
"type": "context",
|
|
361
|
+
"size": 200000
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
"context_over_200k": {
|
|
366
|
+
"input": 2,
|
|
367
|
+
"output": 4,
|
|
368
|
+
"cache_read": 0.4
|
|
369
|
+
}
|
|
360
370
|
}
|
|
361
371
|
},
|
|
362
|
-
"grok-4.20-
|
|
363
|
-
"id": "grok-4.20-
|
|
364
|
-
"name": "Grok 4.20
|
|
365
|
-
"description": "Grok
|
|
372
|
+
"grok-4.20-0309-reasoning": {
|
|
373
|
+
"id": "grok-4.20-0309-reasoning",
|
|
374
|
+
"name": "Grok 4.20 (Reasoning)",
|
|
375
|
+
"description": "Reasoning Grok for document-heavy analysis and long-horizon tool use",
|
|
366
376
|
"family": "grok",
|
|
367
377
|
"attachment": true,
|
|
368
378
|
"reasoning": true,
|
|
369
|
-
"reasoning_options": [
|
|
370
|
-
|
|
371
|
-
"type": "effort",
|
|
372
|
-
"values": [
|
|
373
|
-
"low",
|
|
374
|
-
"medium",
|
|
375
|
-
"high",
|
|
376
|
-
"xhigh"
|
|
377
|
-
]
|
|
378
|
-
}
|
|
379
|
-
],
|
|
380
|
-
"tool_call": false,
|
|
379
|
+
"reasoning_options": [],
|
|
380
|
+
"tool_call": true,
|
|
381
381
|
"structured_output": true,
|
|
382
382
|
"temperature": true,
|
|
383
383
|
"release_date": "2026-03-09",
|
|
@@ -418,6 +418,34 @@
|
|
|
418
418
|
"cache_read": 0.4
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
+
},
|
|
422
|
+
"grok-imagine-image": {
|
|
423
|
+
"id": "grok-imagine-image",
|
|
424
|
+
"name": "Grok Imagine Image",
|
|
425
|
+
"description": "Image model for prompt-driven generation, editing, and visual design workflows",
|
|
426
|
+
"family": "grok",
|
|
427
|
+
"attachment": true,
|
|
428
|
+
"reasoning": false,
|
|
429
|
+
"tool_call": false,
|
|
430
|
+
"temperature": false,
|
|
431
|
+
"release_date": "2026-01-28",
|
|
432
|
+
"last_updated": "2026-01-28",
|
|
433
|
+
"modalities": {
|
|
434
|
+
"input": [
|
|
435
|
+
"text",
|
|
436
|
+
"image",
|
|
437
|
+
"pdf"
|
|
438
|
+
],
|
|
439
|
+
"output": [
|
|
440
|
+
"image",
|
|
441
|
+
"pdf"
|
|
442
|
+
]
|
|
443
|
+
},
|
|
444
|
+
"open_weights": false,
|
|
445
|
+
"limit": {
|
|
446
|
+
"context": 8000,
|
|
447
|
+
"output": 0
|
|
448
|
+
}
|
|
421
449
|
}
|
|
422
450
|
}
|
|
423
451
|
}
|