llm.rb 4.18.0 → 4.19.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 +31 -11
- data/README.md +13 -6
- data/lib/llm/active_record/acts_as_agent.rb +8 -3
- data/lib/llm/active_record/acts_as_llm.rb +2 -2
- data/lib/llm/sequel/plugin.rb +2 -2
- data/lib/llm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18c28f7b5ec05ad6f9629a6a328be4dd377a6efb43a13c2ac99dd0abf015b1f8
|
|
4
|
+
data.tar.gz: a0c03de362af927d090a6bc09b2170ddb7eb5766f26b1f8f657a37bd10d0162e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8255c9435bec0a7a06fb427f3a1ade4e0b5ce47f111d33f4cbf1218fce1f89f1438c71980b52c3de7542563690f08bcf54417cb7d427720248a22f8b30a12fb
|
|
7
|
+
data.tar.gz: 54aebea9a5f8ac687163d3df3c2c3d31091f8f8d6d96b5ad242199daa8fdfb8e5e17e2b626f7a682158ba9251202362fc9fddaed6c08e6eb8399c8b0509659d8
|
data/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
Changes since `v4.19.0`.
|
|
6
|
+
|
|
7
|
+
## v4.19.0
|
|
8
|
+
|
|
5
9
|
Changes since `v4.18.0`.
|
|
6
10
|
|
|
11
|
+
This release tightens the ActiveRecord and ORM integration layer. It adds
|
|
12
|
+
inline agent DSL blocks to `acts_as_agent` so agent defaults can be defined
|
|
13
|
+
where the wrapper is declared, and it exposes the resolved provider through
|
|
14
|
+
public `llm` methods on the ActiveRecord and Sequel wrappers.
|
|
15
|
+
|
|
16
|
+
### Change
|
|
17
|
+
|
|
18
|
+
* **Make ORM provider access public through `llm`** <br>
|
|
19
|
+
Expose the resolved provider on the Sequel plugin and the ActiveRecord
|
|
20
|
+
`acts_as_llm` / `acts_as_agent` wrappers through a public `llm` method.
|
|
21
|
+
|
|
22
|
+
* **Allow inline agent DSL blocks in `acts_as_agent`** <br>
|
|
23
|
+
Let ActiveRecord models configure `model`, `tools`, `schema`,
|
|
24
|
+
`instructions`, and `concurrency` directly inside the `acts_as_agent`
|
|
25
|
+
declaration block.
|
|
26
|
+
|
|
27
|
+
## v4.18.0
|
|
28
|
+
|
|
29
|
+
Changes since `v4.17.0`.
|
|
30
|
+
|
|
31
|
+
This release improves tracing and tool execution behavior across llm.rb.
|
|
32
|
+
It makes provider tracers default to the provider instance, adds
|
|
33
|
+
`LLM::Provider#with_tracer` for scoped overrides, restores tool tracing for
|
|
34
|
+
concurrent and streamed tool execution, extends streamed tracing to MCP tools,
|
|
35
|
+
and adds symbol-based ORM option hooks alongside experimental ractor tool
|
|
36
|
+
concurrency.
|
|
37
|
+
|
|
7
38
|
### Change
|
|
8
39
|
|
|
9
40
|
* **Make provider tracers default to the provider instance** <br>
|
|
@@ -42,17 +73,6 @@ Changes since `v4.18.0`.
|
|
|
42
73
|
is especially useful for CPU-bound tools, while `:task`, `:fiber`, or
|
|
43
74
|
`:thread` may be a better fit for I/O-bound work.
|
|
44
75
|
|
|
45
|
-
## v4.18.0
|
|
46
|
-
|
|
47
|
-
Changes since `v4.17.0`.
|
|
48
|
-
|
|
49
|
-
This release improves tracing and tool execution behavior across llm.rb.
|
|
50
|
-
It makes provider tracers default to the provider instance, adds
|
|
51
|
-
`LLM::Provider#with_tracer` for scoped overrides, restores tool tracing for
|
|
52
|
-
concurrent and streamed tool execution, extends streamed tracing to MCP tools,
|
|
53
|
-
and adds symbol-based ORM option hooks alongside experimental ractor tool
|
|
54
|
-
concurrency.
|
|
55
|
-
|
|
56
76
|
## v4.17.0
|
|
57
77
|
|
|
58
78
|
Changes since `v4.16.1`.
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<p align="center">
|
|
5
5
|
<a href="https://0x1eef.github.io/x/llm.rb?rebuild=1"><img src="https://img.shields.io/badge/docs-0x1eef.github.io-blue.svg" alt="RubyDoc"></a>
|
|
6
6
|
<a href="https://opensource.org/license/0bsd"><img src="https://img.shields.io/badge/License-0BSD-orange.svg?" alt="License"></a>
|
|
7
|
-
<a href="https://github.com/llmrb/llm.rb/tags"><img src="https://img.shields.io/badge/version-4.
|
|
7
|
+
<a href="https://github.com/llmrb/llm.rb/tags"><img src="https://img.shields.io/badge/version-4.19.0-green.svg?" alt="Version"></a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
10
|
## About
|
|
@@ -254,11 +254,18 @@ require "active_record"
|
|
|
254
254
|
require "llm/active_record"
|
|
255
255
|
|
|
256
256
|
class Ticket < ApplicationRecord
|
|
257
|
-
acts_as_agent provider:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
acts_as_agent provider: :set_provider do
|
|
258
|
+
model "gpt-5.4-mini"
|
|
259
|
+
instructions "You are a concise support assistant."
|
|
260
|
+
tools SearchDocs, Escalate
|
|
261
|
+
concurrency :thread
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
private
|
|
265
|
+
|
|
266
|
+
def set_provider
|
|
267
|
+
{ key: ENV["#{provider.upcase}_SECRET"], persistent: true }
|
|
268
|
+
end
|
|
262
269
|
end
|
|
263
270
|
|
|
264
271
|
ticket = Ticket.create!(provider: "openai", model: "gpt-5.4-mini")
|
|
@@ -71,18 +71,21 @@ module LLM::ActiveRecord
|
|
|
71
71
|
# @option options [Proc, Symbol, LLM::Tracer, nil] :tracer
|
|
72
72
|
# Optional tracer, method name, or proc that resolves to one and is
|
|
73
73
|
# assigned through `llm.tracer = ...` on the resolved provider.
|
|
74
|
+
# @yield
|
|
75
|
+
# Evaluated in the model class after the wrapper is installed, so agent
|
|
76
|
+
# DSL methods such as `model`, `tools`, `schema`, `instructions`, and
|
|
77
|
+
# `concurrency` can be configured inline.
|
|
74
78
|
# @return [void]
|
|
75
|
-
def acts_as_agent(options = EMPTY_HASH)
|
|
79
|
+
def acts_as_agent(options = EMPTY_HASH, &block)
|
|
76
80
|
options = DEFAULTS.merge(options)
|
|
77
81
|
usage_columns = DEFAULT_USAGE_COLUMNS.merge(options[:usage_columns] || EMPTY_HASH)
|
|
78
82
|
class_attribute :llm_agent_options, instance_accessor: false, default: DEFAULTS unless respond_to?(:llm_agent_options)
|
|
79
83
|
self.llm_agent_options = options.merge(usage_columns: usage_columns.freeze).freeze
|
|
80
84
|
extend Hooks
|
|
85
|
+
class_exec(&block) if block
|
|
81
86
|
end
|
|
82
87
|
|
|
83
88
|
module InstanceMethods
|
|
84
|
-
private
|
|
85
|
-
|
|
86
89
|
##
|
|
87
90
|
# Returns the resolved provider instance for this record.
|
|
88
91
|
# @return [LLM::Provider]
|
|
@@ -96,6 +99,8 @@ module LLM::ActiveRecord
|
|
|
96
99
|
@llm
|
|
97
100
|
end
|
|
98
101
|
|
|
102
|
+
private
|
|
103
|
+
|
|
99
104
|
##
|
|
100
105
|
# @return [LLM::Agent]
|
|
101
106
|
def ctx
|
|
@@ -206,8 +206,6 @@ module LLM::ActiveRecord
|
|
|
206
206
|
ctx.tracer
|
|
207
207
|
end
|
|
208
208
|
|
|
209
|
-
private
|
|
210
|
-
|
|
211
209
|
##
|
|
212
210
|
# Returns the resolved provider instance for this record.
|
|
213
211
|
# @return [LLM::Provider]
|
|
@@ -221,6 +219,8 @@ module LLM::ActiveRecord
|
|
|
221
219
|
@llm
|
|
222
220
|
end
|
|
223
221
|
|
|
222
|
+
private
|
|
223
|
+
|
|
224
224
|
##
|
|
225
225
|
# @return [LLM::Context]
|
|
226
226
|
def ctx
|
data/lib/llm/sequel/plugin.rb
CHANGED
|
@@ -224,8 +224,6 @@ module LLM::Sequel
|
|
|
224
224
|
ctx.tracer
|
|
225
225
|
end
|
|
226
226
|
|
|
227
|
-
private
|
|
228
|
-
|
|
229
227
|
##
|
|
230
228
|
# Returns the resolved provider instance for this record.
|
|
231
229
|
# @return [LLM::Provider]
|
|
@@ -239,6 +237,8 @@ module LLM::Sequel
|
|
|
239
237
|
@llm
|
|
240
238
|
end
|
|
241
239
|
|
|
240
|
+
private
|
|
241
|
+
|
|
242
242
|
##
|
|
243
243
|
# @return [LLM::Context]
|
|
244
244
|
def ctx
|
data/lib/llm/version.rb
CHANGED