ruby_llm 2.0.0 → 2.1.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 (287) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +67 -8
  3. data/lib/generators/ruby_llm/generator_helpers.rb +68 -6
  4. data/lib/generators/ruby_llm/install/templates/create_messages_migration.rb.tt +1 -0
  5. data/lib/generators/ruby_llm/install/templates/create_ruby_llm_records_migration.rb.tt +36 -3
  6. data/lib/generators/ruby_llm/provider/scaffold.rb +32 -22
  7. data/lib/generators/ruby_llm/provider/templates/gem/ci.yml.erb +1 -5
  8. data/lib/generators/ruby_llm/provider/templates/gem/gemfile.erb +1 -1
  9. data/lib/generators/ruby_llm/provider/templates/gem/gemspec.erb +1 -1
  10. data/lib/generators/ruby_llm/provider/templates/gem/rubocop.yml.erb +1 -1
  11. data/lib/generators/ruby_llm/upgrade/templates/upgrade_ruby_llm_to_2_1.rb.tt +78 -0
  12. data/lib/generators/ruby_llm/upgrade/upgrade_generator.rb +6 -163
  13. data/lib/ruby_llm/accounting/usage.rb +86 -49
  14. data/lib/ruby_llm/active_record/acts_as.rb +3 -0
  15. data/lib/ruby_llm/active_record/attachment_helpers.rb +50 -25
  16. data/lib/ruby_llm/active_record/batch.rb +1 -1
  17. data/lib/ruby_llm/active_record/chat_methods.rb +143 -43
  18. data/lib/ruby_llm/active_record/mcp_credential.rb +41 -0
  19. data/lib/ruby_llm/active_record/message_methods.rb +32 -7
  20. data/lib/ruby_llm/active_record/model.rb +1 -1
  21. data/lib/ruby_llm/active_record/provider_file.rb +64 -0
  22. data/lib/ruby_llm/active_record/record.rb +19 -0
  23. data/lib/ruby_llm/active_record/tool_call.rb +1 -1
  24. data/lib/ruby_llm/active_record/usage.rb +53 -3
  25. data/lib/ruby_llm/agent.rb +198 -33
  26. data/lib/ruby_llm/aliases.json +66 -8
  27. data/lib/ruby_llm/attachment.rb +54 -10
  28. data/lib/ruby_llm/batch.rb +26 -3
  29. data/lib/ruby_llm/chat/tool_concurrency.rb +47 -23
  30. data/lib/ruby_llm/chat/tool_search.rb +26 -0
  31. data/lib/ruby_llm/chat.rb +492 -82
  32. data/lib/ruby_llm/choice.rb +38 -0
  33. data/lib/ruby_llm/configuration.rb +36 -11
  34. data/lib/ruby_llm/context.rb +45 -32
  35. data/lib/ruby_llm/cost.rb +42 -1
  36. data/lib/ruby_llm/embedding.rb +9 -2
  37. data/lib/ruby_llm/error.rb +34 -2
  38. data/lib/ruby_llm/evaluation/assertions.rb +40 -0
  39. data/lib/ruby_llm/evaluation/case.rb +52 -0
  40. data/lib/ruby_llm/evaluation/dataset.rb +65 -0
  41. data/lib/ruby_llm/evaluation/evaluator.rb +126 -0
  42. data/lib/ruby_llm/evaluation/evidence.rb +125 -0
  43. data/lib/ruby_llm/evaluation/minitest.rb +26 -0
  44. data/lib/ruby_llm/evaluation/report.rb +103 -0
  45. data/lib/ruby_llm/evaluation/result.rb +75 -0
  46. data/lib/ruby_llm/evaluation/reviewer.rb +20 -0
  47. data/lib/ruby_llm/evaluation/rspec.rb +23 -0
  48. data/lib/ruby_llm/evaluation/runner.rb +93 -0
  49. data/lib/ruby_llm/evaluation/trial.rb +101 -0
  50. data/lib/ruby_llm/evaluation.rb +289 -0
  51. data/lib/ruby_llm/image.rb +12 -4
  52. data/lib/ruby_llm/judge/builder.rb +51 -0
  53. data/lib/ruby_llm/judge/data.rb +43 -0
  54. data/lib/ruby_llm/judge/question.rb +101 -0
  55. data/lib/ruby_llm/judge.rb +179 -0
  56. data/lib/ruby_llm/judgment.rb +125 -0
  57. data/lib/ruby_llm/mcp/apps.rb +25 -0
  58. data/lib/ruby_llm/mcp/client.rb +226 -0
  59. data/lib/ruby_llm/mcp/collection.rb +56 -0
  60. data/lib/ruby_llm/mcp/content.rb +44 -0
  61. data/lib/ruby_llm/mcp/error.rb +27 -0
  62. data/lib/ruby_llm/mcp/http.rb +379 -0
  63. data/lib/ruby_llm/mcp/input_request.rb +118 -0
  64. data/lib/ruby_llm/mcp/input_required_error.rb +29 -0
  65. data/lib/ruby_llm/mcp/listener.rb +168 -0
  66. data/lib/ruby_llm/mcp/oauth/key.rb +78 -0
  67. data/lib/ruby_llm/mcp/oauth/memory_store.rb +28 -0
  68. data/lib/ruby_llm/mcp/oauth/proofs.rb +39 -0
  69. data/lib/ruby_llm/mcp/oauth.rb +653 -0
  70. data/lib/ruby_llm/mcp/param_headers.rb +83 -0
  71. data/lib/ruby_llm/mcp/prompt.rb +71 -0
  72. data/lib/ruby_llm/mcp/resource.rb +84 -0
  73. data/lib/ruby_llm/mcp/resource_template.rb +99 -0
  74. data/lib/ruby_llm/mcp/result.rb +76 -0
  75. data/lib/ruby_llm/mcp/session_expired.rb +10 -0
  76. data/lib/ruby_llm/mcp/stdio.rb +250 -0
  77. data/lib/ruby_llm/mcp/task.rb +151 -0
  78. data/lib/ruby_llm/mcp/tool.rb +130 -0
  79. data/lib/ruby_llm/mcp.rb +1101 -0
  80. data/lib/ruby_llm/message.rb +41 -6
  81. data/lib/ruby_llm/model.rb +2 -1
  82. data/lib/ruby_llm/models/aliases.rb +5 -2
  83. data/lib/ruby_llm/models/lookup.rb +80 -0
  84. data/lib/ruby_llm/models/registry.rb +2 -2
  85. data/lib/ruby_llm/models/schema.rb +1 -1
  86. data/lib/ruby_llm/models.json +23082 -10158
  87. data/lib/ruby_llm/models.rb +20 -69
  88. data/lib/ruby_llm/moderation.rb +7 -2
  89. data/lib/ruby_llm/ocr.rb +7 -2
  90. data/lib/ruby_llm/open_telemetry/attributes.rb +111 -0
  91. data/lib/ruby_llm/open_telemetry.rb +82 -0
  92. data/lib/ruby_llm/probability.rb +30 -0
  93. data/lib/ruby_llm/progress.rb +44 -0
  94. data/lib/ruby_llm/prompt/context.rb +55 -0
  95. data/lib/ruby_llm/prompt.rb +1 -1
  96. data/lib/ruby_llm/protocol/binary_streaming.rb +1 -1
  97. data/lib/ruby_llm/protocol/request_shapes/analysis.rb +190 -0
  98. data/lib/ruby_llm/protocol/request_shapes.rb +183 -0
  99. data/lib/ruby_llm/protocol/stored_uploads.rb +62 -0
  100. data/lib/ruby_llm/protocol/stream_accumulator.rb +9 -25
  101. data/lib/ruby_llm/protocol/streaming.rb +38 -31
  102. data/lib/ruby_llm/protocol.rb +196 -40
  103. data/lib/ruby_llm/protocols/anthropic/chat.rb +39 -32
  104. data/lib/ruby_llm/protocols/anthropic/media.rb +6 -2
  105. data/lib/ruby_llm/protocols/anthropic/models.rb +16 -1
  106. data/lib/ruby_llm/protocols/anthropic/request_shapes.rb +70 -0
  107. data/lib/ruby_llm/protocols/anthropic/streaming.rb +23 -9
  108. data/lib/ruby_llm/protocols/anthropic/tools.rb +43 -0
  109. data/lib/ruby_llm/protocols/anthropic.rb +20 -1
  110. data/lib/ruby_llm/protocols/bedrock/async_videos.rb +9 -17
  111. data/lib/ruby_llm/protocols/bedrock/guardrails.rb +8 -9
  112. data/lib/ruby_llm/protocols/bedrock/rerank.rb +1 -17
  113. data/lib/ruby_llm/protocols/chat_completions/chat.rb +5 -7
  114. data/lib/ruby_llm/protocols/chat_completions/embedding_batches.rb +21 -0
  115. data/lib/ruby_llm/protocols/chat_completions/media.rb +34 -8
  116. data/lib/ruby_llm/protocols/chat_completions/request_shapes.rb +121 -0
  117. data/lib/ruby_llm/protocols/chat_completions/streaming.rb +3 -0
  118. data/lib/ruby_llm/protocols/chat_completions.rb +1 -0
  119. data/lib/ruby_llm/protocols/cohere/batch_requests.rb +0 -5
  120. data/lib/ruby_llm/protocols/cohere/batches.rb +3 -7
  121. data/lib/ruby_llm/protocols/cohere/chat.rb +8 -0
  122. data/lib/ruby_llm/protocols/cohere/embeddings.rb +7 -4
  123. data/lib/ruby_llm/protocols/cohere/media.rb +6 -2
  124. data/lib/ruby_llm/protocols/cohere/ocr.rb +1 -1
  125. data/lib/ruby_llm/protocols/cohere/streaming.rb +1 -0
  126. data/lib/ruby_llm/protocols/cohere/tools.rb +5 -1
  127. data/lib/ruby_llm/protocols/cohere.rb +1 -0
  128. data/lib/ruby_llm/protocols/converse/chat.rb +22 -131
  129. data/lib/ruby_llm/protocols/converse/media.rb +16 -2
  130. data/lib/ruby_llm/protocols/converse/reasoning.rb +194 -0
  131. data/lib/ruby_llm/protocols/converse/request_shapes.rb +99 -0
  132. data/lib/ruby_llm/protocols/converse/streaming.rb +2 -2
  133. data/lib/ruby_llm/protocols/converse/thinking_stream.rb +2 -1
  134. data/lib/ruby_llm/protocols/converse.rb +3 -5
  135. data/lib/ruby_llm/protocols/deepseek/files.rb +2 -9
  136. data/lib/ruby_llm/protocols/elevenlabs/flows/images.rb +1 -7
  137. data/lib/ruby_llm/protocols/elevenlabs/flows/videos.rb +11 -17
  138. data/lib/ruby_llm/protocols/elevenlabs/streaming_transcription.rb +1 -4
  139. data/lib/ruby_llm/protocols/gemini/chat.rb +50 -21
  140. data/lib/ruby_llm/protocols/gemini/embeddings.rb +2 -2
  141. data/lib/ruby_llm/protocols/gemini/files.rb +1 -1
  142. data/lib/ruby_llm/protocols/gemini/images.rb +5 -1
  143. data/lib/ruby_llm/protocols/gemini/media.rb +15 -3
  144. data/lib/ruby_llm/protocols/gemini/request_shapes.rb +111 -0
  145. data/lib/ruby_llm/protocols/gemini/streaming.rb +2 -1
  146. data/lib/ruby_llm/protocols/gemini/tools.rb +17 -11
  147. data/lib/ruby_llm/protocols/gemini/transcription.rb +13 -0
  148. data/lib/ruby_llm/protocols/gemini/videos.rb +7 -2
  149. data/lib/ruby_llm/protocols/gemini.rb +1 -0
  150. data/lib/ruby_llm/protocols/gpustack/videos.rb +7 -9
  151. data/lib/ruby_llm/protocols/interactions/chat.rb +46 -18
  152. data/lib/ruby_llm/protocols/interactions/content.rb +9 -2
  153. data/lib/ruby_llm/protocols/interactions/request_shapes.rb +62 -0
  154. data/lib/ruby_llm/protocols/interactions/streaming.rb +15 -0
  155. data/lib/ruby_llm/protocols/interactions/tools.rb +28 -4
  156. data/lib/ruby_llm/protocols/interactions/transcription.rb +1 -11
  157. data/lib/ruby_llm/protocols/interactions.rb +1 -0
  158. data/lib/ruby_llm/protocols/invoke_model/cohere_embeddings.rb +2 -11
  159. data/lib/ruby_llm/protocols/invoke_model/embedding_batches.rb +2 -2
  160. data/lib/ruby_llm/protocols/invoke_model/stability_images.rb +2 -6
  161. data/lib/ruby_llm/protocols/invoke_model/titan_text_embeddings.rb +2 -8
  162. data/lib/ruby_llm/protocols/invoke_model.rb +1 -4
  163. data/lib/ruby_llm/protocols/mistral/content.rb +13 -0
  164. data/lib/ruby_llm/protocols/mistral/conversations/chat.rb +11 -1
  165. data/lib/ruby_llm/protocols/mistral/conversations/images.rb +5 -1
  166. data/lib/ruby_llm/protocols/mistral/conversations/request_shapes.rb +45 -0
  167. data/lib/ruby_llm/protocols/mistral/conversations.rb +1 -0
  168. data/lib/ruby_llm/protocols/mistral/multi_completion.rb +11 -1
  169. data/lib/ruby_llm/protocols/openai/decisions.rb +135 -0
  170. data/lib/ruby_llm/protocols/openai/files.rb +0 -7
  171. data/lib/ruby_llm/protocols/openrouter/batches.rb +13 -8
  172. data/lib/ruby_llm/protocols/openrouter/responses.rb +5 -1
  173. data/lib/ruby_llm/protocols/perplexity/agent.rb +116 -0
  174. data/lib/ruby_llm/protocols/perplexity/router.rb +2 -43
  175. data/lib/ruby_llm/protocols/responses/chat.rb +56 -22
  176. data/lib/ruby_llm/protocols/responses/media.rb +11 -7
  177. data/lib/ruby_llm/protocols/responses/request_shapes.rb +70 -0
  178. data/lib/ruby_llm/protocols/responses/streaming.rb +23 -7
  179. data/lib/ruby_llm/protocols/responses/token_counting.rb +2 -2
  180. data/lib/ruby_llm/protocols/responses/tools.rb +27 -0
  181. data/lib/ruby_llm/protocols/responses.rb +1 -0
  182. data/lib/ruby_llm/protocols/system_one/judgments.rb +42 -0
  183. data/lib/ruby_llm/protocols/system_one/models.rb +27 -0
  184. data/lib/ruby_llm/protocols/system_one/responses.rb +55 -0
  185. data/lib/ruby_llm/protocols/system_one.rb +27 -0
  186. data/lib/ruby_llm/protocols/vertexai/embedding_prediction/requests.rb +2 -2
  187. data/lib/ruby_llm/protocols/vertexai/files.rb +34 -6
  188. data/lib/ruby_llm/protocols/vertexai/ranking.rb +9 -30
  189. data/lib/ruby_llm/protocols/vertexai/research.rb +9 -41
  190. data/lib/ruby_llm/protocols/xai/streaming_transcription.rb +2 -5
  191. data/lib/ruby_llm/provider.rb +87 -15
  192. data/lib/ruby_llm/providers/anthropic.rb +23 -0
  193. data/lib/ruby_llm/providers/azure/chat.rb +4 -0
  194. data/lib/ruby_llm/providers/azure/images.rb +2 -2
  195. data/lib/ruby_llm/providers/azure/media.rb +8 -3
  196. data/lib/ruby_llm/providers/azure/videos.rb +7 -2
  197. data/lib/ruby_llm/providers/azure.rb +24 -4
  198. data/lib/ruby_llm/providers/bedrock/auth.rb +1 -1
  199. data/lib/ruby_llm/providers/bedrock/mantle/anthropic.rb +1 -1
  200. data/lib/ruby_llm/providers/bedrock/mantle/voxtral.rb +1 -3
  201. data/lib/ruby_llm/providers/bedrock/mantle.rb +5 -9
  202. data/lib/ruby_llm/providers/bedrock/models.rb +1 -2
  203. data/lib/ruby_llm/providers/bedrock.rb +38 -6
  204. data/lib/ruby_llm/providers/deepseek/chat.rb +6 -1
  205. data/lib/ruby_llm/providers/deepseek/responses.rb +6 -0
  206. data/lib/ruby_llm/providers/deepseek.rb +4 -0
  207. data/lib/ruby_llm/providers/gemini.rb +4 -0
  208. data/lib/ruby_llm/providers/gpustack/media.rb +8 -5
  209. data/lib/ruby_llm/providers/hetzner/chat.rb +39 -0
  210. data/lib/ruby_llm/providers/hetzner.rb +41 -0
  211. data/lib/ruby_llm/providers/mistral/chat.rb +16 -12
  212. data/lib/ruby_llm/providers/mistral/chat_completions/batches.rb +17 -3
  213. data/lib/ruby_llm/providers/mistral/media.rb +8 -4
  214. data/lib/ruby_llm/providers/mistral/ocr.rb +1 -5
  215. data/lib/ruby_llm/providers/ollama/judgments.rb +26 -0
  216. data/lib/ruby_llm/providers/ollama/media.rb +6 -2
  217. data/lib/ruby_llm/providers/ollama/models.rb +2 -0
  218. data/lib/ruby_llm/providers/ollama.rb +11 -0
  219. data/lib/ruby_llm/providers/openai/capabilities.rb +3 -1
  220. data/lib/ruby_llm/providers/openai.rb +14 -0
  221. data/lib/ruby_llm/providers/openrouter/chat.rb +20 -24
  222. data/lib/ruby_llm/providers/openrouter/embeddings.rb +2 -0
  223. data/lib/ruby_llm/providers/openrouter/media.rb +5 -1
  224. data/lib/ruby_llm/providers/openrouter/streaming.rb +4 -1
  225. data/lib/ruby_llm/providers/openrouter/videos.rb +10 -5
  226. data/lib/ruby_llm/providers/openrouter.rb +4 -0
  227. data/lib/ruby_llm/providers/perplexity/chat.rb +4 -0
  228. data/lib/ruby_llm/providers/perplexity/media.rb +5 -11
  229. data/lib/ruby_llm/providers/perplexity/models.rb +8 -4
  230. data/lib/ruby_llm/providers/perplexity.rb +11 -0
  231. data/lib/ruby_llm/providers/typesafe.rb +32 -0
  232. data/lib/ruby_llm/providers/vertexai/credentials.rb +63 -0
  233. data/lib/ruby_llm/providers/vertexai/gemini.rb +2 -2
  234. data/lib/ruby_llm/providers/vertexai/transcription.rb +1 -0
  235. data/lib/ruby_llm/providers/vertexai.rb +27 -28
  236. data/lib/ruby_llm/providers/xai/chat.rb +6 -0
  237. data/lib/ruby_llm/providers/xai/images.rb +9 -10
  238. data/lib/ruby_llm/providers/xai/responses.rb +10 -8
  239. data/lib/ruby_llm/providers/xai/videos.rb +11 -9
  240. data/lib/ruby_llm/providers/xai.rb +4 -0
  241. data/lib/ruby_llm/railtie.rb +11 -0
  242. data/lib/ruby_llm/request_shape/part.rb +117 -0
  243. data/lib/ruby_llm/request_shape/problem.rb +63 -0
  244. data/lib/ruby_llm/request_shape/tool_round.rb +64 -0
  245. data/lib/ruby_llm/request_shape/turn.rb +54 -0
  246. data/lib/ruby_llm/request_shape.rb +160 -0
  247. data/lib/ruby_llm/rerank.rb +9 -2
  248. data/lib/ruby_llm/research_job.rb +21 -5
  249. data/lib/ruby_llm/score.rb +42 -0
  250. data/lib/ruby_llm/search_results.rb +2 -2
  251. data/lib/ruby_llm/server_tool_call.rb +10 -2
  252. data/lib/ruby_llm/speech.rb +8 -1
  253. data/lib/ruby_llm/support/cancellation.rb +39 -0
  254. data/lib/ruby_llm/support/inspectable.rb +3 -2
  255. data/lib/ruby_llm/support/instrumentation.rb +38 -1
  256. data/lib/ruby_llm/support/process_cache.rb +60 -0
  257. data/lib/ruby_llm/support/progress_reporter.rb +33 -0
  258. data/lib/ruby_llm/thinking.rb +2 -1
  259. data/lib/ruby_llm/tokens.rb +57 -14
  260. data/lib/ruby_llm/tool.rb +50 -3
  261. data/lib/ruby_llm/tool_call.rb +17 -2
  262. data/lib/ruby_llm/transcription.rb +10 -3
  263. data/lib/ruby_llm/transport/connection.rb +127 -44
  264. data/lib/ruby_llm/transport/error_middleware.rb +90 -24
  265. data/lib/ruby_llm/transport/event_stream_parser.rb +121 -0
  266. data/lib/ruby_llm/transport/json_response.rb +33 -0
  267. data/lib/ruby_llm/transport/signing_middleware.rb +29 -0
  268. data/lib/ruby_llm/version.rb +1 -1
  269. data/lib/ruby_llm/video.rb +5 -3
  270. data/lib/ruby_llm/video_job.rb +48 -5
  271. data/lib/ruby_llm.rb +106 -5
  272. data/lib/tasks/ruby_llm/evaluations.rb +43 -0
  273. data/lib/tasks/ruby_llm.rake +6 -9
  274. data/skills/rubyllm/SKILL.md +33 -12
  275. metadata +101 -37
  276. data/lib/generators/ruby_llm/upgrade/legacy_content_sql.rb +0 -34
  277. data/lib/generators/ruby_llm/upgrade/online_copy_migration/data.rb +0 -341
  278. data/lib/generators/ruby_llm/upgrade/online_copy_migration/journal.rb +0 -171
  279. data/lib/generators/ruby_llm/upgrade/online_copy_migration/verification.rb +0 -197
  280. data/lib/generators/ruby_llm/upgrade/online_copy_migration.rb +0 -174
  281. data/lib/generators/ruby_llm/upgrade/templates/backfill_v2_data.rb.tt +0 -468
  282. data/lib/generators/ruby_llm/upgrade/templates/cleanup_v2_upgrade.rb.tt +0 -101
  283. data/lib/generators/ruby_llm/upgrade/templates/finish_v2_upgrade.rb.tt +0 -247
  284. data/lib/generators/ruby_llm/upgrade/templates/prepare_v2_upgrade.rb.tt +0 -662
  285. data/lib/generators/ruby_llm/upgrade/templates/ruby_llm_upgrade.rb.tt +0 -251
  286. data/lib/generators/ruby_llm/upgrade/templates/upgrade_initializer.rb.tt +0 -13
  287. data/lib/generators/ruby_llm/upgrade/upgrade_migration.rb +0 -359
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carmine Paolino
@@ -23,20 +23,6 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
- - !ruby/object:Gem::Dependency
27
- name: event_stream_parser
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '1'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1'
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: faraday
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +30,9 @@ dependencies:
44
30
  - - ">="
