llm.rb 15.5.0 → 16.0.0.pre.1
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 +79 -1
- data/README.md +15 -29
- data/data/alibaba.json +1099 -933
- data/data/anthropic.json +277 -277
- data/data/bedrock.json +3902 -3758
- data/data/deepinfra.json +1409 -1290
- data/data/deepseek.json +7 -7
- data/data/google.json +703 -703
- data/data/mistral.json +484 -484
- data/data/moonshot.json +49 -49
- data/data/openai.json +1257 -1142
- data/data/openrouter.json +8215 -8302
- data/data/xai.json +198 -198
- data/data/zai.json +256 -256
- data/lib/llm/console/input.rb +15 -5
- data/lib/llm/function/fork/job.rb +31 -8
- data/lib/llm/function/ractor/job.rb +59 -20
- data/lib/llm/function/ractor/mailbox.rb +39 -3
- data/lib/llm/function/ractor/task.rb +26 -9
- data/lib/llm/function/window.rb +77 -0
- data/lib/llm/function.rb +1 -0
- data/lib/llm/providers/deepseek/request_adapter/completion.rb +43 -2
- data/lib/llm/tools/exec.rb +2 -0
- data/lib/llm/version.rb +1 -1
- data/llm.gemspec +3 -3
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89404c839d44cd5a11c59fdd56d396a64f50447996a03c01216eb928aed4c28a
|
|
4
|
+
data.tar.gz: f040e94e577c068690b7bae08900468408d1dd0985bd6d40ebc239eab60ea4a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c466492b003222fd3411b2777aa982663e50330600a2b69c1bd7d2fce9180576ccfc59230140fb392d584a1dddf45307c09fc785b7c7fc06d158aa3ec11230c7
|
|
7
|
+
data.tar.gz: 2da69855287105e2926045fdef7ef346be4fc4189f5e8659eb03829e85ae136a4fc5660506dee14ef7c933775e6790bacda9acedf1e4d4c438b61fc4730a584c
|
data/CHANGELOG.md
CHANGED
|
@@ -15,7 +15,85 @@
|
|
|
15
15
|
|
|
16
16
|
## What's next
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### Breaking
|
|
19
|
+
|
|
20
|
+
#### Migration
|
|
21
|
+
|
|
22
|
+
| Old | New |
|
|
23
|
+
|-----|-----|
|
|
24
|
+
| Ruby 3.3 or later | Ruby 3.4 or later |
|
|
25
|
+
|
|
26
|
+
* **drop Ruby 3.3 support** <br>
|
|
27
|
+
The gem now requires Ruby 3.4 or later: `required_ruby_version` is
|
|
28
|
+
`>= 3.4.0`, the CI matrix runs 3.4 and 4.0, and RuboCop targets 3.4.
|
|
29
|
+
Ruby 3.3 cannot hold an interrupt for a ractor-backed tool call, so a
|
|
30
|
+
cancel that arrives before the tool starts is not delivered there, while
|
|
31
|
+
Ruby 3.4 and 4.0 both deliver it.
|
|
32
|
+
|
|
33
|
+
### Console
|
|
34
|
+
|
|
35
|
+
* **console: erase with the backspace key on OpenBSD** <br>
|
|
36
|
+
The console now erases a character for every code a backspace key sends. A
|
|
37
|
+
terminal that follows the Linux convention sends DEL (127), the OpenBSD
|
|
38
|
+
console sends ^H (8), and curses sends its own `KEY_BACKSPACE` when the
|
|
39
|
+
terminal's terminfo describes the key. All three erase. Before this only 127
|
|
40
|
+
did, so the backspace key did nothing on the OpenBSD console.
|
|
41
|
+
|
|
42
|
+
### Function
|
|
43
|
+
|
|
44
|
+
* **function: deliver an interrupt to the tool, not to whatever is running** <br>
|
|
45
|
+
[`LLM::Function::Window`](https://r.uby.dev/api-docs/llm.rb/LLM/Function/Window.html)
|
|
46
|
+
is the stretch of a call that an interrupt belongs to. The `:fork` and
|
|
47
|
+
`:ractor` strategies now raise `LLM::Interrupt` on the thread that runs
|
|
48
|
+
the tool, and only while the tool runs: a cancel that arrives before the
|
|
49
|
+
tool starts is held until it does, so the tool's own `rescue` can handle
|
|
50
|
+
it, and one that arrives after the tool has returned is a no-op, which no
|
|
51
|
+
longer throws the result away. Before this, the interrupt was raised on
|
|
52
|
+
the child process's or the ractor's main thread wherever that thread had
|
|
53
|
+
got to.
|
|
54
|
+
|
|
55
|
+
* **function: answer a ractor-backed task once its ractor has gone** <br>
|
|
56
|
+
A `:ractor` tool's result is handed to a ractor the task holds it in,
|
|
57
|
+
rather than asked of the ractor that ran the tool, which answers `alive?`
|
|
58
|
+
while the tool runs and goes once the result is in. So a wait that arrives
|
|
59
|
+
after the tool has run is answered, a second wait is answered from memory,
|
|
60
|
+
the way
|
|
61
|
+
[`LLM::Function::Thread::Task#wait`](https://r.uby.dev/api-docs/llm.rb/LLM/Function/Thread/Task.html#wait-instance_method)
|
|
62
|
+
answers from the thread's value, and `alive?` answers `false` once the task
|
|
63
|
+
has been waited on. A cancel returns `nil` rather than raising, which is what
|
|
64
|
+
lets
|
|
65
|
+
[`LLM::Function::Ractor::Group#interrupt!`](https://r.uby.dev/api-docs/llm.rb/LLM/Function/Ractor/Group.html#interrupt!-instance_method)
|
|
66
|
+
reach every task it holds. Before this, a wait that arrived once the tool had
|
|
67
|
+
run raised `Ractor::ClosedError` or never came back, a cancel raised the same
|
|
68
|
+
error, and a group's cancel stopped at the first task that had already
|
|
69
|
+
returned, leaving the calls after it uncancelled.
|
|
70
|
+
|
|
71
|
+
### Provider
|
|
72
|
+
|
|
73
|
+
* **deepseek: support image attachments in chat completions** <br>
|
|
74
|
+
DeepSeek's vision models now take an image through the chat completions
|
|
75
|
+
adapter. A tagged prompt object of kind `:image_url` is sent as an `image_url`
|
|
76
|
+
content item, and a local image file is sent as a base64 encoded data URI.
|
|
77
|
+
Anything else is rejected with a reason of its own: a remote file or an
|
|
78
|
+
`LLM::Response` raises
|
|
79
|
+
[`LLM::PromptError`](https://r.uby.dev/api-docs/llm.rb/LLM/PromptError.html)
|
|
80
|
+
because DeepSeek has no Files API, so a file id cannot be resolved, and a
|
|
81
|
+
local file that is not an image raises because DeepSeek's models read images
|
|
82
|
+
only.
|
|
83
|
+
|
|
84
|
+
### Registry
|
|
85
|
+
|
|
86
|
+
* **refresh model metadata** <br>
|
|
87
|
+
Update `data/` with current model listings, limits, and pricing. Alibaba adds
|
|
88
|
+
`qwen3.5-flash`, `qwen3.7-flash`, and `qwen3.8-omni-flash`, and gives
|
|
89
|
+
`qwen3.7-plus` attachments, structured output, and a lower price; OpenAI adds
|
|
90
|
+
`gpt-daybreak-blue-latest` and `gpt-daybreak-red-latest`; Bedrock adds
|
|
91
|
+
`openai.gpt-6-sol` and `openai.gpt-6-luna`; and DeepInfra adds
|
|
92
|
+
`tencent/Hy4-preview` and the Xiaomi MiMo V2.6 Pro and V2.6 Flash models.
|
|
93
|
+
Bedrock also corrects the context and output limits of fifteen models, Google
|
|
94
|
+
lowers the limits of `gemini-2.5-computer-use-preview-10-2025` and
|
|
95
|
+
`gemini-3-pro-image`, and OpenRouter adds four models, drops six, and reprices
|
|
96
|
+
many of the DeepSeek, Z.ai, and Qwen entries.
|
|
19
97
|
|
|
20
98
|
## v15.5.0
|
|
21
99
|
|
data/README.md
CHANGED
|
@@ -14,18 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
Welcome to the canonical llm.rb repository.
|
|
16
16
|
|
|
17
|
-
llm.rb is
|
|
17
|
+
llm.rb is a runtime for building agentic AI applications
|
|
18
18
|
on CRuby. It has zero runtime dependencies by default, supports
|
|
19
19
|
concurrent and parallel tool execution and has a single coherent API
|
|
20
20
|
that spans 14+ providers.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
See llm.rb in action on the
|
|
23
23
|
[the r.uby.dev website](https://r.uby.dev) where
|
|
24
|
-
I am
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
curious. Still in early development.
|
|
24
|
+
I am building a platform that supports users who have
|
|
25
|
+
personalized agents with access to different services
|
|
26
|
+
(eg GitHub, etc). Check it out if curious.
|
|
27
|
+
**Still in early development.**
|
|
29
28
|
|
|
30
29
|
## Install
|
|
31
30
|
|
|
@@ -53,9 +52,12 @@ model as an in-band error that allows the model to correct course.
|
|
|
53
52
|
A lot of care also goes into keeping the tool loop from entering
|
|
54
53
|
an invalid state that would lead to API-level errors. For example,
|
|
55
54
|
when a tool call is interrupted it could leave an unanswered tool
|
|
56
|
-
call that a model will reject on the next turn. The runtime
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
call that a model will reject on the next turn. The runtime closes
|
|
56
|
+
every tool call that has no return before the next request is sent,
|
|
57
|
+
and each one is answered with an in-band return of its own. The
|
|
58
|
+
conversation a provider sees is therefore always valid, and a
|
|
59
|
+
cancelled call is something the model is told about rather than
|
|
60
|
+
something that quietly disappears.
|
|
59
61
|
|
|
60
62
|
```ruby
|
|
61
63
|
require "llm"
|
|
@@ -666,8 +668,7 @@ agent = LLM::Agent.new(llm, tools: [LLM::Tool::Exec, ReadFile], guard: PolicyGua
|
|
|
666
668
|
<br>
|
|
667
669
|
|
|
668
670
|
It is possible to rewrite outgoing messages before they reach the provider with
|
|
669
|
-
[`LLM::Transformer`](https://r.uby.dev/api-docs/llm.rb/LLM/Transformer.html).
|
|
670
|
-
Create a subclass and implement `call(message:)` to scrub sensitive data,
|
|
671
|
+
[`LLM::Transformer`](https://r.uby.dev/api-docs/llm.rb/LLM/Transformer.html). Create a subclass and implement `call(message:)` to scrub sensitive data,
|
|
671
672
|
inject context, or normalize content. The transform runs automatically
|
|
672
673
|
on every turn, so you never have to change your prompt code.
|
|
673
674
|
|
|
@@ -1109,9 +1110,8 @@ It is battle tested daily.
|
|
|
1109
1110
|
The console that is distributed with llm.rb is used
|
|
1110
1111
|
to build llm.rb so there is a healthy, active feedback
|
|
1111
1112
|
loop. It also powers the [r.uby.dev](https://r.uby.dev)
|
|
1112
|
-
website where multiple llm.rb agents are deployed
|
|
1113
|
-
|
|
1114
|
-
I'm also aware of at least one production Rails deployment
|
|
1113
|
+
website where multiple llm.rb agents are deployed. I'm
|
|
1114
|
+
aware of at least one production Rails deployment
|
|
1115
1115
|
at a large-ish company.
|
|
1116
1116
|
|
|
1117
1117
|
And this git repository includes llm.rb agents that help me
|
|
@@ -1121,20 +1121,6 @@ there is a large test suite that covers live requests (recorded
|
|
|
1121
1121
|
by VCR) and database interactions.
|
|
1122
1122
|
</details>
|
|
1123
1123
|
|
|
1124
|
-
## See also
|
|
1125
|
-
|
|
1126
|
-
The [roda-llm](https://github.com/r-uby-dev/roda-llm#readme) project
|
|
1127
|
-
is how I deploy multiple ActiveRecord-backed llm.rb agents over HTTP.
|
|
1128
|
-
Each agent has an identical interface at a unique path that provide
|
|
1129
|
-
CRUD operations and stream support (via SSE - Server Side Events).
|
|
1130
|
-
It lets you focus on implementing agents rather than the glue that
|
|
1131
|
-
brings them together. It is implemented as a Roda plugin that could
|
|
1132
|
-
be hosted within a Rails application or other Rack-based applications.
|
|
1133
|
-
|
|
1134
|
-
The [docs/](docs/) directory contains the full documentation and
|
|
1135
|
-
the chatbot can find the answers to your questions there. Or you
|
|
1136
|
-
can read them yourself. :)
|
|
1137
|
-
|
|
1138
1124
|
## License
|
|
1139
1125
|
|
|
1140
1126
|
This software is released under the terms of the MIT license. <br>
|