llm.rb 0.12.0 → 0.14.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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -19
  3. data/lib/llm/bot/conversable.rb +12 -4
  4. data/lib/llm/bot/prompt/completion.rb +18 -0
  5. data/lib/llm/bot/prompt/respond.rb +9 -0
  6. data/lib/llm/bot.rb +3 -3
  7. data/lib/llm/buffer.rb +31 -7
  8. data/lib/llm/error.rb +4 -0
  9. data/lib/llm/file.rb +1 -1
  10. data/lib/llm/function.rb +2 -2
  11. data/lib/llm/mime.rb +92 -6
  12. data/lib/llm/provider.rb +4 -3
  13. data/lib/llm/providers/anthropic/error_handler.rb +2 -0
  14. data/lib/llm/providers/anthropic/files.rb +155 -0
  15. data/lib/llm/providers/anthropic/format/completion_format.rb +12 -2
  16. data/lib/llm/providers/anthropic/models.rb +2 -1
  17. data/lib/llm/providers/anthropic/response/enumerable.rb +11 -0
  18. data/lib/llm/providers/anthropic/response/file.rb +23 -0
  19. data/lib/llm/providers/anthropic.rb +11 -1
  20. data/lib/llm/providers/gemini/error_handler.rb +2 -0
  21. data/lib/llm/providers/gemini/files.rb +2 -1
  22. data/lib/llm/providers/gemini/models.rb +2 -1
  23. data/lib/llm/providers/gemini/response/completion.rb +2 -0
  24. data/lib/llm/providers/gemini/response/files.rb +15 -0
  25. data/lib/llm/providers/gemini/response/models.rb +15 -0
  26. data/lib/llm/providers/ollama/error_handler.rb +2 -0
  27. data/lib/llm/providers/openai/error_handler.rb +13 -1
  28. data/lib/llm/providers/openai/files.rb +2 -1
  29. data/lib/llm/providers/openai/models.rb +3 -1
  30. data/lib/llm/providers/openai/response/enumerable.rb +11 -0
  31. data/lib/llm/providers/openai/vector_stores.rb +5 -3
  32. data/lib/llm/providers/xai/images.rb +1 -1
  33. data/lib/llm/{json/schema → schema}/array.rb +3 -3
  34. data/lib/llm/{json/schema → schema}/boolean.rb +3 -3
  35. data/lib/llm/{json/schema → schema}/integer.rb +6 -6
  36. data/lib/llm/{json/schema → schema}/leaf.rb +9 -9
  37. data/lib/llm/{json/schema → schema}/null.rb +3 -3
  38. data/lib/llm/{json/schema → schema}/number.rb +6 -6
  39. data/lib/llm/{json/schema → schema}/object.rb +3 -3
  40. data/lib/llm/{json/schema → schema}/string.rb +5 -5
  41. data/lib/llm/{json/schema → schema}/version.rb +1 -1
  42. data/lib/llm/{json/schema.rb → schema.rb} +10 -13
  43. data/lib/llm/version.rb +1 -1
  44. data/lib/llm.rb +1 -1
  45. data/llm.gemspec +1 -1
  46. metadata +19 -13
data/lib/llm.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module LLM
4
4
  require "stringio"
5
- require_relative "llm/json/schema"
5
+ require_relative "llm/schema"
6
6
  require_relative "llm/object"
7
7
  require_relative "llm/version"
8
8
  require_relative "llm/utils"
data/llm.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  llm.rb is a zero-dependency Ruby toolkit for Large Language Models that
13
13
  includes OpenAI, Gemini, Anthropic, xAI (grok), DeepSeek, Ollama, and
14
14
  LlamaCpp. The toolkit includes full support for chat, streaming, tool calling,
15
- audio, images, files, and JSON Schema generation.
15
+ audio, images, files, and structured outputs (JSON Schema).
16
16
  SUMMARY
17
17
 
18
18
  spec.description = spec.summary
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: 0.12.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antar Azri
@@ -153,7 +153,7 @@ dependencies:
153
153
  description: llm.rb is a zero-dependency Ruby toolkit for Large Language Models that
154
154
  includes OpenAI, Gemini, Anthropic, xAI (grok), DeepSeek, Ollama, and LlamaCpp.
155
155
  The toolkit includes full support for chat, streaming, tool calling, audio, images,