45
31
  - !ruby/object:Gem::Version
46
32
  version: 1.10.0
33
+ - - "!="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.0.0
47
36
  type: :runtime
48
37
  prerelease: false
49
38
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,6 +40,9 @@ dependencies:
51
40
  - - ">="
52
41
  - !ruby/object:Gem::Version
53
42
  version: 1.10.0
43
+ - - "!="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.0
54
46
  - !ruby/object:Gem::Dependency
55
47
  name: faraday-multipart
56
48
  requirement: !ruby/object:Gem::Requirement
@@ -99,14 +91,14 @@ dependencies:
99
91
  requirements:
100
92
  - - "<"
101
93
  - !ruby/object:Gem::Version
102
- version: '3'
94
+ version: '4'
103
95
  type: :runtime
104
96
  prerelease: false
105
97
  version_requirements: !ruby/object:Gem::Requirement
106
98
  requirements:
107
99
  - - "<"
108
100
  - !ruby/object:Gem::Version
109
- version: '3'
101
+ version: '4'
110
102
  - !ruby/object:Gem::Dependency
111
103
  name: marcel
112
104
  requirement: !ruby/object:Gem::Requirement
@@ -275,28 +267,20 @@ files:
275
267
  - lib/generators/ruby_llm/tool/templates/tool_call.html.erb.tt
