llm.rb 11.3.1 → 12.1.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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +354 -2
  3. data/LICENSE +93 -17
  4. data/README.md +226 -616
  5. data/data/anthropic.json +322 -426
  6. data/data/bedrock.json +2634 -1144
  7. data/data/deepinfra.json +1513 -0
  8. data/data/deepseek.json +57 -28
  9. data/data/google.json +411 -771
  10. data/data/openai.json +1104 -771
  11. data/data/xai.json +141 -292
  12. data/data/zai.json +263 -141
  13. data/lib/llm/active_record/acts_as_agent.rb +3 -41
  14. data/lib/llm/active_record/acts_as_llm.rb +18 -0
  15. data/lib/llm/active_record.rb +3 -3
  16. data/lib/llm/agent.rb +25 -1
  17. data/lib/llm/context.rb +17 -5
  18. data/lib/llm/contract/completion.rb +2 -2
  19. data/lib/llm/json_adapter.rb +29 -3
  20. data/lib/llm/provider.rb +3 -3
  21. data/lib/llm/providers/deepinfra/audio.rb +66 -0
  22. data/lib/llm/providers/deepinfra/images.rb +90 -0
  23. data/lib/llm/providers/deepinfra/response_adapter.rb +36 -0
  24. data/lib/llm/providers/deepinfra.rb +100 -0
  25. data/lib/llm/providers/deepseek/images.rb +109 -0
  26. data/lib/llm/providers/deepseek/request_adapter.rb +32 -0
  27. data/lib/llm/providers/deepseek/response_adapter/image.rb +9 -0
  28. data/lib/llm/providers/deepseek/response_adapter.rb +29 -0
  29. data/lib/llm/providers/deepseek.rb +4 -2
  30. data/lib/llm/providers/google/request_adapter.rb +22 -5
  31. data/lib/llm/providers/google.rb +4 -4
  32. data/lib/llm/providers/llamacpp.rb +5 -5
  33. data/lib/llm/providers/openai/audio.rb +6 -2
  34. data/lib/llm/providers/openai/images.rb +9 -50
  35. data/lib/llm/providers/openai/request_adapter/respond.rb +38 -4
  36. data/lib/llm/providers/openai/response_adapter/audio.rb +5 -1
  37. data/lib/llm/providers/openai/response_adapter/completion.rb +1 -1
  38. data/lib/llm/providers/openai/response_adapter/image.rb +0 -4
  39. data/lib/llm/providers/openai/responses.rb +1 -0
  40. data/lib/llm/providers/openai/stream_parser.rb +5 -6
  41. data/lib/llm/providers/openai.rb +2 -2
  42. data/lib/llm/providers/xai/images.rb +49 -26
  43. data/lib/llm/providers/xai.rb +2 -2
  44. data/lib/llm/repl/input.rb +64 -0
  45. data/lib/llm/repl/status.rb +30 -0
  46. data/lib/llm/repl/stream.rb +46 -0
  47. data/lib/llm/repl/transcript.rb +61 -0
  48. data/lib/llm/repl/window.rb +107 -0
  49. data/lib/llm/repl.rb +78 -0
  50. data/lib/llm/response.rb +10 -0
  51. data/lib/llm/schema/leaf.rb +7 -1
  52. data/lib/llm/schema/renderer.rb +121 -0
  53. data/lib/llm/schema.rb +30 -0
  54. data/lib/llm/sequel/agent.rb +2 -43
  55. data/lib/llm/sequel/plugin.rb +25 -7
  56. data/lib/llm/tools/chdir.rb +23 -0
  57. data/lib/llm/tools/git.rb +41 -0
  58. data/lib/llm/tools/mkdir.rb +32 -0
  59. data/lib/llm/tools/pwd.rb +20 -0
  60. data/lib/llm/tools/read_file.rb +40 -0
  61. data/lib/llm/tools/rg.rb +46 -0
  62. data/lib/llm/tools/shell.rb +48 -0
  63. data/lib/llm/tools/swap_text.rb +25 -0
  64. data/lib/llm/tools/write_file.rb +24 -0
  65. data/lib/llm/tools.rb +5 -0
  66. data/lib/llm/tracer/telemetry.rb +4 -6
  67. data/lib/llm/tracer.rb +9 -21
  68. data/lib/llm/transport/execution.rb +16 -1
  69. data/lib/llm/transport/net_http_adapter.rb +1 -1
  70. data/lib/llm/uridata.rb +16 -0
  71. data/lib/llm/version.rb +1 -1
  72. data/lib/llm.rb +9 -0
  73. data/llm.gemspec +5 -18
  74. data/resources/deepdive.md +829 -263
  75. metadata +31 -18
  76. data/lib/llm/tracer/langsmith.rb +0 -144
data/data/deepseek.json CHANGED
@@ -8,17 +8,34 @@
8
8
  "name": "DeepSeek",
