llm.rb 0.3.2 → 0.3.3

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +40 -7
  3. data/lib/llm/chat.rb +5 -3
  4. data/lib/llm/core_ext/ostruct.rb +1 -1
  5. data/lib/llm/file.rb +8 -1
  6. data/lib/llm/model.rb +27 -2
  7. data/lib/llm/provider.rb +20 -28
  8. data/lib/llm/providers/anthropic/format.rb +19 -6
  9. data/lib/llm/providers/anthropic/models.rb +62 -0
  10. data/lib/llm/providers/anthropic.rb +23 -8
  11. data/lib/llm/providers/gemini/format.rb +6 -1
  12. data/lib/llm/providers/gemini/images.rb +3 -3
  13. data/lib/llm/providers/gemini/models.rb +69 -0
  14. data/lib/llm/providers/gemini/response_parser.rb +1 -5
  15. data/lib/llm/providers/gemini.rb +20 -5
  16. data/lib/llm/providers/ollama/format.rb +11 -3
  17. data/lib/llm/providers/ollama/models.rb +66 -0
  18. data/lib/llm/providers/ollama.rb +23 -8
  19. data/lib/llm/providers/openai/audio.rb +0 -2
  20. data/lib/llm/providers/openai/format.rb +6 -1
  21. data/lib/llm/providers/openai/images.rb +1 -1
  22. data/lib/llm/providers/openai/models.rb +62 -0
  23. data/lib/llm/providers/openai/response_parser.rb +1 -5
  24. data/lib/llm/providers/openai/responses.rb +10 -6
  25. data/lib/llm/providers/openai.rb +24 -7
  26. data/lib/llm/response/modellist.rb +18 -0
  27. data/lib/llm/response.rb +1 -0
  28. data/lib/llm/version.rb +1 -1
  29. data/lib/llm.rb +2 -1
  30. data/spec/anthropic/completion_spec.rb +36 -0
  31. data/spec/anthropic/models_spec.rb +21 -0
  32. data/spec/gemini/images_spec.rb +4 -12
  33. data/spec/gemini/models_spec.rb +21 -0
  34. data/spec/llm/conversation_spec.rb +5 -3
  35. data/spec/ollama/models_spec.rb +20 -0
  36. data/spec/openai/completion_spec.rb +19 -0
  37. data/spec/openai/images_spec.rb +2 -6
  38. data/spec/openai/models_spec.rb +21 -0
  39. metadata +11 -6
  40. data/share/llm/models/anthropic.yml +0 -35
  41. data/share/llm/models/gemini.yml +0 -35
  42. data/share/llm/models/ollama.yml +0 -155
  43. data/share/llm/models/openai.yml +0 -46
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antar Azri
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-04-26 00:00:00.000000000 Z
12
+ date: 2025-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: webmock
@@ -162,6 +162,7 @@ files:
162
162
  - lib/llm/providers/anthropic.rb
163
163
  - lib/llm/providers/anthropic/error_handler.rb
164
164
  - lib/llm/providers/anthropic/format.rb
165
+ - lib/llm/providers/anthropic/models.rb
165
166
  - lib/llm/providers/anthropic/response_parser.rb
166
167
  - lib/llm/providers/gemini.rb
167
168
  - lib/llm/providers/gemini/audio.rb
@@ -169,10 +170,12 @@ files:
169
170
  - lib/llm/providers/gemini/files.rb
170
171
  - lib/llm/providers/gemini/format.rb
171
172
  - lib/llm/providers/gemini/images.rb
173
+ - lib/llm/providers/gemini/models.rb
172
174
  - lib/llm/providers/gemini/response_parser.rb
173
175
  - lib/llm/providers/ollama.rb
174
176
  - lib/llm/providers/ollama/error_handler.rb
175
177
  - lib/llm/providers/ollama/format.rb
178
+ - lib/llm/providers/ollama/models.rb
176
179
  - lib/llm/providers/ollama/response_parser.rb
177
180
  - lib/llm/providers/openai.rb
178
181
  - lib/llm/providers/openai/audio.rb
@@ -180,6 +183,7 @@ files:
180
183
  - lib/llm/providers/openai/files.rb