276
268
  - lib/generators/ruby_llm/tool/templates/tool_result.html.erb.tt
277
269
  - lib/generators/ruby_llm/tool/tool_generator.rb
278
- - lib/generators/ruby_llm/upgrade/legacy_content_sql.rb
279
- - lib/generators/ruby_llm/upgrade/online_copy_migration.rb
280
- - lib/generators/ruby_llm/upgrade/online_copy_migration/data.rb
281
- - lib/generators/ruby_llm/upgrade/online_copy_migration/journal.rb
282
- - lib/generators/ruby_llm/upgrade/online_copy_migration/verification.rb
283
- - lib/generators/ruby_llm/upgrade/templates/backfill_v2_data.rb.tt
284
- - lib/generators/ruby_llm/upgrade/templates/cleanup_v2_upgrade.rb.tt
285
- - lib/generators/ruby_llm/upgrade/templates/finish_v2_upgrade.rb.tt
286
- - lib/generators/ruby_llm/upgrade/templates/prepare_v2_upgrade.rb.tt
287
- - lib/generators/ruby_llm/upgrade/templates/ruby_llm_upgrade.rb.tt
288
- - lib/generators/ruby_llm/upgrade/templates/upgrade_initializer.rb.tt
270
+ - lib/generators/ruby_llm/upgrade/templates/upgrade_ruby_llm_to_2_1.rb.tt
289
271
  - lib/generators/ruby_llm/upgrade/upgrade_generator.rb