9
9
  "doc": "https://api-docs.deepseek.com/quick_start/pricing",
10
10
  "models": {
11
- "deepseek-chat": {
12
- "id": "deepseek-chat",
13
- "name": "DeepSeek Chat",
14
- "family": "deepseek",
15
- "attachment": true,
16
- "reasoning": false,
11
+ "deepseek-v4-flash": {
12
+ "id": "deepseek-v4-flash",
13
+ "name": "DeepSeek V4 Flash",
14
+ "description": "Fast DeepSeek V4 lane for economical reasoning, coding, and long-context work",
15
+ "family": "deepseek-flash",
16
+ "attachment": false,
17
+ "reasoning": true,
18
+ "reasoning_options": [
19
+ {
20
+ "type": "toggle"
21
+ },
22
+ {
23
+ "type": "effort",
24
+ "values": [
25
+ "high",
26
+ "max"
27
+ ]
28
+ }
29
+ ],
17
30
  "tool_call": true,
31
+ "interleaved": {
32
+ "field": "reasoning_content"
33
+ },
34
+ "structured_output": true,
18
35
  "temperature": true,
19
- "knowledge": "2025-09",
20
- "release_date": "2025-12-01",
21
- "last_updated": "2026-02-28",
36
+ "knowledge": "2025-05",
37
+ "release_date": "2026-04-24",
38
+ "last_updated": "2026-04-24",
22
39
  "modalities": {
23
40
  "input": [
24
41
  "text"
@@ -35,15 +52,28 @@
35
52
  "cost": {
36
53
  "input": 0.14,
37
54
  "output": 0.28,
38
- "cache_read": 0.028
55
+ "cache_read": 0.0028
39
56
  }
40
57
  },
41
58
  "deepseek-v4-pro": {
42
59
  "id": "deepseek-v4-pro",
43
60
  "name": "DeepSeek V4 Pro",
61
+ "description": "Open MoE flagship with million-token context for coding and long agent runs",
44
62
  "family": "deepseek-thinking",
45
63
  "attachment": false,
46
64
  "reasoning": true,
65
+ "reasoning_options": [
66
+ {
67
+ "type": "toggle"
68
+ },
69
+ {
70
+ "type": "effort",
71
+ "values": [
72
+ "high",
73
+ "max"
74
+ ]
75
+ }
76
+ ],
47
77
  "tool_call": true,
48
78
  "interleaved": {
49
79
  "field": "reasoning_content"
@@ -67,17 +97,19 @@
67
97
  "output": 384000
68
98
  },
69
99
  "cost": {
70
- "input": 1.74,
71
- "output": 3.48,
72
- "cache_read": 0.145
100
+ "input": 0.435,
101
+ "output": 0.87,
102
+ "cache_read": 0.003625
73
103
  }
74
104
  },
75
105
  "deepseek-reasoner": {
76
106
  "id": "deepseek-reasoner",
77
107
  "name": "DeepSeek Reasoner",
108
+ "description": "DeepSeek reasoning model for multi-step analysis, math, coding, and tools",
78
109
  "family": "deepseek-thinking",
79
110
  "attachment": true,
80
111
  "reasoning": true,
112
+ "reasoning_options": [],
81
113
  "tool_call": true,
82
114
  "interleaved": {
83
115
  "field": "reasoning_content"
@@ -102,24 +134,21 @@
102
134
  "cost": {
103
135
  "input": 0.14,
104
136
  "output": 0.28,
105
- "cache_read": 0.028
137
+ "cache_read": 0.0028
106
138
  }
107
139
  },
108
- "deepseek-v4-flash": {
109
- "id": "deepseek-v4-flash",
110
- "name": "DeepSeek V4 Flash",
111
- "family": "deepseek-flash",
112
- "attachment": false,
113
- "reasoning": true,
140
+ "deepseek-chat": {
141
+ "id": "deepseek-chat",
142
+ "name": "DeepSeek Chat",
143
+ "description": "DeepSeek chat model for instruction following, coding, and analysis",
144
+ "family": "deepseek",
145
+ "attachment": true,
146
+ "reasoning": false,
114
147
  "tool_call": true,
115
- "interleaved": {
116
- "field": "reasoning_content"
117
- },
118
- "structured_output": true,
119
148
  "temperature": true,
120
- "knowledge": "2025-05",
121
- "release_date": "2026-04-24",
122
- "last_updated": "2026-04-24",
149
+ "knowledge": "2025-09",
150
+ "release_date": "2025-12-01",
151
+ "last_updated": "2026-02-28",
123
152
  "modalities": {
124
153
  "input": [
125
154
  "text"
@@ -136,7 +165,7 @@
136
165
  "cost": {
137
166
  "input": 0.14,
138
167
  "output": 0.28,
139
- "cache_read": 0.028
168
+ "cache_read": 0.0028
140
169
  }
141
170
  }
142
171
  }