156
- files, and JSON Schema generation.
156
+ files, and structured outputs (JSON Schema).
157
157
  email:
158
158
  - azantar@proton.me
159
159
  - 0x1eef@proton.me
@@ -177,16 +177,6 @@ files:
177
177
  - lib/llm/eventstream/parser.rb
178
178
  - lib/llm/file.rb
179
179
  - lib/llm/function.rb
180
- - lib/llm/json/schema.rb
181
- - lib/llm/json/schema/array.rb
182
- - lib/llm/json/schema/boolean.rb
183
- - lib/llm/json/schema/integer.rb
184
- - lib/llm/json/schema/leaf.rb
185
- - lib/llm/json/schema/null.rb
186
- - lib/llm/json/schema/number.rb
187
- - lib/llm/json/schema/object.rb
188
- - lib/llm/json/schema/string.rb
189
- - lib/llm/json/schema/version.rb
190
180
  - lib/llm/message.rb
191
181
  - lib/llm/mime.rb
192
182
  - lib/llm/multipart.rb
@@ -196,10 +186,13 @@ files:
196
186
  - lib/llm/provider.rb
197
187
  - lib/llm/providers/anthropic.rb
198
188
  - lib/llm/providers/anthropic/error_handler.rb
189
+ - lib/llm/providers/anthropic/files.rb
199
190
  - lib/llm/providers/anthropic/format.rb
200
191
  - lib/llm/providers/anthropic/format/completion_format.rb
201
192
  - lib/llm/providers/anthropic/models.rb
202
193
  - lib/llm/providers/anthropic/response/completion.rb
194
+ - lib/llm/providers/anthropic/response/enumerable.rb
195
+ - lib/llm/providers/anthropic/response/file.rb
203
196
  - lib/llm/providers/anthropic/stream_parser.rb
204
197
  - lib/llm/providers/deepseek.rb
205
198
  - lib/llm/providers/deepseek/format.rb
@@ -215,7 +208,9 @@ files:
215
208
  - lib/llm/providers/gemini/response/completion.rb
216
209
  - lib/llm/providers/gemini/response/embedding.rb
217
210
  - lib/llm/providers/gemini/response/file.rb
211
+ - lib/llm/providers/gemini/response/files.rb
218
212
  - lib/llm/providers/gemini/response/image.rb
213
+ - lib/llm/providers/gemini/response/models.rb
219
214
  - lib/llm/providers/gemini/stream_parser.rb
220
215
  - lib/llm/providers/llamacpp.rb
221
216
  - lib/llm/providers/ollama.rb
@@ -240,6 +235,7 @@ files:
240
235
  - lib/llm/providers/openai/response/audio.rb
241
236
  - lib/llm/providers/openai/response/completion.rb
242
237
  - lib/llm/providers/openai/response/embedding.rb
238
+ - lib/llm/providers/openai/response/enumerable.rb
243
239
  - lib/llm/providers/openai/response/file.rb
244
240
  - lib/llm/providers/openai/response/image.rb
245
241
  - lib/llm/providers/openai/response/moderations.rb
@@ -250,6 +246,16 @@ files:
250
246
  - lib/llm/providers/xai.rb
251
247
  - lib/llm/providers/xai/images.rb
252
248
  - lib/llm/response.rb
249
+ - lib/llm/schema.rb
250
+ - lib/llm/schema/array.rb
251
+ - lib/llm/schema/boolean.rb
252
+ - lib/llm/schema/integer.rb
253
+ - lib/llm/schema/leaf.rb
254
+ - lib/llm/schema/null.rb
255
+ - lib/llm/schema/number.rb
256
+ - lib/llm/schema/object.rb
257
+ - lib/llm/schema/string.rb
258
+ - lib/llm/schema/version.rb
253
259
  - lib/llm/utils.rb
254
260
  - lib/llm/version.rb
255
261
  - llm.gemspec
@@ -278,5 +284,5 @@ specification_version: 4
278
284
  summary: llm.rb is a zero-dependency Ruby toolkit for Large Language Models that includes
279
285
  OpenAI, Gemini, Anthropic, xAI (grok), DeepSeek, Ollama, and LlamaCpp. The toolkit
280
286
  includes full support for chat, streaming, tool calling, audio, images, files, and
281
- JSON Schema generation.
287
+ structured outputs (JSON Schema).
282
288
  test_files: []