290
- - lib/generators/ruby_llm/upgrade/upgrade_migration.rb
291
272
  - lib/ruby_llm.rb
292
273
  - lib/ruby_llm/accounting/usage.rb
293
274
  - lib/ruby_llm/active_record/acts_as.rb
294
275
  - lib/ruby_llm/active_record/attachment_helpers.rb
295
276
  - lib/ruby_llm/active_record/batch.rb
296
277
  - lib/ruby_llm/active_record/chat_methods.rb
278
+ - lib/ruby_llm/active_record/mcp_credential.rb
297
279
  - lib/ruby_llm/active_record/message_methods.rb
298
280
  - lib/ruby_llm/active_record/model.rb
299
281
  - lib/ruby_llm/active_record/payload_helpers.rb
282
+ - lib/ruby_llm/active_record/provider_file.rb
283
+ - lib/ruby_llm/active_record/record.rb
300
284
  - lib/ruby_llm/active_record/tool_call.rb
301
285
  - lib/ruby_llm/active_record/usage.rb
302
286
  - lib/ruby_llm/agent.rb
@@ -306,6 +290,8 @@ files:
306
290
  - lib/ruby_llm/cached_content.rb
307
291
  - lib/ruby_llm/chat.rb
308
292
  - lib/ruby_llm/chat/tool_concurrency.rb