181
184
  - lib/llm/providers/openai/format.rb
182
185
  - lib/llm/providers/openai/images.rb
186
+ - lib/llm/providers/openai/models.rb
183
187
  - lib/llm/providers/openai/response_parser.rb
184
188
  - lib/llm/providers/openai/responses.rb
185
189
  - lib/llm/providers/voyageai.rb
@@ -195,30 +199,31 @@ files:
195
199
  - lib/llm/response/file.rb
196
200
  - lib/llm/response/filelist.rb
197
201
  - lib/llm/response/image.rb
202
+ - lib/llm/response/modellist.rb
198
203
  - lib/llm/response/output.rb
199
204
  - lib/llm/utils.rb
200
205
  - lib/llm/version.rb
201
206
  - llm.gemspec
202
- - share/llm/models/anthropic.yml
203
- - share/llm/models/gemini.yml
204
- - share/llm/models/ollama.yml
205
- - share/llm/models/openai.yml
206
207
  - spec/anthropic/completion_spec.rb
207
208
  - spec/anthropic/embedding_spec.rb
209
+ - spec/anthropic/models_spec.rb
208
210
  - spec/gemini/completion_spec.rb
209
211
  - spec/gemini/conversation_spec.rb
210
212
  - spec/gemini/embedding_spec.rb
211
213
  - spec/gemini/files_spec.rb
212
214
  - spec/gemini/images_spec.rb
215
+ - spec/gemini/models_spec.rb
213
216
  - spec/llm/conversation_spec.rb
214
217
  - spec/ollama/completion_spec.rb
215
218
  - spec/ollama/conversation_spec.rb
216
219
  - spec/ollama/embedding_spec.rb
220
+ - spec/ollama/models_spec.rb
217
221
  - spec/openai/audio_spec.rb
218
222
  - spec/openai/completion_spec.rb
219
223
  - spec/openai/embedding_spec.rb
220
224
  - spec/openai/files_spec.rb
221
225
  - spec/openai/images_spec.rb
226
+ - spec/openai/models_spec.rb
222
227
  - spec/openai/responses_spec.rb
223
228
  - spec/readme_spec.rb
224
229
  - spec/setup.rb
