llm.rb 11.3.0 → 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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +270 -1
  3. data/LICENSE +92 -17
  4. data/README.md +209 -647
  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/a2a.rb +2 -2
  14. data/lib/llm/active_record/acts_as_agent.rb +10 -41
  15. data/lib/llm/active_record/acts_as_llm.rb +25 -0
  16. data/lib/llm/active_record.rb +3 -3
  17. data/lib/llm/agent.rb +1 -1
  18. data/lib/llm/context.rb +9 -5
  19. data/lib/llm/contract/completion.rb +2 -2
  20. data/lib/llm/cost.rb +1 -1
  21. data/lib/llm/function/fiber_group.rb +2 -2
  22. data/lib/llm/function/task_group.rb +2 -2
  23. data/lib/llm/function/thread_group.rb +3 -3
  24. data/lib/llm/pipe.rb +1 -1
  25. data/lib/llm/provider.rb +2 -2
  26. data/lib/llm/providers/anthropic/request_adapter.rb +1 -1
  27. data/lib/llm/providers/bedrock/request_adapter/completion.rb +5 -5
  28. data/lib/llm/providers/bedrock/request_adapter.rb +3 -3
  29. data/lib/llm/providers/bedrock/response_adapter/completion.rb +2 -2
  30. data/lib/llm/providers/bedrock/response_adapter.rb +2 -2
  31. data/lib/llm/providers/deepinfra/audio.rb +66 -0
  32. data/lib/llm/providers/deepinfra/images.rb +90 -0
  33. data/lib/llm/providers/deepinfra/response_adapter.rb +36 -0
  34. data/lib/llm/providers/deepinfra.rb +100 -0
  35. data/lib/llm/providers/deepseek/images.rb +109 -0
  36. data/lib/llm/providers/deepseek/request_adapter.rb +32 -0
  37. data/lib/llm/providers/deepseek/response_adapter/image.rb +9 -0
  38. data/lib/llm/providers/deepseek/response_adapter.rb +29 -0
  39. data/lib/llm/providers/deepseek.rb +4 -2
  40. data/lib/llm/providers/google/request_adapter.rb +23 -6
  41. data/lib/llm/providers/google.rb +4 -4
  42. data/lib/llm/providers/ollama/request_adapter.rb +1 -1
  43. data/lib/llm/providers/openai/audio.rb +6 -2
  44. data/lib/llm/providers/openai/images.rb +9 -50
  45. data/lib/llm/providers/openai/request_adapter/respond.rb +38 -4
  46. data/lib/llm/providers/openai/request_adapter.rb +1 -1
  47. data/lib/llm/providers/openai/response_adapter/audio.rb +5 -1
  48. data/lib/llm/providers/openai/response_adapter/completion.rb +1 -1
  49. data/lib/llm/providers/openai/response_adapter/image.rb +0 -4
  50. data/lib/llm/providers/openai/responses.rb +1 -0
  51. data/lib/llm/providers/openai/stream_parser.rb +5 -6
  52. data/lib/llm/providers/openai.rb +2 -2
  53. data/lib/llm/providers/xai/images.rb +49 -26
  54. data/lib/llm/providers/xai.rb +2 -2
  55. data/lib/llm/registry.rb +2 -2
  56. data/lib/llm/response.rb +11 -1
  57. data/lib/llm/schema/leaf.rb +7 -1
  58. data/lib/llm/schema/object.rb +1 -1
  59. data/lib/llm/schema/renderer.rb +121 -0
  60. data/lib/llm/schema.rb +30 -0
  61. data/lib/llm/sequel/agent.rb +2 -43
  62. data/lib/llm/sequel/plugin.rb +25 -7
  63. data/lib/llm/stream.rb +1 -1
  64. data/lib/llm/tool.rb +2 -2
  65. data/lib/llm/tracer/telemetry.rb +4 -6
  66. data/lib/llm/tracer.rb +9 -21
  67. data/lib/llm/transport/execution.rb +16 -1
  68. data/lib/llm/transport/http.rb +2 -2
  69. data/lib/llm/transport/net_http_adapter.rb +1 -1
  70. data/lib/llm/transport/persistent_http.rb +1 -1
  71. data/lib/llm/transport/response/http.rb +1 -1
  72. data/lib/llm/uridata.rb +16 -0
  73. data/lib/llm/utils.rb +1 -1
  74. data/lib/llm/version.rb +1 -1
  75. data/lib/llm.rb +20 -8
  76. data/llm.gemspec +14 -26
  77. data/resources/deepdive.md +966 -0
  78. metadata +26 -29
  79. 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
  }