293
+ - lib/ruby_llm/chat/tool_search.rb
294
+ - lib/ruby_llm/choice.rb
309
295
  - lib/ruby_llm/chunk.rb
310
296
  - lib/ruby_llm/citation.rb
311
297
  - lib/ruby_llm/configuration.rb
@@ -315,9 +301,50 @@ files:
315
301
  - lib/ruby_llm/embedding.rb
316
302
  - lib/ruby_llm/embedding_request.rb
317
303
  - lib/ruby_llm/error.rb
304
+ - lib/ruby_llm/evaluation.rb
305
+ - lib/ruby_llm/evaluation/assertions.rb
306
+ - lib/ruby_llm/evaluation/case.rb
307
+ - lib/ruby_llm/evaluation/dataset.rb
308
+ - lib/ruby_llm/evaluation/evaluator.rb
309
+ - lib/ruby_llm/evaluation/evidence.rb
310
+ - lib/ruby_llm/evaluation/minitest.rb
311
+ - lib/ruby_llm/evaluation/report.rb
312
+ - lib/ruby_llm/evaluation/result.rb
313
+ - lib/ruby_llm/evaluation/reviewer.rb
314
+ - lib/ruby_llm/evaluation/rspec.rb
315
+ - lib/ruby_llm/evaluation/runner.rb
316
+ - lib/ruby_llm/evaluation/trial.rb
318
317
  - lib/ruby_llm/fallback.rb