@@ -1,35 +0,0 @@
1
- claude-3-7-sonnet-20250219:
2
- name: Claude 3.7 Sonnet
3
- parameters: Unknown
4
- description: Most intelligent Claude model with extended thinking and high capability
5
- to_param: claude-3-7-sonnet-20250219
6
-
7
- claude-3-5-sonnet-20241022:
8
- name: Claude 3.5 Sonnet (v2)
9
- parameters: Unknown
10
- description: High intelligence and capability; upgraded from previous Sonnet
11
- to_param: claude-3-5-sonnet-20241022
12
-
13
- claude-3-5-sonnet-20240620:
14
- name: Claude 3.5 Sonnet
15
- parameters: Unknown
16
- description: Intelligent and capable general-purpose model
17
- to_param: claude-3-5-sonnet-20240620
18
-
19
- claude-3-5-haiku-20241022:
20
- name: Claude 3.5 Haiku
21
- parameters: Unknown
22
- description: Blazing fast model for low-latency text generation
23
- to_param: claude-3-5-haiku-20241022
24
-
25
- claude-3-opus-20240229:
26
- name: Claude 3 Opus
27
- parameters: Unknown
28
- description: Top-level intelligence, fluency, and reasoning for complex tasks
29
- to_param: claude-3-opus-20240229
30
-
31
- claude-3-haiku-20240307:
32
- name: Claude 3 Haiku
33
- parameters: Unknown
34
- description: Fastest and most compact Claude model for near-instant responsiveness
35
- to_param: claude-3-haiku-20240307
@@ -1,35 +0,0 @@
1
- gemini-2.5-pro-exp-03-25:
2
- name: Gemini
3
- parameters: Unknown
4
- description: Enhanced thinking and reasoning, multimodal understanding, advanced coding, and more
5
- to_param: gemini-2.5-pro-exp-03-25
6
-
7
- gemini-2.0-flash:
8
- name: Gemini
9
- parameters: Unknown
10
- description: Next generation features, speed, thinking, realtime streaming, and multimodal generation
11
- to_param: gemini-2.0-flash
12
-
13
- gemini-2.0-flash-lite:
14
- name: Gemini
15
- parameters: Unknown
16
- description: Cost efficiency and low latency
17
- to_param: gemini-2.0-flash-lite
18
-
19
- gemini-1.5-flash:
20
- name: Gemini
21
- parameters: Unknown
22
- description: Fast and versatile performance across a diverse variety of tasks
23
- to_param: gemini-1.5-flash
24
-
25
- gemini-1.5-flash-8b:
26
- name: Gemini
27
- parameters: 8B
28
- description: High volume and lower intelligence tasks
29
- to_param: gemini-1.5-flash-8b
30
-
31
- gemini-1.5-pro:
32
- name: Gemini
33
- parameters: Unknown
34
- description: Complex reasoning tasks requiring more intelligence
35
- to_param: gemini-1.5-pro
@@ -1,155 +0,0 @@
1
- ---
2
- gemma3:1b:
3
- name: Gemma
4
- parameters: 1B
5
- description: Lightweight version of Google's Gemma 3 language model, suitable for
6
- low-resource environments
7
- to_param: gemma3:1b
8
- gemma3:
9
- name: Gemma
10
- parameters: 4B
11
- description: Balanced Gemma 3 model providing good accuracy with reasonable size
12
- to_param: gemma3
13
- gemma3:12b:
14
- name: Gemma
15
- parameters: 12B
16
- description: Larger Gemma 3 model offering improved reasoning and generation abilities
17
- to_param: gemma3:12b
18
- gemma3:27b:
19
- name: Gemma
20
- parameters: 27B
21
- description: High-end Gemma 3 model focused on top-tier performance and accuracy
22
- to_param: gemma3:27b
23
-
24
- qwq:
25
- name: QwQ
26
- parameters: 32B
27
- description: Large-scale model with high parameter count for complex tasks and
28
- high-quality generation
29
- to_param: qwq
30
-
31
- deepseek-r1:
32
- name: DeepSeek-R1
33
- parameters: 7B
34
- description: Compact DeepSeek model optimized for research and experimentation
35
- to_param: deepseek-r1
36
- deepseek-r1:671b:
37
- name: DeepSeek-R1
38
- parameters: 671B
39
- description: Massive-scale DeepSeek model focused on advanced AI reasoning and
40
- capabilities
41
- to_param: deepseek-r1:671b
42
- deepseek-coder:
43
- name: DeepSeek-Coder
44
- parameters: 1.3B
45
- description: Lightweight code generation model trained on 2T tokens of code and natural language
46
- to_param: deepseek-coder
47
- deepseek-coder:6.7b:
48
- name: DeepSeek-Coder
49
- parameters: 6.7B
50
- description: Mid-sized DeepSeek-Coder model offering a strong balance between speed and capability for code-related tasks
51
- to_param: deepseek-coder:6.7b
52
- deepseek-coder:33b:
53
- name: DeepSeek-Coder
54
- parameters: 33B
55
- description: Large DeepSeek-Coder model with high performance for code generation, understanding, and multilingual coding tasks
56
- to_param: deepseek-coder:33b
57
-
58
- llama3.3:
59
- name: Llama
60
- parameters: 70B
61
- description: Latest large Llama model designed for high-end performance in reasoning
62
- and language tasks
63
- to_param: llama3.3
64
- llama3.2:
65
- name: Llama
66
- parameters: 3B
67
- description: Small but capable version of Llama 3.2 for lightweight applications
68
- to_param: llama3.2
69
- llama3.2:1b:
70
- name: Llama
71
- parameters: 1B
72
- description: Tiny version of Llama 3.2, extremely lightweight and fast
73
- to_param: llama3.2:1b
74
- llama3.2-vision:
75
- name: Llama Vision
76
- parameters: 11B
77
- description: Multimodal Llama 3.2 model with vision capabilities (images + text)
78
- to_param: llama3.2-vision
79
- llama3.2-vision:90b:
80
- name: Llama Vision
81
- parameters: 90B
82
- description: Large-scale vision-capable Llama model for advanced multimodal tasks
83
- to_param: llama3.2-vision:90b
84
- llama3.1:
85
- name: Llama
86
- parameters: 8B
87
- description: General-purpose Llama model designed for good accuracy and performance
88
- balance
89
- to_param: llama3.1
90
- llama3.1:405b:
91
- name: Llama
92
- parameters: 405B
93
- description: Extremely large-scale version of Llama 3.1, suitable for advanced tasks
94
- to_param: llama3.1:405b
95
-
96
- phi4:
97
- name: Phi
98
- parameters: 14B
99
- description: Phi 4 is known for compact size and competitive performance in general
100
- tasks
101
- to_param: phi4
102
- phi4-mini:
103
- name: Phi Mini
104
- parameters: 3.8B
105
- description: Lightweight variant of Phi 4 ideal for quick inference on constrained systems
106
- to_param: phi4-mini
107
-
108
- mistral:
109
- name: Mistral
110
- parameters: 7B
111
- description: Popular and versatile open model for general language tasks
112
- to_param: mistral
113
-
114
- moondream:
115
- name: Moondream
116
- parameters: 1.4B
117
- description: Compact vision-enabled model with strong general performance
118
- to_param: moondream
119
-
120
- neural-chat:
121
- name: Neural Chat
122
- parameters: 7B
123
- description: Chat-focused model fine-tuned for natural conversations
124
- to_param: neural-chat
125
-
126
- starling-lm:
127
- name: Starling
128
- parameters: 7B
129
- description: Model focused on instruction-following and conversational performance
130
- to_param: starling-lm
131
-
132
- codellama:
133
- name: Code Llama
134
- parameters: 7B
135
- description: Llama model variant fine-tuned specifically for code understanding
136
- and generation
137
- to_param: codellama
138
-
139
- llama2-uncensored:
140
- name: Llama 2 Uncensored
141
- parameters: 7B
142
- description: Unfiltered version of Llama 2 for unrestricted language modeling
143
- to_param: llama2-uncensored
144
-
145
- llava:
146
- name: LLaVA
147
- parameters: 7B
148
- description: Multimodal model combining vision and language understanding
149
- to_param: llava
150
-
151
- granite3.2:
152
- name: Granite
153
- parameters: 8B
154
- description: IBM’s Granite model for enterprise-grade language applications
155
- to_param: granite3.2
@@ -1,46 +0,0 @@
1
- ---
2
- o3-mini:
3
- name: OpenAI o3-mini
4
- parameters: Unknown
5
- description: Fast, flexible, intelligent reasoning model
6
- to_param: o3-mini
7
- o1:
8
- name: OpenAI o1
9
- parameters: Unknown
10
- description: High-intelligence reasoning model
11
- to_param: o1
12
- o1-mini:
13
- name: OpenAI o1-mini
14
- parameters: Unknown
15
- description: Faster, more affordable reasoning model than o1
16
- to_param: o1-mini
17
- o1-pro:
18
- name: OpenAI o1-pro
19
- parameters: Unknown
20
- description: More compute than o1 for better responses
21
- to_param: o1-pro
22
- gpt-4.5-preview:
23
- name: GPT-4.5 Preview
24
- parameters: Unknown
25
- description: Largest and most capable GPT model
26
- to_param: gpt-4.5-preview
27
- gpt-4o:
28
- name: GPT-4o
29
- parameters: Unknown
30
- description: Fast, intelligent, flexible GPT model
31
- to_param: gpt-4o
32
- gpt-4o-mini:
33
- name: GPT-4o Mini
34
- parameters: Mini
35
- description: Fast, affordable small model for focused tasks
36
- to_param: gpt-4o-mini
37
- gpt-4o-realtime-preview:
38
- name: GPT-4o Realtime
39
- parameters: Unknown
40
- description: Realtime model for text and audio inputs/outputs
41
- to_param: gpt-4o-realtime-preview
42
- gpt-3.5-turbo:
43
- name: GPT-3.5 Turbo
44
- parameters: Unknown
45
- description: Legacy GPT model for cheaper chat and non-chat tasks
46
- to_param: gpt-3.5-turbo