llm.rb 11.2.0 → 11.3.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +85 -11
  3. data/README.md +137 -144
  4. data/lib/llm/a2a.rb +2 -2
  5. data/lib/llm/active_record/acts_as_agent.rb +7 -0
  6. data/lib/llm/active_record/acts_as_llm.rb +7 -0
  7. data/lib/llm/agent.rb +26 -5
  8. data/lib/llm/cost.rb +1 -1
  9. data/lib/llm/error.rb +4 -0
  10. data/lib/llm/function/fiber_group.rb +2 -2
  11. data/lib/llm/function/task_group.rb +2 -2
  12. data/lib/llm/function/thread_group.rb +3 -3
  13. data/lib/llm/pipe.rb +1 -1
  14. data/lib/llm/providers/anthropic/error_handler.rb +2 -0
  15. data/lib/llm/providers/anthropic/request_adapter.rb +1 -1
  16. data/lib/llm/providers/bedrock/error_handler.rb +1 -1
  17. data/lib/llm/providers/bedrock/request_adapter/completion.rb +5 -5
  18. data/lib/llm/providers/bedrock/request_adapter.rb +3 -3
  19. data/lib/llm/providers/bedrock/response_adapter/completion.rb +2 -2
  20. data/lib/llm/providers/bedrock/response_adapter.rb +2 -2
  21. data/lib/llm/providers/deepseek/request_adapter.rb +1 -1
  22. data/lib/llm/providers/google/error_handler.rb +2 -0
  23. data/lib/llm/providers/google/request_adapter.rb +1 -1
  24. data/lib/llm/providers/ollama/error_handler.rb +2 -0
  25. data/lib/llm/providers/ollama/request_adapter.rb +1 -1
  26. data/lib/llm/providers/openai/error_handler.rb +2 -0
  27. data/lib/llm/providers/openai/request_adapter.rb +1 -1
  28. data/lib/llm/registry.rb +2 -2
  29. data/lib/llm/response.rb +1 -1
  30. data/lib/llm/schema/object.rb +1 -1
  31. data/lib/llm/stream.rb +1 -1
  32. data/lib/llm/tool.rb +2 -2
  33. data/lib/llm/transport/http.rb +2 -2
  34. data/lib/llm/transport/persistent_http.rb +1 -1
  35. data/lib/llm/transport/response/http.rb +1 -1
  36. data/lib/llm/utils.rb +1 -1
  37. data/lib/llm/version.rb +1 -1
  38. data/lib/llm.rb +11 -8
  39. data/llm.gemspec +11 -9
  40. data/resources/deepdive.md +432 -0
  41. metadata +28 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb1ffd1e0ecb17422014ec8f75c8b729f74d0a7cef4fd4e12681ef254411b24a
4
- data.tar.gz: e5a7815d52c6fa99a38dec111c6d71aef9782272b97bfbad81e8f5bee913f918
3
+ metadata.gz: e3aad41c57654e1abef4c184da8904ae5840708e8f5ce937e1030279a5e5a240
4
+ data.tar.gz: 9b03ac6a4f04190a57f2e4698eab923087febbab6a1ff8ad67f391fce4bd5c1e
5
5
  SHA512:
6
- metadata.gz: d7c2d1dac8ef97a5be2540896828b523ce1491e43f2fd8c78e53b8fbab34432bf6dedaee066afd43d261fb8f4e2fb9f7c3d8c112de83e60ee809d6ef77f41feb
7
- data.tar.gz: d5073e8c5c156739cff4c68c65c4efaf88403229841ada3cdd1adb4920dfb58c00017ae7dbd73d12ef17b6c191b0b71ab4f15fd0c0ae29991dcffb1b840381d0
6
+ metadata.gz: f429a75d5b612eb27968b6e6451bd231f2191b5b955262503c68baa7ca27f289c01ad564558e82d7fcc732393f635c32caf883a36815b41d86f6c1289cfffb61
7
+ data.tar.gz: 90924b997b5d47d74c3df6e303c890fb5d1a771bae10e63c349436bcbd061241604184f62df87cb2dee7d85405fbd53f08d279ef6b4d3a85a12b0d59b7377229
data/CHANGELOG.md CHANGED
@@ -2,6 +2,80 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v11.3.1
6
+
7
+ Changes since `v11.3.0`.
8
+
9
+ This release rebrands the project under the r.uby.dev umbrella, removes
10
+ the Jekyll-based docs site in favor of a pure-markdown deepdive, and
11
+ cleans up YARD documentation across the codebase.
12
+
13
+ ### Change
14
+
15
+ * **Rebrand to r.uby.dev** <br>
16
+ Update README.md with the new logo, streamlined copy, and r.uby.dev
17
+ URLs. Rewrite `resources/deepdive.md` as a concise walkthrough and
18
+ bundle it with the gem. Remove the `docs/` directory (Jekyll site).
19
+ Update all references from `llmrb.github.io` to `r.uby.dev`.
20
+
21
+ * **Update gemspec** <br>
22
+ Update homepage, metadata URLs, email, and author list. Switch the
23
+ YARD markdown processor from kramdown to redcarpet.
24
+
25
+ ### Fix
26
+
27
+ * **Fix YARD documentation** <br>
28
+ Fix unnamed, misnamed, and missing `@param` tags across provider
29
+ adapters, transport classes, stream, tool, schema, registry, agent,
30
+ and ActiveRecord integration files. Fix backtick-wrapped constant
31
+ references and other YARD formatting issues.
32
+
33
+ ## v11.3.0
34
+
35
+ Changes since `v11.2.0`.
36
+
37
+ This release promotes `LLM::Agent` as the default high-level runtime,
38
+ raises `LLM::NotFoundError` for provider 404 responses, and adds
39
+ Symbol resolution to `LLM::Agent.confirm` and `LLM::Agent.skills` for
40
+ dynamic tool confirmation and skill lists.
41
+
42
+ ### Add
43
+
44
+ * **Raise `LLM::NotFoundError` for provider 404 responses** <br>
45
+ Raise `LLM::NotFoundError` when a provider returns HTTP 404. One
46
+ example is calling the embeddings API on DeepSeek
47
+ (`LLM.deepseek(...).embed(["foobar"])`), which returns 404 because
48
+ DeepSeek does not implement that endpoint.
49
+
50
+ * **Add Symbol resolution to `LLM::Agent.confirm`** <br>
51
+ When `confirm` receives a single Symbol argument, it stores it
52
+ as-is instead of converting it to a string array. At initialization
53
+ time, `resolve_option` resolves the Symbol by calling the method
54
+ with that name on the agent instance, and the result is converted
55
+ to strings. This allows dynamic tool confirmation lists:
56
+
57
+ class MyAgent < LLM::Agent
58
+ confirm :tools_that_need_confirmation
59
+
60
+ def tools_that_need_confirmation
61
+ some_condition ? %w[delete destroy] : %w[delete]
62
+ end
63
+ end
64
+
65
+ Ported from llmrb/mruby-llm@89a232e3 and @2dd04e2d.
66
+
67
+ Extend the same pattern to `LLM::Agent.skills` so the skills DSL
68
+ accepts a Symbol that resolves through the agent instance at
69
+ initialization time.
70
+
71
+ ### Change
72
+
73
+ * **Clarify `LLM::Agent` as the default high-level runtime** <br>
74
+ Document that `LLM::Context` remains at the heart of llm.rb, but
75
+ `LLM::Agent` is the better default unless an application needs advanced
76
+ manual tool loops. `LLM::Agent` manages the tool loop for callers and
77
+ enables guards against runaway or repeated tool-call loops.
78
+
5
79
  ## v11.2.0
6
80
 
7
81
  Changes since `v11.1.0`.
@@ -222,7 +296,7 @@ requests outside `#session`, `LLM::Function#def` as a short alias for
222
296
  Fix block-form `model { ... }`, `tools { ... }`, and
223
297
  `schema { ... }` declarations in the ActiveRecord and Sequel agent
224
298
  wrappers so persisted agent models configure the internal agent class
225
- the same way as `LLM::Agent`.
299
+ the same way `LLM::Agent` does.
226
300
 
227
301
  * **Fix missing `skills` in ORM agent wrappers** <br>
228
302
  Fix the ActiveRecord and Sequel agent wrappers to expose `skills`, so
@@ -465,7 +539,7 @@ DSML tool-marker filtering in streamed text.
465
539
  blocks that Bedrock rejects.
466
540
 
467
541
  * **Suppress Bedrock DSML tool markers in streamed text** <br>
468
- Filter `\"<|DSML|function_calls\"` markers out of streamed Bedrock
542
+ Filter `"\u003c\u003cDSML\u003efunction_calls\u003e\u003e"` markers out of streamed Bedrock
469
543
  assistant text so tool-call sentinels do not leak into user-visible
470
544
  output.
471
545
 
@@ -475,7 +549,7 @@ Changes since `v7.0.0`.
475
549
 