319
318
  - lib/ruby_llm/files/mime_type.rb
320
319
  - lib/ruby_llm/image.rb
320
+ - lib/ruby_llm/judge.rb
321
+ - lib/ruby_llm/judge/builder.rb
322
+ - lib/ruby_llm/judge/data.rb
323
+ - lib/ruby_llm/judge/question.rb
324
+ - lib/ruby_llm/judgment.rb
325
+ - lib/ruby_llm/mcp.rb
326
+ - lib/ruby_llm/mcp/apps.rb
327
+ - lib/ruby_llm/mcp/client.rb
328
+ - lib/ruby_llm/mcp/collection.rb
329
+ - lib/ruby_llm/mcp/content.rb
330
+ - lib/ruby_llm/mcp/error.rb
331
+ - lib/ruby_llm/mcp/http.rb
332
+ - lib/ruby_llm/mcp/input_request.rb
333
+ - lib/ruby_llm/mcp/input_required_error.rb
334
+ - lib/ruby_llm/mcp/listener.rb
335
+ - lib/ruby_llm/mcp/oauth.rb
336
+ - lib/ruby_llm/mcp/oauth/key.rb
337
+ - lib/ruby_llm/mcp/oauth/memory_store.rb
338
+ - lib/ruby_llm/mcp/oauth/proofs.rb
339
+ - lib/ruby_llm/mcp/param_headers.rb
340
+ - lib/ruby_llm/mcp/prompt.rb
341
+ - lib/ruby_llm/mcp/resource.rb
342
+ - lib/ruby_llm/mcp/resource_template.rb
343
+ - lib/ruby_llm/mcp/result.rb
344
+ - lib/ruby_llm/mcp/session_expired.rb
345
+ - lib/ruby_llm/mcp/stdio.rb
346
+ - lib/ruby_llm/mcp/task.rb
347
+ - lib/ruby_llm/mcp/tool.rb
321
348
  - lib/ruby_llm/message.rb
322
349
  - lib/ruby_llm/model.rb
323
350
  - lib/ruby_llm/model/modalities.rb
@@ -327,13 +354,22 @@ files:
327
354
  - lib/ruby_llm/models.json
328
355
  - lib/ruby_llm/models.rb
329
356
  - lib/ruby_llm/models/aliases.rb
357
+ - lib/ruby_llm/models/lookup.rb
330
358
  - lib/ruby_llm/models/registry.rb
331
359
  - lib/ruby_llm/models/schema.rb
332
360
  - lib/ruby_llm/moderation.rb
333
361
  - lib/ruby_llm/ocr.rb
362
+ - lib/ruby_llm/open_telemetry.rb
363
+ - lib/ruby_llm/open_telemetry/attributes.rb
364
+ - lib/ruby_llm/probability.rb
365
+ - lib/ruby_llm/progress.rb
334
366
  - lib/ruby_llm/prompt.rb
367
+ - lib/ruby_llm/prompt/context.rb
335
368
  - lib/ruby_llm/protocol.rb
336
369
  - lib/ruby_llm/protocol/binary_streaming.rb
370
+ - lib/ruby_llm/protocol/request_shapes.rb
371
+ - lib/ruby_llm/protocol/request_shapes/analysis.rb
372
+ - lib/ruby_llm/protocol/stored_uploads.rb
337
373
  - lib/ruby_llm/protocol/stream_accumulator.rb
338
374
  - lib/ruby_llm/protocol/streaming.rb
339
375
  - lib/ruby_llm/protocols/anthropic.rb
@@ -343,6 +379,7 @@ files:
343
379
  - lib/ruby_llm/protocols/anthropic/files.rb
344
380
  - lib/ruby_llm/protocols/anthropic/media.rb
345
381
  - lib/ruby_llm/protocols/anthropic/models.rb
382
+ - lib/ruby_llm/protocols/anthropic/request_shapes.rb
346
383
  - lib/ruby_llm/protocols/anthropic/streaming.rb
347
384
  - lib/ruby_llm/protocols/anthropic/tools.rb
348
385
  - lib/ruby_llm/protocols/azure/files.rb
@@ -360,6 +397,7 @@ files:
360
397
  - lib/ruby_llm/protocols/chat_completions/media.rb
361
398
  - lib/ruby_llm/protocols/chat_completions/models.rb
362
399
  - lib/ruby_llm/protocols/chat_completions/moderation.rb
400
+ - lib/ruby_llm/protocols/chat_completions/request_shapes.rb
363
401
  - lib/ruby_llm/protocols/chat_completions/rerank.rb
364
402
  - lib/ruby_llm/protocols/chat_completions/speech.rb
365
403
  - lib/ruby_llm/protocols/chat_completions/streaming.rb
@@ -383,6 +421,8 @@ files:
383
421
  - lib/ruby_llm/protocols/converse/batches.rb
384
422
  - lib/ruby_llm/protocols/converse/chat.rb
385
423
  - lib/ruby_llm/protocols/converse/media.rb
424
+ - lib/ruby_llm/protocols/converse/reasoning.rb
425
+ - lib/ruby_llm/protocols/converse/request_shapes.rb
386
426
  - lib/ruby_llm/protocols/converse/streaming.rb
387
427
  - lib/ruby_llm/protocols/converse/thinking_stream.rb
388
428
  - lib/ruby_llm/protocols/deepgram.rb
