llm.rb 12.2.0 → 12.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.
@@ -25,44 +25,126 @@ features that didn't make it into the homepage documentation.
25
25
 
26
26
  ## Table of contents
27
27
 
28
- - [Agents](#agents)
29
- - [As a subclass](#as-a-subclass)
30
- - [As an object](#as-an-object)
31
- - [Skills](#skills)
32
- - [SKILL.md](#skillmd)
33
- - [Run it](#run-it)
34
- - [MCP](#mcp)
35
- - [stdio](#stdio)
36
- - [http](#http)
37
- - [A2A](#a2a)
38
- - [rest](#rest)
39
- - [jsonrpc](#jsonrpc)
40
- - [Transports](#transports)
41
- - [net/http](#nethttp)
42
- - [net/http/persistent](#nethttppersistent)
43
- - [curb](#curb)
44
- - [Stream](#stream)
45
- - [IO-like object](#io-like-object)
46
- - [LLM::Stream](#llmstream)
47
- - [ORM](#orm)
48
- - [ActiveRecord](#activerecord)
49
- - [Sequel](#sequel)
50
- - [Schema](#schema)
51
- - [Estimation](#estimation)
52
- - [Cancellation](#cancellation)
53
- - [Cancel a request](#cancel-a-request)
54
- - [Tracer](#tracer)
55
- - [Provider-wide tracer](#provider-wide-tracer)
56
- - [Agent-local tracer](#agent-local-tracer)
57
- - [REPL](#repl)
58
- - [LLM::Agent](#llmagent)
59
- - [Images](#images)
60
- - [Generation](#generation)
61
- - [Edits](#edits)
62
- - [Audio](#audio)
63
- - [text-to-speech](#text-to-speech)
64
- - [speech-to-text](#speech-to-text)
65
- - [translation](#translation)
28
+ **Overview**
29
+
30
+ - [Welcome](#welcome)
31
+
32
+ **Core**
33
+
34
+ <details>
35
+ <summary>Agents</summary>
36
+
37
+ - [As a subclass](#as-a-subclass)
38
+ - [As an object](#as-an-object)
39
+ </details>
40
+
41
+ <details>
42
+ <summary>Tools</summary>
43
+
44
+ - [LLM::Tool](#llmtool)
45
+ - [Errors](#errors)
46
+ </details>
47
+
48
+ <details>
49
+ <summary>Skills</summary>
50
+
51
+ - [SKILL.md](#skillmd)
52
+ - [Run it](#run-it)
53
+ </details>
54
+
55
+ <details>
56
+ <summary>Schema</summary>
57
+
58
+ - [Estimation](#estimation)
59
+ </details>
60
+
61
+ **Runtime**
62
+
63
+ <details>
64
+ <summary>Stream</summary>
65
+
66
+ - [IO-like object](#io-like-object)
67
+ - [LLM::Stream](#llmstream)
68
+ </details>
69
+
70
+ <details>
71
+ <summary>Cancellation</summary>
72
+
73
+ - [Cancel a request](#cancel-a-request)
74
+ </details>
75
+
76
+ <details>
77
+ <summary>Transports</summary>
78
+
79
+ - [net/http](#nethttp)
80
+ - [net/http/persistent](#nethttppersistent)
81
+ - [curb](#curb)
82
+ </details>
83
+
84
+ <details>
85
+ <summary>Tracer</summary>
86
+
87
+ - [Provider-wide tracer](#provider-wide-tracer)
88
+ - [Agent-local tracer](#agent-local-tracer)
89
+ </details>
90
+
91
+ <details>
92
+ <summary>REPL</summary>
93
+
94
+ - [LLM::Agent](#llmagent)
95
+ - [Tools](#tools)
96
+ - [Skills](#skills-1)
97
+ - [Tracer](#tracer-1)
98
+ </details>
99
+
100
+ **Persistence**
101
+
102
+ <details>
103
+ <summary>Serialization</summary>
104
+
105
+ - [Save to disk](#save-to-disk)
106
+ </details>
107
+
108
+ <details>
109
+ <summary>ORM</summary>
110
+
111
+ - [ActiveRecord](#activerecord)
112
+ - [Sequel](#sequel)
113
+ </details>
114
+
115
+ **Media**
116
+
117
+ <details>
118
+ <summary>Images</summary>
119
+
120
+ - [Generation](#generation)
121
+ - [Edits](#edits)
122
+ - [DeepSeek](#deepseek)
123
+ </details>
124
+
125
+ <details>
126
+ <summary>Audio</summary>
127
+
128
+ - [text-to-speech](#text-to-speech)
129
+ - [speech-to-text](#speech-to-text)
130
+ - [translation](#translation)
131
+ </details>
132
+
133
+ **Protocols**
134
+
135
+ <details>
136
+ <summary>MCP</summary>
137
+
138
+ - [stdio](#stdio)
139
+ - [http](#http)
140
+ </details>
141
+
142
+ <details>
143
+ <summary>A2A</summary>
144
+
145
+ - [rest](#rest)
146
+ - [jsonrpc](#jsonrpc)
147
+ </details>
66
148
 
67
149
  ## Agents
68
150
 
@@ -808,21 +890,22 @@ agent = LLM::Agent.new(llm, tracer: LLM::Tracer::Logger.new(llm, path: "deepseek
808
890
 
809
891
  During the development and operation of agents it can often
810
892
  be helpful to drop into a read-eval-print loop. This gives
811
- you a simple way to confirm the work was successful, inspect
812
- anything that went wrong (for example, tool call errors), and
813
- keep talking to the same agent so you can learn about its
814
- decision-making process and make improvements for future runs.
815
- It can also be used to ask the agent to correct any errors
816
- that might have made.
893
+ you a way to confirm the work was successful, inspect
894
+ anything that went wrong, and keep talking to the same
895
+ agent while its state is still intact.
817
896
 
818
- ##### LLM::Agent
897
+ #### LLM::Agent
819
898
 
820
899
  The [LLM::Agent#repl](https://r.uby.dev/api-docs/llm.rb/LLM/Agent.html#repl-instance_method)
821
- method requires the [curses](https://github.com/ruby/curses)
822
- gem to be installed and available for require. It is an
823
- optional dependency that only becomes required when you
824
- call the [LLM::Agent#repl](https://r.uby.dev/api-docs/llm.rb/LLM/Agent.html#repl-instance_method)
825
- method.
900
+ method allows an agent to spawn a read-eval-print loop
901
+ that can be useful while developing or operating agents.
902
+ It can be used to debug tool calls, confirm an
903
+ agent has done what was expected, or improve an agent by
904
+ asking questions about what it has done up to that point.
905
+
906
+ This feature requires that the [curses](https://github.com/ruby/curses)
907
+ and [kramdown](https://github.com/gettalong/kramdown) libraries are
908
+ installed and available to require.
826
909
 
827
910
  ```ruby
828
911
  require "llm"
@@ -832,6 +915,43 @@ agent = LLM::Agent.new(llm)
832
915
  agent.repl
833
916
  ```
834
917
 
918
+ #### Tools
919
+
920
+ The read-eval-print loop accepts a `tools` option that lets
921
+ you attach additional tools for the duration of the session.
922
+
923
+ ```ruby
924
+ llm = LLM.deepseek(key: ENV["KEY"])
925
+ agent = LLM::Agent.new(llm)
926
+ agent.repl(tools: [Debugger])
927
+ ```
928
+
929
+ #### Skills
930
+
931
+ The read-eval-print loop also accepts a `skills` option.
932
+ This can be useful when you want to load extra skills
933
+ without attaching them to an agent permanently.
934
+
935
+ ```ruby
936
+ llm = LLM.deepseek(key: ENV["KEY"])
937
+ agent = LLM::Agent.new(llm)
938
+ agent.repl(skills: [__dir__])
939
+ ```
940
+
941
+ #### Tracer
942
+
943
+ By default the tracer is disabled for the duration of the
944
+ session. This can be configured through the
945
+ `tracer` option. Setting it to `true` will configure
946
+ the REPL to use the tracer associated with an instance
947
+ of [`LLM::Agent`](https://r.uby.dev/api-docs/llm.rb/LLM/Agent.html).
948
+
949
+ ```ruby
950
+ llm = LLM.deepseek(key: ENV["KEY"])
951
+ agent = LLM::Agent.new(llm, tracer: LLM.logger(llm, path: "agent.log"))
952
+ agent.repl(tracer: true, tools: [Debugger])
953
+ ```
954
+
835
955
  [Back to top](#table-of-contents)
836
956
 
837
957
  ## Images
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.2.0
4
+ version: 12.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - robert
@@ -277,8 +277,11 @@ dependencies:
277
277
  - - "~>"
278
278
  - !ruby/object:Gem::Version
279
279
  version: '1.18'
280
- description: llm.rb is not a library, framework or toolkit but an advanced runtime
281
- for building highly capable AI applications on CRuby.
280
+ description: |
281
+ llm.rb is an advanced runtime for building capable AI applications
282
+ on CRuby. By default it has zero runtime dependencies although certain
283
+ functionality &ndash; such as ActiveRecord support &ndash; require
284
+ optional dependencies that are opt-in.
282
285
  email:
283
286
  - robert@r.uby.dev
284
287
  executables: []
@@ -464,7 +467,9 @@ files:
464
467
  - lib/llm/providers/zai.rb
465
468
  - lib/llm/registry.rb
466
469
  - lib/llm/repl.rb
470
+ - lib/llm/repl/bar.rb
467
471
  - lib/llm/repl/input.rb
472
+ - lib/llm/repl/markdown.rb
468
473
  - lib/llm/repl/status.rb
469
474
  - lib/llm/repl/stream.rb
470
475
  - lib/llm/repl/transcript.rb
@@ -492,6 +497,8 @@ files:
492
497
  - lib/llm/session.rb
493
498
  - lib/llm/skill.rb
494
499
  - lib/llm/stream.rb
500
+ - lib/llm/stream/disabled.rb
501
+ - lib/llm/stream/io.rb
495
502
  - lib/llm/stream/queue.rb
496
503
  - lib/llm/tool.rb
497
504
  - lib/llm/tool/param.rb