Commit dce45e2
committed
Fix callback persistence chaining using Fanout pattern
- Implements `CallbackFanout` in `RubyLLM::Chat` to allow multiple callbacks per event.
- Removes brittle wrapper workarounds in ActiveRecord integrations.
- Ensures persistence callbacks are not overwritten when users define custom callbacks on the underlying LLM object.
- Adds regression test for direct callback chaining.1 parent 89605e2 commit dce45e2
File tree
5 files changed
+163
-38
lines changed- lib/ruby_llm
- active_record
- spec
- fixtures/vcr_cassettes
- ruby_llm/active_record
5 files changed
+163
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 155 | + | |
163 | 156 | | |
164 | 157 | | |
165 | 158 | | |
166 | 159 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 160 | + | |
175 | 161 | | |
176 | 162 | | |
177 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 143 | + | |
151 | 144 | | |
152 | 145 | | |
153 | 146 | | |
154 | 147 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 148 | + | |
163 | 149 | | |
164 | 150 | | |
165 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
10 | 38 | | |
11 | 39 | | |
12 | 40 | | |
| |||
22 | 50 | | |
23 | 51 | | |
24 | 52 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 53 | + | |
31 | 54 | | |
32 | 55 | | |
33 | 56 | | |
| |||
Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
532 | 546 | | |
533 | 547 | | |
534 | 548 | | |
| |||
0 commit comments