476
550
  This release adds Unix-fork concurrency for process-isolated tool
477
551
  execution, extends `LLM::Object` with `#merge` and `#delete`, and drops
478
- Ruby 3.2 support due to segfaults observed with the `:fork` path. It
552
+ Ruby 3.2 support due to a segfault observed with the `:fork` path. It
479
553
  promotes `LLM::Pipe` to the top-level namespace and adds
480
554
  `persistent: true` on `LLM::MCP.http` for direct persistent transport
481
555
  configuration. `LLM::Function#runner` is exposed as public API, agent
@@ -616,7 +690,7 @@ provider usage has been recorded yet.
616
690
  buffer API.
617
691
 
618
692
  * **Support percentage compaction token thresholds** <br>
619
- Let `LLM::Compactor` accept `token_threshold:` values like `\"90%\"` so
693
+ Let `LLM::Compactor` accept `token_threshold:` values like `"90%"` so
620
694
  compaction can trigger at a percentage of the active model context
621
695
  window.
622
696
 
@@ -775,7 +849,7 @@ interruption use the active per-call stream correctly.
775
849
 
776
850
  * **Refresh provider model metadata** <br>
777
851
  Add current DeepSeek and OpenAI model metadata to `data/` and update the
778
- Google Gemma model entry to match the current provider naming.
852
+ Google Gemini model entry to match the current provider naming.
779
853
 
780
854
  ### Fix
781
855
 
@@ -1216,12 +1290,12 @@ Changes since `v4.14.0`.
1216
1290
  storage when Sequel JSON typecasting is enabled.
1217
1291
 
1218
1292
  * **Improve streaming parser performance** <br>
1219
- In the local replay-based `stream_parser` benchmark versus
1220
- `v4.14.0` (median of 20 samples, 5000 iterations), plain Ruby is a
1293
+ In the local replay-based `stream_parser` benchmark versus `v4.14.0`
1294
+ (median of 20 samples, 5000 iterations), plain Ruby is a
1221
1295
  small overall win: the generic eventstream path is about 0.4%
1222
1296
  faster, the OpenAI stream parser is about 0.5% faster, and the
1223
1297
  OpenAI Responses parser is about 1.6% faster, with unchanged
1224
- allocations. Under YJIT on the same benchmark, the generic
1298
+ allocations. Under YJIT on the same benchmark harness, the generic
1225
1299
  eventstream path is about 0.9% faster and the OpenAI stream parser
1226
1300
  is about 0.4% faster, while the OpenAI Responses parser is about
1227
1301
  0.7% slower, also with unchanged allocations.
@@ -1263,7 +1337,7 @@ parallel tool calls can safely share one connection.
1263
1337
  * **Reduce provider streaming allocations** <br>
1264
1338
  Decode streamed provider payloads directly in
1265
1339
  `LLM::Provider::Transport::HTTP` before handing them to provider
1266
- parsers, which cuts allocation churn and gives a smaller streaming
1340
+ parsers, which cuts allocation churn and gives a small streaming
1267
1341
  speed bump.
1268
1342
 
1269
1343
  * **Reduce generic SSE parser allocations** <br>
@@ -1399,7 +1473,7 @@ Changes since `v4.9.0`.
1399
1473
 
1400
1474
  - Add HTTP transport for MCP with `LLM::MCP::Transport::HTTP` for remote servers
1401
1475
  - Add JSON Schema union types (`any_of`, `all_of`, `one_of`) with parser integration
1402
- - Add JSON Schema type array union support (e.g., `\"type\": [\"object\", \"null\"]`)
1476
+ - Add JSON Schema type array union support (e.g., `"type": ["object", "null"]`)
1403
1477
  - Add JSON Schema type inference from `const`, `enum`, or `default` fields
1404
1478
 
1405
1479
  ### Change
@@ -1500,7 +1574,7 @@ Notable merged work in this range includes:
1500
1574
  - `Add rack + websocket example (#130)`
1501
1575
  - `feat(gemspec): add changelog URI (#136)`
1502
1576
  - `feat(function): alias ThreadGroup#wait as ThreadGroup#value (#62)`
1503
- - README and screencast refresh across `#66`, `#68`, `#71`, and
1577
+ - `README and screencast refresh across `#66`, `#68`, `#71`, and
1504
1578
  `#72`
1505
1579
  - `chore(bot): update deprecation warning from v5.0 to v6.0`
1506
1580
  - `fix(deepseek): tolerate malformed tool arguments`