llm.rb 15.2.2 → 15.4.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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +197 -3
  3. data/README.md +180 -64
  4. data/bin/llm.rb +9 -2
  5. data/data/alibaba.json +45 -0
  6. data/data/anthropic.json +67 -0
  7. data/data/bedrock.json +1466 -397
  8. data/data/deepinfra.json +148 -16
  9. data/data/deepseek.json +3 -0
  10. data/data/mistral.json +42 -0
  11. data/data/openai.json +186 -0
  12. data/data/openrouter.json +1538 -378
  13. data/data/xai.json +53 -20
  14. data/data/zai.json +90 -4
  15. data/docs/deepdive/advanced/compaction.md +1 -2
  16. data/docs/deepdive/advanced/context.md +214 -1
  17. data/docs/deepdive/advanced/guard.md +9 -57
  18. data/docs/deepdive/features/builtin_tools.md +14 -16
  19. data/docs/deepdive/features/console.md +5 -0
  20. data/docs/deepdive/features/database.md +85 -10
  21. data/docs/deepdive/fundamentals/agents.md +7 -8
  22. data/docs/deepdive/fundamentals/providers.md +45 -5
  23. data/docs/deepdive/fundamentals/schema.md +73 -0
  24. data/docs/deepdive/fundamentals/tools.md +80 -27
  25. data/docs/deepdive/media/audio.md +8 -19
  26. data/docs/deepdive/media/images.md +8 -10
  27. data/docs/deepdive/media/ocr.md +1 -3
  28. data/docs/deepdive/reference/cost.md +48 -0
  29. data/docs/deepdive/reference/tracer.md +76 -0
  30. data/docs/deepdive.md +1 -1
  31. data/lib/llm/active_record/message.rb +113 -0
  32. data/lib/llm/active_record.rb +1 -0
  33. data/lib/llm/agent.rb +44 -19
  34. data/lib/llm/console/buffer.rb +9 -1
  35. data/lib/llm/console.rb +6 -1
  36. data/lib/llm/context/deserializer.rb +10 -3
  37. data/lib/llm/context.rb +62 -26
  38. data/lib/llm/guard.rb +2 -8
  39. data/lib/llm/message.rb +18 -7
  40. data/lib/llm/provider.rb +74 -16
  41. data/lib/llm/providers/alibaba.rb +15 -0
  42. data/lib/llm/providers/anthropic/error_handler.rb +5 -2
  43. data/lib/llm/providers/anthropic/files.rb +12 -12
  44. data/lib/llm/providers/anthropic/models.rb +2 -2
  45. data/lib/llm/providers/anthropic.rb +5 -3
  46. data/lib/llm/providers/bedrock/error_handler.rb +3 -2
  47. data/lib/llm/providers/bedrock/models.rb +5 -3
  48. data/lib/llm/providers/bedrock.rb +5 -3
  49. data/lib/llm/providers/deepinfra/audio.rb +4 -4
  50. data/lib/llm/providers/deepinfra/images.rb +4 -4
  51. data/lib/llm/providers/google/error_handler.rb +5 -2
  52. data/lib/llm/providers/google/files.rb +10 -10
  53. data/lib/llm/providers/google/images.rb +2 -2
  54. data/lib/llm/providers/google/models.rb +2 -2
  55. data/lib/llm/providers/google.rb +7 -7
  56. data/lib/llm/providers/mistral.rb +3 -1
  57. data/lib/llm/providers/ollama/error_handler.rb +5 -2
  58. data/lib/llm/providers/ollama/models.rb +2 -2
  59. data/lib/llm/providers/ollama.rb +7 -5
  60. data/lib/llm/providers/openai/audio.rb +6 -6
  61. data/lib/llm/providers/openai/error_handler.rb +5 -2
  62. data/lib/llm/providers/openai/files.rb +10 -10
  63. data/lib/llm/providers/openai/images.rb +4 -4
  64. data/lib/llm/providers/openai/models.rb +2 -2
  65. data/lib/llm/providers/openai/moderations.rb +2 -2
  66. data/lib/llm/providers/openai/request_adapter.rb +1 -1
  67. data/lib/llm/providers/openai/responses.rb +8 -8
  68. data/lib/llm/providers/openai/vector_stores.rb +22 -22
  69. data/lib/llm/providers/openai.rb +10 -8
  70. data/lib/llm/providers/xai/images.rb +4 -4
  71. data/lib/llm/schema.rb +24 -0
  72. data/lib/llm/tracer/telemetry.rb +4 -4
  73. data/lib/llm/tracer.rb +11 -3
  74. data/lib/llm/transport/execution.rb +8 -4
  75. data/lib/llm/utils.rb +13 -0
  76. data/lib/llm/version.rb +1 -1
  77. data/llm.gemspec +2 -2
  78. metadata +5 -5
  79. data/lib/llm/guard/loop.rb +0 -89