@@ -414,6 +454,7 @@ files:
414
454
  - lib/ruby_llm/protocols/gemini/live_transcription.rb
415
455
  - lib/ruby_llm/protocols/gemini/media.rb
416
456
  - lib/ruby_llm/protocols/gemini/models.rb
457
+ - lib/ruby_llm/protocols/gemini/request_shapes.rb
417
458
  - lib/ruby_llm/protocols/gemini/speech.rb
418
459
  - lib/ruby_llm/protocols/gemini/streaming.rb
419
460
  - lib/ruby_llm/protocols/gemini/tools.rb
@@ -425,6 +466,7 @@ files:
425
466
  - lib/ruby_llm/protocols/interactions.rb
426
467
  - lib/ruby_llm/protocols/interactions/chat.rb
427
468
  - lib/ruby_llm/protocols/interactions/content.rb
469
+ - lib/ruby_llm/protocols/interactions/request_shapes.rb
428
470
  - lib/ruby_llm/protocols/interactions/streaming.rb
429
471
  - lib/ruby_llm/protocols/interactions/tools.rb
430
472
  - lib/ruby_llm/protocols/interactions/transcription.rb
@@ -439,15 +481,18 @@ files:
439
481
  - lib/ruby_llm/protocols/mistral/conversations.rb
440
482
  - lib/ruby_llm/protocols/mistral/conversations/chat.rb
441
483
  - lib/ruby_llm/protocols/mistral/conversations/images.rb
484
+ - lib/ruby_llm/protocols/mistral/conversations/request_shapes.rb
442
485
  - lib/ruby_llm/protocols/mistral/conversations/streaming.rb
443
486
  - lib/ruby_llm/protocols/mistral/files.rb
444
487
  - lib/ruby_llm/protocols/mistral/multi_completion.rb
445
488
  - lib/ruby_llm/protocols/openai/batches.rb
489
+ - lib/ruby_llm/protocols/openai/decisions.rb
446
490
  - lib/ruby_llm/protocols/openai/files.rb
447
491
  - lib/ruby_llm/protocols/openrouter/batches.rb
448
492
  - lib/ruby_llm/protocols/openrouter/files.rb
449
493
  - lib/ruby_llm/protocols/openrouter/responses.rb
450
494
  - lib/ruby_llm/protocols/openrouter/transcription.rb
495
+ - lib/ruby_llm/protocols/perplexity/agent.rb
451
496
  - lib/ruby_llm/protocols/perplexity/files.rb
452
497
  - lib/ruby_llm/protocols/perplexity/router.rb
453
498
  - lib/ruby_llm/protocols/responses.rb
@@ -456,9 +501,14 @@ files:
456
501
  - lib/ruby_llm/protocols/responses/chat.rb
457
502
  - lib/ruby_llm/protocols/responses/compaction.rb
458
503
  - lib/ruby_llm/protocols/responses/media.rb
504
+ - lib/ruby_llm/protocols/responses/request_shapes.rb
459
505
  - lib/ruby_llm/protocols/responses/streaming.rb
460
506
  - lib/ruby_llm/protocols/responses/token_counting.rb
461
507
  - lib/ruby_llm/protocols/responses/tools.rb
508
+ - lib/ruby_llm/protocols/system_one.rb
509
+ - lib/ruby_llm/protocols/system_one/judgments.rb
510
+ - lib/ruby_llm/protocols/system_one/models.rb
511
+ - lib/ruby_llm/protocols/system_one/responses.rb
462
512
  - lib/ruby_llm/protocols/vertexai/batch_prediction.rb
463
513
  - lib/ruby_llm/protocols/vertexai/embedding_prediction.rb
464
514
  - lib/ruby_llm/protocols/vertexai/embedding_prediction/requests.rb
@@ -510,6 +560,8 @@ files:
510
560
  - lib/ruby_llm/providers/gpustack/models.rb
511
561
  - lib/ruby_llm/providers/gpustack/speech.rb
512
562
  - lib/ruby_llm/providers/gpustack/transcription.rb
563
+ - lib/ruby_llm/providers/hetzner.rb
564
+ - lib/ruby_llm/providers/hetzner/chat.rb
513
565
  - lib/ruby_llm/providers/mistral.rb
514
566
  - lib/ruby_llm/providers/mistral/capabilities.rb
515
567
  - lib/ruby_llm/providers/mistral/chat.rb
@@ -524,6 +576,7 @@ files:
524
576
  - lib/ruby_llm/providers/mistral/transcription.rb
525
577
  - lib/ruby_llm/providers/ollama.rb
526
578
  - lib/ruby_llm/providers/ollama/chat.rb
579
+ - lib/ruby_llm/providers/ollama/judgments.rb
527
580
  - lib/ruby_llm/providers/ollama/media.rb
528
581
  - lib/ruby_llm/providers/ollama/models.rb
529
582
  - lib/ruby_llm/providers/ollama_cloud.rb
@@ -546,12 +599,14 @@ files:
546
599
  - lib/ruby_llm/providers/perplexity/embeddings.rb
547
600
  - lib/ruby_llm/providers/perplexity/media.rb
548
601
  - lib/ruby_llm/providers/perplexity/models.rb
602
+ - lib/ruby_llm/providers/typesafe.rb
549
603
  - lib/ruby_llm/providers/vertexai.rb
550
604
  - lib/ruby_llm/providers/vertexai/anthropic.rb
551
605
  - lib/ruby_llm/providers/vertexai/anthropic/batches.rb
552
606
  - lib/ruby_llm/providers/vertexai/capabilities.rb
553
607
  - lib/ruby_llm/providers/vertexai/chat_completions.rb
554
608
  - lib/ruby_llm/providers/vertexai/chat_completions/batches.rb
