llm.rb 12.0.0 → 12.1.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 +112 -1
- data/LICENSE +5 -4
- data/README.md +30 -1
- data/data/anthropic.json +83 -371
- data/data/bedrock.json +451 -3
- data/data/deepinfra.json +566 -46
- data/data/deepseek.json +4 -0
- data/data/google.json +22 -0
- data/data/openai.json +51 -0
- data/data/xai.json +8 -0
- data/data/zai.json +14 -0
- data/lib/llm/agent.rb +25 -1
- data/lib/llm/context.rb +8 -0
- data/lib/llm/json_adapter.rb +29 -3
- data/lib/llm/provider.rb +1 -1
- data/lib/llm/providers/llamacpp.rb +5 -5
- data/lib/llm/repl/input.rb +64 -0
- data/lib/llm/repl/status.rb +30 -0
- data/lib/llm/repl/stream.rb +46 -0
- data/lib/llm/repl/transcript.rb +61 -0
- data/lib/llm/repl/window.rb +107 -0
- data/lib/llm/repl.rb +78 -0
- data/lib/llm/tools/chdir.rb +23 -0
- data/lib/llm/tools/git.rb +41 -0
- data/lib/llm/tools/mkdir.rb +32 -0
- data/lib/llm/tools/pwd.rb +20 -0
- data/lib/llm/tools/read_file.rb +40 -0
- data/lib/llm/tools/rg.rb +46 -0
- data/lib/llm/tools/shell.rb +48 -0
- data/lib/llm/tools/swap_text.rb +25 -0
- data/lib/llm/tools/write_file.rb +24 -0
- data/lib/llm/tools.rb +5 -0
- data/lib/llm/version.rb +1 -1
- data/resources/deepdive.md +32 -0
- metadata +17 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4c7d2a7e0fd6a5b05cfdaaf2702f94f9a15d3e277739559f5cb676768fe6a9c
|
|
4
|
+
data.tar.gz: ad3081a38e1096459791ec6cffd1ae0a8550f5d4df2c6c95fd8842b78a0024f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e5a58f5b22d07b05d981423414de270b1ae760c7920452e736a55709c6c1eeee941407de8a8667365ee83943deeb0554d05bec5425b7132fe907dc62f349ffa
|
|
7
|
+
data.tar.gz: fabedc3aad36ba5cbaf7b126c55ddc3cbb428aadb3b2887a40e429daf35c65ff81a4d8c903583dea27c051d89f076d9d3446736e948954a6cef26065aebfa624
|
data/CHANGELOG.md
CHANGED
|
@@ -13,7 +13,118 @@
|
|
|
13
13
|
> Changelog <br>
|
|
14
14
|
> a [r.uby.dev](https://r.uby.dev) project
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## What's next
|
|
17
|
+
|
|
18
|
+
Changes since `v12.1.0`.
|
|
19
|
+
|
|
20
|
+
## v12.1.0
|
|
21
|
+
|
|
22
|
+
Changes since `v12.0.0`.
|
|
23
|
+
|
|
24
|
+
This release adds `LLM::Agent#repl` with a curses-based
|
|
25
|
+
interactive read-eval-print loop. It requires the optional
|
|
26
|
+
dependency `curses` and it is probably the most notable
|
|
27
|
+
feature in this release.
|
|
28
|
+
|
|
29
|
+
Multiple _opt-in_ tools have been added to the `llm/tools/*.rb`
|
|
30
|
+
directory. They serve as examples and as general-purpose tools
|
|
31
|
+
that happen to power the repository's agents.
|
|
32
|
+
|
|
33
|
+
The BSL license has been extended to grant additional free waivers
|
|
34
|
+
for non-profits, charities and for companies with 50 or less
|
|
35
|
+
employees.
|
|
36
|
+
|
|
37
|
+
Other changes include small-ish bug fixes. <br>
|
|
38
|
+
As always, see the changelog details for a thorough overview.
|
|
39
|
+
|
|
40
|
+
### Add
|
|
41
|
+
|
|
42
|
+
* **Add `LLM::Agent#repl`** <br>
|
|
43
|
+
Add a curses-based read-eval-print loop for `LLM::Agent` that lets
|
|
44
|
+
developers interact with an agent after it has been set up or has
|
|
45
|
+
performed a task. It is similar to `binding.pry`: once you exit,
|
|
46
|
+
you can continue with the rest of your program. It requires the
|
|
47
|
+
`curses` gem.
|
|
48
|
+
|
|
49
|
+
* **Add `#tracer=` setter on Provider, Context and Agent** <br>
|
|
50
|
+
`LLM::Provider`, `LLM::Context` and `LLM::Agent` can now configure
|
|
51
|
+
the tracer after initialization via the `#tracer=` setter. It accepts
|
|
52
|
+
a subclass of `LLM::Tracer` or `nil` to disable the tracer.
|
|
53
|
+
|
|
54
|
+
* **Add `LLM::Tool::Shell`** <br>
|
|
55
|
+
Add a built-in shell tool that can run a command with arguments. <br>
|
|
56
|
+
It must be required explicitly with `require "llm/tools/shell"` and
|
|
57
|
+
requires the `test-cmd.rb` gem.
|
|
58
|
+
|
|
59
|
+
* **Add `LLM::Tool::ReadFile`** <br>
|
|
60
|
+
Add a built-in tool for reading the contents of a file, with optional
|
|
61
|
+
`start` and `stop` line offsets. <br>
|
|
62
|
+
It must be required explicitly with `require "llm/tools/read_file"`.
|
|
63
|
+
|
|
64
|
+
* **Add `LLM::Tool::Chdir`** <br>
|
|
65
|
+
Add a built-in tool for changing the current working directory. <br>
|
|
66
|
+
It must be required explicitly with `require "llm/tools/chdir"`.
|
|
67
|
+
|
|
68
|
+
* **Add `LLM::Tool::Git`** <br>
|
|
69
|
+
Add a built-in tool that can perform git actions (`log`, `diff`,
|
|
70
|
+
`show`, `commit`, `checkout`, `branch`). <br>
|
|
71
|
+
It must be required explicitly with `require "llm/tools/git"` and requires the `test-cmd.rb` gem.
|
|
72
|
+
|
|
73
|
+
* **Add `LLM::Tool::Rg`** <br>
|
|
74
|
+
Add a built-in tool that wraps the `rg` (ripgrep) command for
|
|
75
|
+
recursively searching the current directory for patterns. <br>
|
|
76
|
+
It must be required explicitly with `require "llm/tools/rg"` and requires the `test-cmd.rb` gem.
|
|
77
|
+
|
|
78
|
+
* **Add `LLM::Tool::SwapText`** <br>
|
|
79
|
+
Add a built-in tool that can replace an exact snippet of text in a
|
|
80
|
+
file with a new piece of text. <br>
|
|
81
|
+
It must be required explicitly with `require "llm/tools/swap_text"`.
|
|
82
|
+
|
|
83
|
+
* **Add `LLM::Tool::Pwd`** <br>
|
|
84
|
+
Add a built-in tool that returns the current working directory. <br>
|
|
85
|
+
It must be required explicitly with `require "llm/tools/pwd"`.
|
|
86
|
+
|
|
87
|
+
* **Add `LLM::Tool::WriteFile`** <br>
|
|
88
|
+
Add a built-in tool that can write a given string to a given file
|
|
89
|
+
path. <br>
|
|
90
|
+
It must be required explicitly with `require "llm/tools/write_file"`.
|
|
91
|
+
|
|
92
|
+
* **Add `LLM::Tool::Mkdir`** <br>
|
|
93
|
+
Add a built-in tool that can create a tree of new directories. <br>
|
|
94
|
+
It must be required explicitly with `require "llm/tools/mkdir"` and
|
|
95
|
+
requires the `test-cmd.rb` gem.
|
|
96
|
+
|
|
97
|
+
### Change
|
|
98
|
+
|
|
99
|
+
* **Extend BSL additional use grant** <br>
|
|
100
|
+
The Business Source License additional use grant has been extended to
|
|
101
|
+
include non-profits, charities, and companies with 50 or fewer
|
|
102
|
+
employees, in addition to the existing personal, education, and
|
|
103
|
+
evaluation uses.
|
|
104
|
+
|
|
105
|
+
* **Change LlamaCpp default port (8080 => 8013)** <br>
|
|
106
|
+
The default port for the LlamaCpp provider has changed from `8080` to
|
|
107
|
+
`8013` since llamacpp itself defaults to that port.
|
|
108
|
+
|
|
109
|
+
* **Change LlamaCpp default model to `nil`** <br>
|
|
110
|
+
The default model for LlamaCpp is now `nil`, letting whatever model
|
|
111
|
+
is served by the llamacpp server act as the default. Previously it
|
|
112
|
+
defaulted to `qwen3`.
|
|
113
|
+
|
|
114
|
+
### Fix
|
|
115
|
+
|
|
116
|
+
* **Fix `LLM::Agent.tools` Symbol resolution** <br>
|
|
117
|
+
When an agent defined tools via `tools :method_name`, the resolved
|
|
118
|
+
symbol was incorrectly forwarded as `[:method_name]` (an array) to
|
|
119
|
+
`LLM::Context`. This fix copies the same pattern used by other
|
|
120
|
+
attribute resolvers (e.g., `skills`) so a single Symbol is resolved
|
|
121
|
+
through the agent instance correctly.
|
|
122
|
+
|
|
123
|
+
* **Encode strings as UTF-8 in the JSON adapter** <br>
|
|
124
|
+
The `json` gem will reject BINARY-encoded strings from version 3 and
|
|
125
|
+
beyond. The `LLM::JSONAdapter.dump` method now walks serialized data
|
|
126
|
+
and encodes every string into UTF-8, using `String#scrub` to replace
|
|
127
|
+
bytes that are not valid UTF-8.
|
|
17
128
|
|
|
18
129
|
## v12.0.0
|
|
19
130
|
|
data/LICENSE
CHANGED
|
@@ -10,10 +10,11 @@ Licensor: Robert Gleeson
|
|
|
10
10
|
Licensed Work: llm.rb
|
|
11
11
|
|
|
12
12
|
Additional Use Grant:
|
|
13
|
-
Free for personal use
|
|
14
|
-
Free for
|
|
15
|
-
Free for evaluation, development, and testing
|
|
16
|
-
|
|
13
|
+
- Free for personal use
|
|
14
|
+
- Free for students and their teachers
|
|
15
|
+
- Free for evaluation, development, and testing
|
|
16
|
+
- Free for non-profits and charities
|
|
17
|
+
- Free for companies with less than or equal to 50 employees
|
|
17
18
|
|
|
18
19
|
Change Date:
|
|
19
20
|
Four years after the first public release of each specific version of the
|
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</a>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
|
-
> A [r.uby.dev](https://r.uby.dev) project.
|
|
13
|
+
> A [r.uby.dev](https://r.uby.dev/llm) project.
|
|
14
14
|
|
|
15
15
|
Welcome to the canonical llm.rb repository.
|
|
16
16
|
|
|
@@ -117,6 +117,24 @@ agent = LLM::Agent.new(llm, stream: MyStream.new)
|
|
|
117
117
|
agent.talk "Explain Ruby fibers."
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
#### LLM::REPL
|
|
121
|
+
|
|
122
|
+
The [LLM::Agent#repl](https://r.uby.dev/api-docs/llm.rb/LLM/Agent.html#repl-instance_method)
|
|
123
|
+
method allows an agent to spawn a read-eval-print loop
|
|
124
|
+
that can be useful during the development and operation
|
|
125
|
+
of agents. It can be used to debug tool calls, confirm an
|
|
126
|
+
agent has done what was expected, or improve the agent
|
|
127
|
+
by asking questions about what it has done up to that point.
|
|
128
|
+
|
|
129
|
+
This feature requires that the [curses](https://github.com/ruby/curses)
|
|
130
|
+
library is installed and available to require.
|
|
131
|
+
|
|
132
|
+
```ruby
|
|
133
|
+
llm = LLM.deepseek(key: ENV["KEY"])
|
|
134
|
+
agent = LLM::Agent.new(llm)
|
|
135
|
+
agent.repl
|
|
136
|
+
```
|
|
137
|
+
|
|
120
138
|
#### LLM::MCP
|
|
121
139
|
|
|
122
140
|
The Model Context Protocol (MCP) has first-class support
|
|
@@ -335,3 +353,14 @@ Each version converts to the [BSD Zero Clause](https://choosealicense.com/licens
|
|
|
335
353
|
four years after its first public release.
|
|
336
354
|
<br>
|
|
337
355
|
Contact [robert@r.uby.dev](mailto:robert@r.uby.dev) for a commercial license.
|
|
356
|
+
|
|
357
|
+
### Waivers
|
|
358
|
+
|
|
359
|
+
Waivers are automatically granted for: <br>
|
|
360
|
+
|
|
361
|
+
* Personal use
|
|
362
|
+
* Students
|
|
363
|
+
* Teachers
|
|
364
|
+
* Evaluation, development, and testing
|
|
365
|
+
* Non-profits and charities
|
|
366
|
+
* Companies with less than or equal to 50 employees
|