data/data/alibaba.json CHANGED
@@ -1193,6 +1193,51 @@
1193
1193
  "output_audio": 15.11
1194
1194
  }
1195
1195
  },
1196
+ "kimi-k3": {
1197
+ "id": "kimi-k3",
1198
+ "name": "Kimi K3",
1199
+ "description": "Multimodal Kimi model with 1M context and toggleable max-effort thinking for long-horizon agent work",
1200
+ "family": "kimi-k3",
1201
+ "attachment": true,
1202
+ "reasoning": true,
1203
+ "reasoning_options": [
1204
+ {
1205
+ "type": "effort",
1206
+ "values": [
1207
+ "low",
1208
+ "high",
1209
+ "max"
1210
+ ]
1211
+ }
1212
+ ],
1213
+ "tool_call": true,
1214
+ "interleaved": {
1215
+ "field": "reasoning_content"
1216
+ },
1217
+ "structured_output": true,
1218
+ "temperature": false,
1219
+ "release_date": "2026-07-16",
1220
+ "last_updated": "2026-07-16",
1221
+ "modalities": {
1222
+ "input": [
1223
+ "text",
1224
+ "image"
1225
+ ],
1226
+ "output": [
1227
+ "text"
1228
+ ]
1229
+ },
1230
+ "open_weights": true,
1231
+ "limit": {
1232
+ "context": 1048576,
1233
+ "output": 1048576
1234
+ },
1235
+ "cost": {
1236
+ "input": 3,
1237
+ "output": 15,
1238
+ "cache_read": 0.3
1239
+ }
1240
+ },
1196
1241
  "qwen2-5-vl-72b-instruct": {
1197
1242
  "id": "qwen2-5-vl-72b-instruct",
1198
1243
  "name": "Qwen2.5-VL 72B Instruct",
data/data/anthropic.json CHANGED
@@ -57,6 +57,73 @@
57
57
  "cache_write": 3.75
58
58
  }
59
59
  },
60
+ "claude-opus-5-5": {
61
+ "id": "claude-opus-5-5",
62
+ "name": "Claude Opus 5.5",
63
+ "description": "Claude model for long-running agentic coding and knowledge work",
64
+ "family": "claude-opus",
65
+ "attachment": true,
66
+ "reasoning": true,
67
+ "reasoning_options": [
68
+ {
69
+ "type": "effort",
70
+ "values": [
71
+ "low",
72
+ "medium",
73
+ "high",
74
+ "xhigh",
75
+ "max"
76
+ ]
77
+ }
78
+ ],
79
+ "tool_call": true,
80
+ "structured_output": true,
81
+ "temperature": false,
82
+ "knowledge": "2026-06",
83
+ "release_date": "2026-09-22",
84
+ "last_updated": "2026-09-22",
85
+ "modalities": {
86
+ "input": [
87
+ "text",
88
+ "image",
89
+ "pdf"
90
+ ],
91
+ "output": [
92
+ "text"
93
+ ]
94
+ },
95
+ "open_weights": false,
96
+ "limit": {
97
+ "context": 1000000,
98
+ "output": 128000
99
+ },
100
+ "experimental": {
101
+ "modes": {
102
+ "fast": {
103
+ "cost": {
104
+ "input": 8,
105
+ "output": 40,
106
+ "cache_read": 0.4,
107
+ "cache_write": 10
108
+ },
109
+ "provider": {
110
+ "body": {
111
+ "speed": "fast"
112
+ },
113
+ "headers": {
114
+ "anthropic-beta": "fast-mode-2026-02-01"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ },
120
+ "cost": {
121
+ "input": 4,
122
+ "output": 20,
123
+ "cache_read": 0.2,
124
+ "cache_write": 5
125
+ }
126
+ },
60
127
  "claude-opus-5": {
61
128
  "id": "claude-opus-5",
62
129
  "name": "Claude Opus 5",