llm.rb 12.1.0 → 12.3.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 +248 -0
- data/README.md +77 -27
- data/data/anthropic.json +3 -2
- data/data/bedrock.json +47 -0
- data/data/deepinfra.json +2 -2
- data/data/google.json +32 -0
- data/data/mistral.json +968 -0
- data/data/openai.json +422 -0
- data/data/xai.json +60 -1
- data/lib/llm/active_record/acts_as_agent.rb +11 -0
- data/lib/llm/agent.rb +27 -3
- data/lib/llm/compactor.rb +2 -2
- data/lib/llm/context.rb +18 -26
- data/lib/llm/function.rb +6 -0
- data/lib/llm/object.rb +13 -0
- data/lib/llm/provider.rb +12 -9
- data/lib/llm/providers/anthropic.rb +4 -5
- data/lib/llm/providers/bedrock.rb +4 -5
- data/lib/llm/providers/google.rb +7 -3
- data/lib/llm/providers/mistral/request_adapter/completion.rb +122 -0
- data/lib/llm/providers/mistral/request_adapter.rb +20 -0
- data/lib/llm/providers/mistral.rb +145 -0
- data/lib/llm/providers/ollama/response_adapter/completion.rb +39 -0
- data/lib/llm/providers/ollama.rb +2 -3
- data/lib/llm/providers/openai/responses.rb +6 -3
- data/lib/llm/providers/openai.rb +2 -3
- data/lib/llm/repl/bar.rb +52 -0
- data/lib/llm/repl/input.rb +143 -30
- data/lib/llm/repl/markdown.rb +85 -0
- data/lib/llm/repl/status.rb +16 -5
- data/lib/llm/repl/stream.rb +15 -5
- data/lib/llm/repl/transcript.rb +107 -18
- data/lib/llm/repl/window.rb +43 -17
- data/lib/llm/repl.rb +99 -18
- data/lib/llm/sequel/agent.rb +11 -0
- data/lib/llm/skill.rb +1 -1
- data/lib/llm/stream/disabled.rb +23 -0
- data/lib/llm/stream/io.rb +43 -0
- data/lib/llm/stream.rb +34 -0
- data/lib/llm/tools/git.rb +2 -3
- data/lib/llm/tools/pwd.rb +0 -1
- data/lib/llm/tools/rg.rb +2 -1
- data/lib/llm/tools/swap_text.rb +6 -0
- data/lib/llm/transport/execution.rb +1 -0
- data/lib/llm/version.rb +1 -1
- data/lib/llm.rb +19 -0
- data/llm.gemspec +8 -4
- data/resources/deepdive.md +170 -50
- metadata +15 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae69643ba5cddb3b39899ca27deabd69071c23fb30d787b99630d97b64ef0dcc
|
|
4
|
+
data.tar.gz: cdcb6eee3f60742d2cf37f22518e10eab3b4fe3eabd5d0e0958d5d4116cd63d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8817934bdc50e10ab8387df49d77811a397ef1f4c0a78f3ae7475b26fd2494e4404bc365d746fdba22cb3102f4fb3238b51a8253f9abd7b7882066b098dbe748
|
|
7
|
+
data.tar.gz: 68315c12c2f73c4314e1baf972498bd041952ec8591ebe8b51c6084e70cbf183427314cf04c4025d94dedd85c985c0db1ae5d7ef3473618484a679c11daa68c6
|
data/CHANGELOG.md
CHANGED
|
@@ -15,8 +15,256 @@
|
|
|
15
15
|
|
|
16
16
|
## What's next
|
|
17
17
|
|
|
18
|
+
Changes since `v12.3.0`.
|
|
19
|
+
|
|
20
|
+
## v12.3.0
|
|
21
|
+
|
|
22
|
+
Changes since `v12.2.0`.
|
|
23
|
+
|
|
24
|
+
This release brings major improvements to the curses-based REPL
|
|
25
|
+
(`LLM::Agent#repl`). The status line now shows a context-usage bar and
|
|
26
|
+
running cost counter, the input field expands to three rows with
|
|
27
|
+
full cursor navigation, model responses are rendered as styled markdown,
|
|
28
|
+
and the UI stays responsive while the agent is working by running
|
|
29
|
+
requests in a separate thread. A new `LLM::Stream::IO` and
|
|
30
|
+
`LLM::Stream::Disabled` provide a uniform stream representation across
|
|
31
|
+
all stream types.
|
|
32
|
+
|
|
33
|
+
Mistral OCR support is added for extracting text from images and
|
|
34
|
+
documents via the `/v1/ocr` endpoint. The `skills:` and `tools:` options
|
|
35
|
+
on `LLM::Agent#repl` let you attach additional tools or skill directories
|
|
36
|
+
for the duration of a session. `LLM::Object#merge!` rounds out the
|
|
37
|
+
in-place merge API, and a new `LLM.logger` convenience method creates
|
|
38
|
+
tracer logger instances with less verbosity.
|
|
39
|
+
|
|
40
|
+
### Add
|
|
41
|
+
|
|
42
|
+
* **Add `LLM.logger` convenience method** <br>
|
|
43
|
+
Add `LLM.logger(llm, ...)` as a shorter, less verbose way to create an
|
|
44
|
+
`LLM::Tracer::Logger` instance. Takes a provider and optional keyword
|
|
45
|
+
arguments forwarded to the logger constructor.
|
|
46
|
+
|
|
47
|
+
* **Add `skills:` option to `LLM::Agent#repl`** <br>
|
|
48
|
+
`LLM::Agent#repl` now accepts a `skills:` keyword argument that attaches
|
|
49
|
+
one or more skill directories (containing `SKILL.md`) for the duration of
|
|
50
|
+
the repl session. Skills are loaded and converted to tools, combining with
|
|
51
|
+
any tools already configured on the agent, and are discarded when the
|
|
52
|
+
session ends.
|
|
53
|
+
|
|
54
|
+
* **Add `LLM::Provider#ocr` base method** <br>
|
|
55
|
+
Add a base `ocr(...)` method to `LLM::Provider` that raises `NotImplementedError`
|
|
56
|
+
by default, establishing a common interface for providers that support OCR
|
|
57
|
+
(Optical Character Recognition) on images and documents.
|
|
58
|
+
|
|
59
|
+
* **Add Mistral OCR endpoint support** <br>
|
|
60
|
+
The Mistral provider now supports OCR via its `/v1/ocr` endpoint. Call
|
|
61
|
+
`mistral.ocr(image_url: ...)` for images or `mistral.ocr(document_url: ...)`
|
|
62
|
+
for documents (e.g., PDFs). Returns an `LLM::Response` with extracted pages,
|
|
63
|
+
markdown content, and structured block data.
|
|
64
|
+
|
|
65
|
+
* **Add `LLM::Object#merge!`** <br>
|
|
66
|
+
Add `LLM::Object#merge!` for in-place merging of hash data into an
|
|
67
|
+
`LLM::Object` instance, complementing the existing `#merge` method.
|
|
68
|
+
|
|
69
|
+
* **Add `LLM::Stream::IO` and `LLM::Stream::Disabled`** <br>
|
|
70
|
+
`LLM::Stream::IO` wraps IO-like objects as stream targets, forwarding
|
|
71
|
+
streamed content via `#<<`. `LLM::Stream::Disabled` represents an explicitly
|
|
72
|
+
disabled stream with no-op callbacks.
|
|
73
|
+
|
|
74
|
+
This is part of an internal refactoring that lets all stream values — IO
|
|
75
|
+
objects, `true`, `false`, `nil`, and `LLM::Stream` instances themselves —
|
|
76
|
+
be represented by the same `LLM::Stream` interface via the new
|
|
77
|
+
`LLM::Stream.try` factory method.
|
|
78
|
+
|
|
79
|
+
Before this change the codebase had to perform ad-hoc type checks
|
|
80
|
+
(e.g. `if LLM::Stream === stream`) scattered throughout. After this
|
|
81
|
+
change all stream handling goes through a single uniform path, and
|
|
82
|
+
providers check `#enabled?` to decide whether to request streaming
|
|
83
|
+
from the API.
|
|
84
|
+
|
|
85
|
+
### Change
|
|
86
|
+
|
|
87
|
+
* **repl: rename `trace:` to `tracer:`** <br>
|
|
88
|
+
The `trace:` keyword argument in `LLM::Agent#repl` has been renamed to
|
|
89
|
+
`tracer:` for consistency with the rest of the codebase. The old `trace:`
|
|
90
|
+
name still works with a deprecation warning.
|
|
91
|
+
|
|
92
|
+
* **repl: add context-usage bar and cost counter to the status line** <br>
|
|
93
|
+
The curses-based REPL status line now shows a small progress bar that
|
|
94
|
+
indicates how much of the model's context window remains as a percentage,
|
|
95
|
+
alongside a running cost estimate rendered on the right side of the status
|
|
96
|
+
line. The input line has been updated to show the provider name as a prefix.
|
|
97
|
+
Estimates are best-effort and depend on registry pricing data (see `data/`).
|
|
98
|
+
|
|
99
|
+
* **repl: keep the UI responsive while a request is in progress** <br>
|
|
100
|
+
The curses-based REPL now spawns the agent request in a separate thread
|
|
101
|
+
and communicates streamed output through a queue, so the curses UI stays
|
|
102
|
+
responsive during model processing. Users can continue to scroll through
|
|
103
|
+
the transcript while the agent is working.
|
|
104
|
+
|
|
105
|
+
* **repl: style transcript rows as structured data with bold labels** <br>
|
|
106
|
+
The curses-based REPL transcript now stores rows as structured data with
|
|
107
|
+
style metadata instead of plain strings, enabling bold rendering of the
|
|
108
|
+
`user:` and `agent:` labels for improved readability during interactive
|
|
109
|
+
sessions.
|
|
110
|
+
|
|
111
|
+
* **repl: render a small subset of markdown** <br>
|
|
112
|
+
The curses-based REPL now renders model responses as styled markdown.
|
|
113
|
+
Headers and strong text render in bold, emphasis renders in underline,
|
|
114
|
+
and code spans and blocks are highlighted with inverted colors. Streaming
|
|
115
|
+
content is buffered and re-rendered on each tick so the transcript reads
|
|
116
|
+
cleanly as the agent responds. Requires the optional `kramdown` gem.
|
|
117
|
+
|
|
118
|
+
* **repl: add cursor LEFT/RIGHT movement to the input line** <br>
|
|
119
|
+
The curses-based REPL input now supports cursor movement with the left
|
|
120
|
+
and right arrow keys, enabling in-place text editing before submitting
|
|
121
|
+
a prompt. The cursor position is tracked visually and moves backwards
|
|
122
|
+
on left-arrow and forwards on right-arrow.
|
|
123
|
+
|
|
124
|
+
* **repl: add Ctrl+A and Ctrl+E keybindings to the input line** <br>
|
|
125
|
+
The curses-based REPL input now supports Ctrl+A to jump the cursor to
|
|
126
|
+
the start of the input line and Ctrl+E to jump it to the end, matching
|
|
127
|
+
common terminal editing conventions.
|
|
128
|
+
|
|
129
|
+
* **repl: add `tools:` option to `LLM::Agent#repl`** <br>
|
|
130
|
+
`LLM::Agent#repl` now accepts a `tools:` keyword argument that attaches
|
|
131
|
+
additional tool classes or instances for the duration of the repl session.
|
|
132
|
+
These tools are combined with any tools already configured on the agent,
|
|
133
|
+
and are discarded when the session ends.
|
|
134
|
+
|
|
135
|
+
* **repl: add repl support to ActiveRecord and Sequel agent models** <br>
|
|
136
|
+
`acts_as_agent` (ActiveRecord) and `plugin :agent` (Sequel) models now
|
|
137
|
+
expose a `repl` method that delegates to the underlying agent's
|
|
138
|
+
read-eval-print loop. This allows interactive debugging and inspection
|
|
139
|
+
of persisted agent state at runtime. Note that changes made during a
|
|
140
|
+
repl session do not persist back to the database.
|
|
141
|
+
|
|
142
|
+
* **repl: add extra padding between markdown nodes** <br>
|
|
143
|
+
The curses-based REPL markdown renderer now adds extra vertical spacing
|
|
144
|
+
between certain markdown elements — paragraphs, headers, and codeblocks —
|
|
145
|
+
for improved readability of model responses.
|
|
146
|
+
|
|
147
|
+
* **repl: add a visual divider between transcript and the rows below it** <br>
|
|
148
|
+
The curses-based REPL now draws a horizontal divider line (using a unicode
|
|
149
|
+
`─` character) to separate the transcript area from the status and input
|
|
150
|
+
rows below it. A single empty buffer row is also added between the
|
|
151
|
+
transcript and the divider, preventing transcript text from running too
|
|
152
|
+
close to the status and input rows.
|
|
153
|
+
|
|
154
|
+
* **repl: expand input field to 3 rows** <br>
|
|
155
|
+
The curses-based REPL input field now spans three rows instead of one,
|
|
156
|
+
wrapping text that exceeds the terminal width onto subsequent lines. A
|
|
157
|
+
scrollable viewport follows the cursor so the active line stays visible,
|
|
158
|
+
and common navigation commands (Ctrl+A, Ctrl+E, cursor keys) work across
|
|
159
|
+
all three rows of the expanded input area.
|
|
160
|
+
|
|
161
|
+
* **Refresh OpenAI model metadata** <br>
|
|
162
|
+
Add new OpenAI models to the registry, including `gpt-5.6`,
|
|
163
|
+
`gpt-5.6-luna`, `gpt-5.6-terra`, `gpt-5.6-sol`, and
|
|
164
|
+
`gpt-realtime-2.1`, with associated pricing, capabilities, and
|
|
165
|
+
limits.
|
|
166
|
+
|
|
167
|
+
### Fix
|
|
168
|
+
|
|
169
|
+
* **Fix Ollama non-streaming response handling** <br>
|
|
170
|
+
Fix the Ollama provider to properly handle the non-streaming path. When
|
|
171
|
+
the provider returns a raw NDJSON response body (instead of streaming),
|
|
172
|
+
the response is now parsed and merged into a single `LLM::Object` before
|
|
173
|
+
being returned to the caller. Previously the non-streaming path was
|
|
174
|
+
effectively broken and would fail to produce a valid completion response.
|
|
175
|
+
|
|
176
|
+
* **repl: handle a negative context window allowance in the usage bar** <br>
|
|
177
|
+
Fix a crash in the curses-based REPL context-usage bar when the context
|
|
178
|
+
window allowance is exceeded (used > total). The negative width value that
|
|
179
|
+
resulted from this edge case could cause curses errors; it now gracefully
|
|
180
|
+
defaults to `0%` and zero bar width.
|
|
181
|
+
|
|
182
|
+
* **Fix YARD documentation across provider and tool files** <br>
|
|
183
|
+
Fix unnamed, misnamed, and missing `@param` tags in `LLM::Repl::Status`,
|
|
184
|
+
`LLM::Tool::Git`, `LLM::Tool::Pwd`, `LLM::Tool::Rg`, and
|
|
185
|
+
`LLM::Tool::SwapText`.
|
|
186
|
+
|
|
187
|
+
## v12.2.0
|
|
188
|
+
|
|
18
189
|
Changes since `v12.1.0`.
|
|
19
190
|
|
|
191
|
+
This release adds Mistral as a new provider with chat completions, streaming, tool calls,
|
|
192
|
+
structured outputs, file/image attachments, and embeddings support. It introduces
|
|
193
|
+
the `trace:` option to `LLM::Agent#repl` for keeping the tracer active during
|
|
194
|
+
interactive sessions.
|
|
195
|
+
|
|
196
|
+
Several fixes land for the Google provider (generationConfig parameter leakage),
|
|
197
|
+
`LLM::Context#tracer=` (always assigning nil), `LLM::Provider#with_tracer(nil)`
|
|
198
|
+
(nil fallback), and `LLM::Context#repair!` (dropping Struct returns).
|
|
199
|
+
|
|
200
|
+
The default HTTP timeout has been increased from 60s to 180s to better accommodate
|
|
201
|
+
reasoning models and large structured outputs, and the Anthropic default model has
|
|
202
|
+
been updated to `claude-opus-4-8`. Model metadata has been refreshed across
|
|
203
|
+
Anthropic, AWS Bedrock, DeepInfra, Google, and xAI, with Mistral model data added
|
|
204
|
+
to the registry.
|
|
205
|
+
|
|
206
|
+
### Add
|
|
207
|
+
|
|
208
|
+
* **Add `trace:` option to `LLM::Agent#repl`** <br>
|
|
209
|
+
`LLM::Agent#repl` now accepts a `trace:` keyword argument. By default
|
|
210
|
+
the tracer is disabled for the duration of the repl session to prevent
|
|
211
|
+
curses UI interference from output written to `$stdout` or `$stderr`.
|
|
212
|
+
Set `trace: true` to keep the tracer active during the session, which
|
|
213
|
+
is useful when the tracer writes to a file rather than the terminal.
|
|
214
|
+
|
|
215
|
+
* **Add a new provider: LLM::Mistral** <br>
|
|
216
|
+
[Mistral](https://mistral.ai) is now supported through its
|
|
217
|
+
OpenAI-compatible API. The provider supports chat completions,
|
|
218
|
+
streaming, tool calls, structured output (schema), file/image
|
|
219
|
+
attachments, and embeddings. Use `LLM.mistral(...)` to create a
|
|
220
|
+
provider instance.
|
|
221
|
+
|
|
222
|
+
* **Add `LLM.mistral(...)` convenience method** <br>
|
|
223
|
+
A new top-level accessor (`LLM.mistral`) returns an `LLM::Mistral`
|
|
224
|
+
provider instance, matching the pattern used by other providers.
|
|
225
|
+
|
|
226
|
+
### Fix
|
|
227
|
+
|
|
228
|
+
* **Fix Google `generationConfig` parameter leakage** <br>
|
|
229
|
+
Fix a bug in the Google provider where non-generation parameters
|
|
230
|
+
(`role`, `model`, `messages`, `stream`) were leaking into the
|
|
231
|
+
`generationConfig` object alongside legitimate generation config
|
|
232
|
+
parameters such as `temperature`. Non-config parameters are now
|
|
233
|
+
filtered out before constructing `generationConfig`.
|
|
234
|
+
|
|
235
|
+
* **Fix `LLM::Context#tracer=` always assigning `nil`** <br>
|
|
236
|
+
The `LLM::Context#tracer=` setter had a bug where it always assigned
|
|
237
|
+
`nil` regardless of the tracer value passed. It now correctly assigns
|
|
238
|
+
the given tracer or falls back to `LLM::Tracer::Null`.
|
|
239
|
+
|
|
240
|
+
* **Fix `LLM::Provider#with_tracer(nil)` fallback** <br>
|
|
241
|
+
`LLM::Provider#with_tracer(nil)` now falls back to
|
|
242
|
+
`LLM::Tracer::Null` instead of setting a `nil` tracer directly.
|
|
243
|
+
|
|
244
|
+
* **Fix `LLM::Context#repair!` dropping `Struct` returns** <br>
|
|
245
|
+
`LLM::Context#repair!` used `[*prompt]` to wrap the prompt before
|
|
246
|
+
grepping for return objects. Since `LLM::Function::Return` is a
|
|
247
|
+
`Struct`, the splat operator expanded it into its member values
|
|
248
|
+
instead of wrapping it, causing the grep to silently drop returns.
|
|
249
|
+
The fix wraps both sources in an array before flattening.
|
|
250
|
+
|
|
251
|
+
### Change
|
|
252
|
+
|
|
253
|
+
* **Increase default provider timeout from 60s to 180s** <br>
|
|
254
|
+
The default HTTP timeout for all providers has been increased from
|
|
255
|
+
60 to 180 seconds to better accommodate long-running requests such
|
|
256
|
+
as reasoning models and large structured outputs.
|
|
257
|
+
|
|
258
|
+
* **Change Anthropic default model to `claude-opus-4-8`** <br>
|
|
259
|
+
The default Anthropic chat model has been updated from
|
|
260
|
+
`claude-sonnet-4-20250514` to `claude-opus-4-8`, reflecting the
|
|
261
|
+
latest model release from Anthropic.
|
|
262
|
+
|
|
263
|
+
* **Refresh model metadata** <br>
|
|
264
|
+
Update model listings, pricing, and capabilities for Anthropic,
|
|
265
|
+
AWS Bedrock, DeepInfra, Google, and xAI. Add Mistral model data
|
|
266
|
+
to the registry.
|
|
267
|
+
|
|
20
268
|
## v12.1.0
|
|
21
269
|
|
|
22
270
|
Changes since `v12.0.0`.
|
data/README.md
CHANGED
|
@@ -14,16 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
Welcome to the canonical llm.rb repository.
|
|
16
16
|
|
|
17
|
-
llm.rb is
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
that are opt-in.
|
|
17
|
+
llm.rb is an advanced runtime for building capable AI applications
|
|
18
|
+
on CRuby. By default it has zero runtime dependencies although certain
|
|
19
|
+
functionality – such as ActiveRecord support – require
|
|
20
|
+
optional dependencies that are opt-in.
|
|
22
21
|
|
|
23
22
|
## Features
|
|
24
23
|
|
|
25
24
|
The runtime supports OpenAI, OpenAI-compatible endpoints, Anthropic, Google
|
|
26
|
-
Gemini, DeepSeek, DeepInfra, xAI, Z.ai, AWS Bedrock, Ollama, and llama.cpp.
|
|
25
|
+
Gemini, Mistral, DeepSeek, DeepInfra, xAI, Z.ai, AWS Bedrock, Ollama, and llama.cpp.
|
|
27
26
|
It has first-class support for streaming, tool calls, MCP
|
|
28
27
|
and A2A, embeddings, vector stores and the RAG pattern.
|
|
29
28
|
|
|
@@ -121,13 +120,14 @@ agent.talk "Explain Ruby fibers."
|
|
|
121
120
|
|
|
122
121
|
The [LLM::Agent#repl](https://r.uby.dev/api-docs/llm.rb/LLM/Agent.html#repl-instance_method)
|
|
123
122
|
method allows an agent to spawn a read-eval-print loop
|
|
124
|
-
that can be useful
|
|
125
|
-
|
|
126
|
-
agent has done what was expected, or improve
|
|
127
|
-
|
|
123
|
+
that can be useful while developing or operating agents.
|
|
124
|
+
It can be used to debug tool calls, confirm an
|
|
125
|
+
agent has done what was expected, or improve an agent by
|
|
126
|
+
asking questions about what it has done up to that point.
|
|
128
127
|
|
|
129
128
|
This feature requires that the [curses](https://github.com/ruby/curses)
|
|
130
|
-
|
|
129
|
+
and [kramdown](https://github.com/gettalong/kramdown) libraries are
|
|
130
|
+
installed and available to require.
|
|
131
131
|
|
|
132
132
|
```ruby
|
|
133
133
|
llm = LLM.deepseek(key: ENV["KEY"])
|
|
@@ -135,6 +135,47 @@ agent = LLM::Agent.new(llm)
|
|
|
135
135
|
agent.repl
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
The read-eval-print loop accepts both `tools` and `skills`
|
|
139
|
+
options that lets you attach additional tools or skills
|
|
140
|
+
for the duration of the session. This is in addition to
|
|
141
|
+
any tools or skills that might already be associated with
|
|
142
|
+
an agent.
|
|
143
|
+
|
|
144
|
+
```ruby
|
|
145
|
+
llm = LLM.deepseek(key: ENV["KEY"])
|
|
146
|
+
agent = LLM::Agent.new(llm)
|
|
147
|
+
agent.repl(tools: [Debugger], skills: [__dir__])
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
A number of optional tools are distributed as part
|
|
151
|
+
of llm.rb. They power the agents that can be found in
|
|
152
|
+
the [agents/](agents/) directory, so they're optimized
|
|
153
|
+
for developer tasks.
|
|
154
|
+
|
|
155
|
+
The following example starts a read-eval-print loop
|
|
156
|
+
with all of the builtin tools available.
|
|
157
|
+
|
|
158
|
+
```ruby
|
|
159
|
+
require "llm"
|
|
160
|
+
require "lll/tools"
|
|
161
|
+
|
|
162
|
+
llm = LLM.deepseek(key: ENV["KEY"])
|
|
163
|
+
agent = LLM::Agent.new(llm)
|
|
164
|
+
agent.repl(tools: LLM::Tool.subclasses)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
By default the tracer is disabled for the duration of
|
|
168
|
+
the session. This can be configured through the
|
|
169
|
+
`tracer` option. Setting it to `true` will configure
|
|
170
|
+
the REPL to use the tracer associated with an instance
|
|
171
|
+
of [`LLM::Agent`](https://r.uby.dev/api-docs/llm.rb/LLM/Agent.html).
|
|
172
|
+
|
|
173
|
+
```ruby
|
|
174
|
+
llm = LLM.deepseek(key: ENV["KEY"])
|
|
175
|
+
agent = LLM::Agent.new(llm, tracer: LLM.logger(llm, path: "agent.log"))
|
|
176
|
+
agent.repl(tracer: true, tools: [Debugger])
|
|
177
|
+
```
|
|
178
|
+
|
|
138
179
|
#### LLM::MCP
|
|
139
180
|
|
|
140
181
|
The Model Context Protocol (MCP) has first-class support
|
|
@@ -265,28 +306,37 @@ agent.talk "perform research"
|
|
|
265
306
|
<summary>What providers does llm.rb support?</summary>
|
|
266
307
|
<br>
|
|
267
308
|
<p>
|
|
268
|
-
China-based
|
|
269
309
|
|
|
270
|
-
|
|
271
|
-
|
|
310
|
+
**Cloud**
|
|
311
|
+
|
|
312
|
+
The following cloud-based providers are available to choose from. <br>
|
|
313
|
+
In no particular order:
|
|
314
|
+
|
|
315
|
+
🇺🇸 OpenAI <br>
|
|
316
|
+
🇺🇸 DeepInfra <br>
|
|
317
|
+
🇺🇸 xAI <br>
|
|
318
|
+
🇺🇸 Google (Gemini) <br>
|
|
319
|
+
🇺🇸 AWS bedrock <br>
|
|
320
|
+
🇺🇸 Anthropic <br>
|
|
321
|
+
🇨🇳 DeepSeek <br>
|
|
322
|
+
🇨🇳 zAI <br>
|
|
323
|
+
🇪🇺 Mistral <br>
|
|
272
324
|
|
|
273
|
-
|
|
325
|
+
**Weights**
|
|
274
326
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
* xAI
|
|
278
|
-
* AWS bedrock
|
|
279
|
-
* DeepInfra
|
|
280
|
-
* Anthropic
|
|
327
|
+
The following providers provide access to open-weight models. <br>
|
|
328
|
+
In no particular order:
|
|
281
329
|
|
|
282
|
-
|
|
330
|
+
🇺🇸 DeepInfra <br>
|
|
331
|
+
🇺🇸 AWS bedrock <br>
|
|
332
|
+
🇨🇳 DeepSeek <br>
|
|
333
|
+
🇨🇳 zAI <br>
|
|
334
|
+
🇪🇺 Mistral <br>
|
|
283
335
|
|
|
284
|
-
|
|
285
|
-
* zAI
|
|
286
|
-
* DeepInfra
|
|
287
|
-
* AWS bedrock
|
|
336
|
+
**Local**
|
|
288
337
|
|
|
289
|
-
|
|
338
|
+
The following providers can be run locally on your own hardware. <br>
|
|
339
|
+
In no particular order:
|
|
290
340
|
|
|
291
341
|
* Ollama
|
|
292
342
|
* Llamacpp
|
data/data/anthropic.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"tool_call": true,
|
|
32
32
|
"structured_output": true,
|
|
33
33
|
"temperature": true,
|
|
34
|
-
"knowledge": "2025-
|
|
34
|
+
"knowledge": "2025-05",
|
|
35
35
|
"release_date": "2025-11-24",
|
|
36
36
|
"last_updated": "2025-11-24",
|
|
37
37
|
"modalities": {
|
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
"tool_call": true,
|
|
322
322
|
"structured_output": true,
|
|
323
323
|
"temperature": true,
|
|
324
|
-
"knowledge": "2025-
|
|
324
|
+
"knowledge": "2025-05",
|
|
325
325
|
"release_date": "2025-11-24",
|
|
326
326
|
"last_updated": "2025-11-01",
|
|
327
327
|
"modalities": {
|
|
@@ -368,6 +368,7 @@
|
|
|
368
368
|
"tool_call": true,
|
|
369
369
|
"structured_output": true,
|
|
370
370
|
"temperature": false,
|
|
371
|
+
"knowledge": "2026-01",
|
|
371
372
|
"release_date": "2026-05-28",
|
|
372
373
|
"last_updated": "2026-05-28",
|
|
373
374
|
"modalities": {
|
data/data/bedrock.json
CHANGED
|
@@ -92,6 +92,47 @@
|
|
|
92
92
|
"cache_write": 3.75
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
|
+
"jp.anthropic.claude-haiku-4-5-20251001-v1:0": {
|
|
96
|
+
"id": "jp.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
97
|
+
"name": "Claude Haiku 4.5 (JP)",
|
|
98
|
+
"description": "Fast Claude model for responsive assistance, classification, and lightweight agents",
|
|
99
|
+
"family": "claude-haiku",
|
|
100
|
+
"attachment": true,
|
|
101
|
+
"reasoning": true,
|
|
102
|
+
"reasoning_options": [
|
|
103
|
+
{
|
|
104
|
+
"type": "budget_tokens",
|
|
105
|
+
"min": 1024
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"tool_call": true,
|
|
109
|
+
"structured_output": true,
|
|
110
|
+
"temperature": true,
|
|
111
|
+
"knowledge": "2025-02-28",
|
|
112
|
+
"release_date": "2025-10-15",
|
|
113
|
+
"last_updated": "2025-10-15",
|
|
114
|
+
"modalities": {
|
|
115
|
+
"input": [
|
|
116
|
+
"text",
|
|
117
|
+
"image",
|
|
118
|
+
"pdf"
|
|
119
|
+
],
|
|
120
|
+
"output": [
|
|
121
|
+
"text"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"open_weights": false,
|
|
125
|
+
"limit": {
|
|
126
|
+
"context": 200000,
|
|
127
|
+
"output": 64000
|
|
128
|
+
},
|
|
129
|
+
"cost": {
|
|
130
|
+
"input": 1,
|
|
131
|
+
"output": 5,
|
|
132
|
+
"cache_read": 0.1,
|
|
133
|
+
"cache_write": 1.25
|
|
134
|
+
}
|
|
135
|
+
},
|
|
95
136
|
"us.meta.llama4-scout-17b-instruct-v1:0": {
|
|
96
137
|
"id": "us.meta.llama4-scout-17b-instruct-v1:0",
|
|
97
138
|
"name": "Llama 4 Scout 17B Instruct (US)",
|
|
@@ -1349,6 +1390,7 @@
|
|
|
1349
1390
|
],
|
|
1350
1391
|
"tool_call": true,
|
|
1351
1392
|
"temperature": false,
|
|
1393
|
+
"knowledge": "2026-01",
|
|
1352
1394
|
"release_date": "2026-05-28",
|
|
1353
1395
|
"last_updated": "2026-05-28",
|
|
1354
1396
|
"modalities": {
|
|
@@ -2328,6 +2370,7 @@
|
|
|
2328
2370
|
],
|
|
2329
2371
|
"tool_call": true,
|
|
2330
2372
|
"temperature": false,
|
|
2373
|
+
"knowledge": "2026-01",
|
|
2331
2374
|
"release_date": "2026-05-28",
|
|
2332
2375
|
"last_updated": "2026-05-28",
|
|
2333
2376
|
"modalities": {
|
|
@@ -2835,6 +2878,7 @@
|
|
|
2835
2878
|
],
|
|
2836
2879
|
"tool_call": true,
|
|
2837
2880
|
"temperature": false,
|
|
2881
|
+
"knowledge": "2026-01",
|
|
2838
2882
|
"release_date": "2026-05-28",
|
|
2839
2883
|
"last_updated": "2026-05-28",
|
|
2840
2884
|
"modalities": {
|
|
@@ -3136,6 +3180,7 @@
|
|
|
3136
3180
|
],
|
|
3137
3181
|
"tool_call": true,
|
|
3138
3182
|
"temperature": false,
|
|
3183
|
+
"knowledge": "2026-01",
|
|
3139
3184
|
"release_date": "2026-05-28",
|
|
3140
3185
|
"last_updated": "2026-05-28",
|
|
3141
3186
|
"modalities": {
|
|
@@ -3181,6 +3226,7 @@
|
|
|
3181
3226
|
],
|
|
3182
3227
|
"tool_call": true,
|
|
3183
3228
|
"temperature": false,
|
|
3229
|
+
"knowledge": "2026-01",
|
|
3184
3230
|
"release_date": "2026-05-28",
|
|
3185
3231
|
"last_updated": "2026-05-28",
|
|
3186
3232
|
"modalities": {
|
|
@@ -3518,6 +3564,7 @@
|
|
|
3518
3564
|
],
|
|
3519
3565
|
"tool_call": true,
|
|
3520
3566
|
"temperature": false,
|
|
3567
|
+
"knowledge": "2026-01",
|
|
3521
3568
|
"release_date": "2026-05-28",
|
|
3522
3569
|
"last_updated": "2026-05-28",
|
|
3523
3570
|
"modalities": {
|
data/data/deepinfra.json
CHANGED
|
@@ -557,7 +557,7 @@
|
|
|
557
557
|
},
|
|
558
558
|
"open_weights": true,
|
|
559
559
|
"limit": {
|
|
560
|
-
"context":
|
|
560
|
+
"context": 262144,
|
|
561
561
|
"output": 65536
|
|
562
562
|
},
|
|
563
563
|
"cost": {
|
|
@@ -767,7 +767,7 @@
|
|
|
767
767
|
"output": 16384
|
|
768
768
|
},
|
|
769
769
|
"cost": {
|
|
770
|
-
"input": 0.
|
|
770
|
+
"input": 0.037,
|
|
771
771
|
"output": 0.17
|
|
772
772
|
}
|
|
773
773
|
},
|
data/data/google.json
CHANGED
|
@@ -562,6 +562,38 @@
|
|
|
562
562
|
"input_audio": 0.3
|
|
563
563
|
}
|
|
564
564
|
},
|
|
565
|
+
"gemini-omni-flash-preview": {
|
|
566
|
+
"id": "gemini-omni-flash-preview",
|
|
567
|
+
"name": "Gemini Omni Flash Preview",
|
|
568
|
+
"description": "Video generation and editing model for fast, conversational text- and image-to-video workflows",
|
|
569
|
+
"family": "gemini",
|
|
570
|
+
"attachment": true,
|
|
571
|
+
"reasoning": true,
|
|
572
|
+
"reasoning_options": [],
|
|
573
|
+
"tool_call": false,
|
|
574
|
+
"temperature": true,
|
|
575
|
+
"release_date": "2026-06-30",
|
|
576
|
+
"last_updated": "2026-06-30",
|
|
577
|
+
"modalities": {
|
|
578
|
+
"input": [
|
|
579
|
+
"text",
|
|
580
|
+
"image",
|
|
581
|
+
"video"
|
|
582
|
+
],
|
|
583
|
+
"output": [
|
|
584
|
+
"video"
|
|
585
|
+
]
|
|
586
|
+
},
|
|
587
|
+
"open_weights": false,
|
|
588
|
+
"limit": {
|
|
589
|
+
"context": 131072,
|
|
590
|
+
"output": 65536
|
|
591
|
+
},
|
|
592
|
+
"cost": {
|
|
593
|
+
"input": 1.5,
|
|
594
|
+
"output": 17.5
|
|
595
|
+
}
|
|
596
|
+
},
|
|
565
597
|
"gemini-3.1-flash-image-preview": {
|
|
566
598
|
"id": "gemini-3.1-flash-image-preview",
|
|
567
599
|
"name": "Nano Banana 2",
|