609
+ - lib/ruby_llm/providers/vertexai/credentials.rb
555
610
  - lib/ruby_llm/providers/vertexai/embed_content.rb
556
611
  - lib/ruby_llm/providers/vertexai/embeddings.rb
557
612
  - lib/ruby_llm/providers/vertexai/gemini.rb
@@ -574,15 +629,24 @@ files:
574
629
  - lib/ruby_llm/providers/xai/transcription.rb
575
630
  - lib/ruby_llm/providers/xai/videos.rb
576
631
  - lib/ruby_llm/railtie.rb
632
+ - lib/ruby_llm/request_shape.rb
633
+ - lib/ruby_llm/request_shape/part.rb
634
+ - lib/ruby_llm/request_shape/problem.rb
635
+ - lib/ruby_llm/request_shape/tool_round.rb
636
+ - lib/ruby_llm/request_shape/turn.rb
577
637
  - lib/ruby_llm/rerank.rb
578
638
  - lib/ruby_llm/research_job.rb
639
+ - lib/ruby_llm/score.rb
579
640
  - lib/ruby_llm/search_results.rb
580
641
  - lib/ruby_llm/server_tool_call.rb
581
642
  - lib/ruby_llm/speech.rb
582
643
  - lib/ruby_llm/speech_chunk.rb
644
+ - lib/ruby_llm/support/cancellation.rb
583
645
  - lib/ruby_llm/support/deprecator.rb
584
646
  - lib/ruby_llm/support/inspectable.rb
585
647
  - lib/ruby_llm/support/instrumentation.rb
648
+ - lib/ruby_llm/support/process_cache.rb
649
+ - lib/ruby_llm/support/progress_reporter.rb
586
650
  - lib/ruby_llm/support/utils.rb
587
651
  - lib/ruby_llm/thinking.rb
588
652
  - lib/ruby_llm/tokenization.rb
@@ -595,6 +659,9 @@ files:
595
659
  - lib/ruby_llm/transcription_chunk.rb
596
660
  - lib/ruby_llm/transport/connection.rb
597
661
  - lib/ruby_llm/transport/error_middleware.rb
662
+ - lib/ruby_llm/transport/event_stream_parser.rb
663
+ - lib/ruby_llm/transport/json_response.rb
664
+ - lib/ruby_llm/transport/signing_middleware.rb
598
665
  - lib/ruby_llm/transport/usage_middleware.rb
599
666
  - lib/ruby_llm/transport/websocket_connection.rb
600
667
  - lib/ruby_llm/uploaded_file.rb
@@ -603,6 +670,7 @@ files:
603
670
  - lib/ruby_llm/video_job.rb
604
671
  - lib/ruby_llm/workflow.rb
605
672
  - lib/tasks/ruby_llm.rake
673
+ - lib/tasks/ruby_llm/evaluations.rb
606
674
  - skills/rubyllm/SKILL.md
607
675
  - skills/rubyllm/agents/openai.yaml
608
676
  homepage: https://rubyllm.com
@@ -617,17 +685,13 @@ metadata:
617
685
  funding_uri: https://github.com/sponsors/crmne
618
686
  rubygems_mfa_required: 'true'
619
687
  post_install_message: |
620
- RubyLLM 2.0.0
688
+ RubyLLM 2.1.1
621
689
 
622
- 2.0 renames several APIs and changes what message content returns. Coming
623
- from 1.x? Read the upgrade guide before you boot:
690
+ Upgrading? Read the upgrade guide before you boot:
624
691
 
625
692
  https://rubyllm.com/upgrading/
626
693
 
627
- The Rails upgrade uses forward-only preparation, backfill, and finish
628
- phases, with cleanup later. Rename mode is the default; optional copy
629
- mode supports a controlled return to 1.16. Read its requirements in the
630
- upgrade guide and rehearse on a recent production snapshot.
694
+ Coming from 1.x? Upgrade to 2.0 and finish its upgrade guide first.
631
695
 
632
696
  Agent skill: https://rubyllm.com/ai-coding-assistants/
633
697
  rdoc_options: []
@@ -637,7 +701,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
637
701
  requirements:
638
702
  - - ">="
639
703
  - !ruby/object:Gem::Version
640
- version: 3.1.3
704
+ version: '3.2'
641
705
  required_rubygems_version: !ruby/object:Gem::Requirement
642
706
  requirements:
643
707
  - - ">="
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLLM
4
- module Generators
5
- class LegacyContentSQL # :nodoc: all
6
- SPACE = [9, 10, 11, 12, 13, 32, 133, 160, 5760, *8192..8202, 8232, 8233, 8239, 8287, 12_288].pack('U*').freeze
7
-
8
- def initialize(connection)
9
- @connection = connection
10
- end
11
-
12
- def render(content:, raw:)
13
- normalized, rendered, nonblank = expressions(raw)
14
- present = "#{normalized} NOT IN ('null', 'false', '[]', '{}') AND #{nonblank}"
15
- "CASE WHEN #{present} THEN #{rendered} ELSE #{content} END"
16
- end
17
-
18
- private
19
-
20
- def expressions(raw)
21
- case @connection.adapter_name
22
- when 'PostgreSQL'
23
- ["(#{raw}::jsonb)::text", "#{raw}::text",
24
- "btrim(#{raw}::jsonb #>> '{}', #{@connection.quote(SPACE)}) <> ''"]
25
- when 'Mysql2'
26
- ["CAST(#{raw} AS CHAR)", "CAST(#{raw} AS CHAR)",
27
- "JSON_UNQUOTE(#{raw}) NOT REGEXP '^[[:space:]]*$'"]
28
- else
29
- ["json(#{raw})", raw, "trim(json_extract(#{raw}, '$'), #{@connection.quote(SPACE)}) <> ''"]
30
- end
31
- end
32
- end
33
- end
34
- end