llm.rb 11.3.1 → 12.0.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +242 -1
  3. data/LICENSE +92 -17
  4. data/README.md +204 -623
  5. data/data/anthropic.json +433 -249
  6. data/data/bedrock.json +2097 -1055
  7. data/data/deepinfra.json +993 -0
  8. data/data/deepseek.json +53 -28
  9. data/data/google.json +389 -771
  10. data/data/openai.json +1053 -771
  11. data/data/xai.json +133 -292
  12. data/data/zai.json +249 -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/context.rb +9 -5
  17. data/lib/llm/contract/completion.rb +2 -2
  18. data/lib/llm/provider.rb +2 -2
  19. data/lib/llm/providers/deepinfra/audio.rb +66 -0
  20. data/lib/llm/providers/deepinfra/images.rb +90 -0
  21. data/lib/llm/providers/deepinfra/response_adapter.rb +36 -0
  22. data/lib/llm/providers/deepinfra.rb +100 -0
  23. data/lib/llm/providers/deepseek/images.rb +109 -0
  24. data/lib/llm/providers/deepseek/request_adapter.rb +32 -0
  25. data/lib/llm/providers/deepseek/response_adapter/image.rb +9 -0
  26. data/lib/llm/providers/deepseek/response_adapter.rb +29 -0
  27. data/lib/llm/providers/deepseek.rb +4 -2
  28. data/lib/llm/providers/google/request_adapter.rb +22 -5
  29. data/lib/llm/providers/google.rb +4 -4
  30. data/lib/llm/providers/openai/audio.rb +6 -2
  31. data/lib/llm/providers/openai/images.rb +9 -50
  32. data/lib/llm/providers/openai/request_adapter/respond.rb +38 -4
  33. data/lib/llm/providers/openai/response_adapter/audio.rb +5 -1
  34. data/lib/llm/providers/openai/response_adapter/completion.rb +1 -1
  35. data/lib/llm/providers/openai/response_adapter/image.rb +0 -4
  36. data/lib/llm/providers/openai/responses.rb +1 -0
  37. data/lib/llm/providers/openai/stream_parser.rb +5 -6
  38. data/lib/llm/providers/openai.rb +2 -2
  39. data/lib/llm/providers/xai/images.rb +49 -26
  40. data/lib/llm/providers/xai.rb +2 -2
  41. data/lib/llm/response.rb +10 -0
  42. data/lib/llm/schema/leaf.rb +7 -1
  43. data/lib/llm/schema/renderer.rb +121 -0
  44. data/lib/llm/schema.rb +30 -0
  45. data/lib/llm/sequel/agent.rb +2 -43
  46. data/lib/llm/sequel/plugin.rb +25 -7
  47. data/lib/llm/tracer/telemetry.rb +4 -6
  48. data/lib/llm/tracer.rb +9 -21
  49. data/lib/llm/transport/execution.rb +16 -1
  50. data/lib/llm/transport/net_http_adapter.rb +1 -1
  51. data/lib/llm/uridata.rb +16 -0
  52. data/lib/llm/version.rb +1 -1
  53. data/lib/llm.rb +9 -0
  54. data/llm.gemspec +5 -18
  55. data/resources/deepdive.md +798 -264
  56. metadata +15 -18
  57. data/lib/llm/tracer/langsmith.rb +0 -144
data/data/deepseek.json CHANGED
@@ -8,17 +8,33 @@
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
+ "family": "deepseek-flash",
15
+ "attachment": false,
16
+ "reasoning": true,
17
+ "reasoning_options": [
18
+ {
19
+ "type": "toggle"
20
+ },
21
+ {
22
+ "type": "effort",
23
+ "values": [
24
+ "high",
25
+ "max"
26
+ ]
27
+ }
28
+ ],
17
29
  "tool_call": true,
30
+ "interleaved": {
31
+ "field": "reasoning_content"
32
+ },
33
+ "structured_output": true,
18
34
  "temperature": true,
19
- "knowledge": "2025-09",
20
- "release_date": "2025-12-01",
21
- "last_updated": "2026-02-28",
35
+ "knowledge": "2025-05",
36
+ "release_date": "2026-04-24",
37
+ "last_updated": "2026-04-24",
22
38
  "modalities": {
23
39
  "input": [
24
40
  "text"
@@ -35,7 +51,7 @@
35
51
  "cost": {
36
52
  "input": 0.14,
37
53
  "output": 0.28,
38
- "cache_read": 0.028
54
+ "cache_read": 0.0028
39
55
  }
40
56
  },
41
57
  "deepseek-v4-pro": {
@@ -44,6 +60,18 @@
44
60
  "family": "deepseek-thinking",
45
61
  "attachment": false,
46
62
  "reasoning": true,
63
+ "reasoning_options": [
64
+ {
65
+ "type": "toggle"
66
+ },
67
+ {
68
+ "type": "effort",
69
+ "values": [
70
+ "high",
71
+ "max"
72
+ ]
73
+ }
74
+ ],
47
75
  "tool_call": true,
48
76
  "interleaved": {
49
77
  "field": "reasoning_content"
@@ -67,9 +95,9 @@
67
95
  "output": 384000
68
96
  },
69
97
  "cost": {
70
- "input": 1.74,
71
- "output": 3.48,
72
- "cache_read": 0.145
98
+ "input": 0.435,
99
+ "output": 0.87,
100
+ "cache_read": 0.003625
73
101
  }
74
102
  },
75
103
  "deepseek-reasoner": {
@@ -78,6 +106,7 @@
78
106
  "family": "deepseek-thinking",
79
107
  "attachment": true,
80
108
  "reasoning": true,
109
+ "reasoning_options": [],
81
110
  "tool_call": true,
82
111
  "interleaved": {
83
112
  "field": "reasoning_content"
@@ -102,24 +131,20 @@
102
131
  "cost": {
103
132
  "input": 0.14,
104
133
  "output": 0.28,
105
- "cache_read": 0.028
134
+ "cache_read": 0.0028
106
135
  }
107
136
  },
108
- "deepseek-v4-flash": {
109
- "id": "deepseek-v4-flash",
110
- "name": "DeepSeek V4 Flash",
111
- "family": "deepseek-flash",
112
- "attachment": false,
113
- "reasoning": true,
137
+ "deepseek-chat": {
138
+ "id": "deepseek-chat",
139
+ "name": "DeepSeek Chat",
140
+ "family": "deepseek",
141
+ "attachment": true,
142
+ "reasoning": false,
114
143
  "tool_call": true,
115
- "interleaved": {
116
- "field": "reasoning_content"
117
- },
118
- "structured_output": true,
119
144
  "temperature": true,
120
- "knowledge": "2025-05",
121
- "release_date": "2026-04-24",
122
- "last_updated": "2026-04-24",
145
+ "knowledge": "2025-09",
146
+ "release_date": "2025-12-01",
147
+ "last_updated": "2026-02-28",
123
148
  "modalities": {
124
149
  "input": [
125
150
  "text"
@@ -136,7 +161,7 @@
136
161
  "cost": {
137
162
  "input": 0.14,
138
163
  "output": 0.28,
139
- "cache_read": 0.028
164
+ "cache_read": 0.0028
140
165
  }
141
166
  }
142
167
  }