ruby_llm 0.1.0.pre33 → 0.1.0.pre35

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e36a864dcd3852d03d467684aafcc811273f0f44dbd1925484440808c6c8895b
4
- data.tar.gz: 5ed1b436a1b91f7fac06ab76d43fd0c7dfee925cc1af280a10bb40e448dabf0b
3
+ metadata.gz: 586cc8473d06aebb4eb69ee646c8ad90250a522eac80d3471a22ef05e601b9de
4
+ data.tar.gz: 4f060d755a37373230d1364dda3fc8b74fabdf4128206eb4faf2b11fd02090ac
5
5
  SHA512:
6
- metadata.gz: 6dd5a24c4a374a5fd291c7f47363dd282abcc850361464e67859f82ad88f51f49f0d4fda89299cf3871df838896acb111170a3615963c215a2aedb6b4154d0bd
7
- data.tar.gz: 07f0931ca91abe8c42b7ca52910f4ac31f34ec4e049a321a7a4d59808cd190813aab1534312bb279d609a94f2ee6fbb2164faa6330a82a80ff520697741a7088
6
+ metadata.gz: 8e10930fd06b2dbdbaca81aa93f45cde41e8d1199173597e29d94af7ea073db470a91be9869f89b622aebc28d915510baf070ac6655ddbbe1591a94fbef7b2f8
7
+ data.tar.gz: de99a1e6173f25b3c3bc7222910f6d1c8771b4c4f1062e8970f9472c7f551543c345cdffb1b3733ebd510e2351c27b5b274d483ba7047a32d90884b62577cb18
@@ -37,9 +37,17 @@ jobs:
37
37
  DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
38
38
  run: bundle exec rspec
39
39
 
40
+ - name: Upload coverage to Codecov
41
+ uses: codecov/codecov-action@v5
42
+ env:
43
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
44
+ with:
45
+ files: ./coverage/coverage.xml
46
+ fail_ci_if_error: false
47
+
40
48
  publish:
41
49
  name: Build + Publish
42
- # needs: test
50
+ needs: test
43
51
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'
44
52
  runs-on: ubuntu-latest
45
53
  permissions:
@@ -62,7 +70,15 @@ jobs:
62
70
  chmod 0600 $HOME/.gem/credentials
63
71
  printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
64
72
  gem build *.gemspec
65
- gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
73
+ output=$(gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem 2>&1) || {
74
+ echo "$output"
75
+ if echo "$output" | grep -q "already been pushed"; then
76
+ echo "Version already exists, skipping"
77
+ exit 0
78
+ else
79
+ exit 1
80
+ fi
81
+ }
66
82
  env:
67
83
  GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
68
84
  OWNER: ${{ github.repository_owner }}
@@ -74,6 +90,14 @@ jobs:
74
90
  chmod 0600 $HOME/.gem/credentials
75
91
  printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
76
92
  gem build *.gemspec
77
- gem push *.gem
93
+ output=$(gem push *.gem 2>&1) || {
94
+ echo "$output"
95
+ if echo "$output" | grep -q "Repushing of gem versions is not allowed"; then
96
+ echo "Version already exists, skipping"
97
+ exit 0
98
+ else
99
+ exit 1
100
+ fi
101
+ }
78
102
  env:
79
103
  GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.rspec_status CHANGED
@@ -1,38 +1,35 @@
1
1
  example_id | status | run_time |
2
2
  -------------------------------------------------- | ------ | --------------- |
3
- ./spec/integration/chat_spec.rb[1:1:1:1] | passed | 0.5826 seconds |
4
- ./spec/integration/chat_spec.rb[1:1:1:2] | passed | 3.43 seconds |
5
- ./spec/integration/chat_spec.rb[1:1:2:1] | passed | 0.49383 seconds |
6
- ./spec/integration/chat_spec.rb[1:1:2:2] | passed | 1.36 seconds |
7
- ./spec/integration/chat_spec.rb[1:1:3:1] | passed | 0.74049 seconds |
8
- ./spec/integration/chat_spec.rb[1:1:3:2] | passed | 4.11 seconds |
9
- ./spec/integration/content_spec.rb[1:1:1] | passed | 3.87 seconds |
10
- ./spec/integration/content_spec.rb[1:1:2] | passed | 1.23 seconds |
11
- ./spec/integration/content_spec.rb[1:1:3] | passed | 2.07 seconds |
12
- ./spec/integration/content_spec.rb[1:2:1] | passed | 2.05 seconds |
13
- ./spec/integration/content_spec.rb[1:2:2] | passed | 2.88 seconds |
14
- ./spec/integration/embeddings_spec.rb[1:1:1:1] | passed | 0.30185 seconds |
15
- ./spec/integration/embeddings_spec.rb[1:1:1:2] | passed | 0.30812 seconds |
16
- ./spec/integration/embeddings_spec.rb[1:1:2:1] | passed | 13.05 seconds |
17
- ./spec/integration/embeddings_spec.rb[1:1:2:2] | passed | 0.78135 seconds |
18
- ./spec/integration/error_handling_spec.rb[1:1] | passed | 0.21297 seconds |
19
- ./spec/integration/image_generation_spec.rb[1:1:1] | passed | 12.44 seconds |
20
- ./spec/integration/image_generation_spec.rb[1:1:2] | passed | 17.66 seconds |
21
- ./spec/integration/image_generation_spec.rb[1:1:3] | passed | 0.00324 seconds |
22
- ./spec/integration/image_generation_spec.rb[1:1:4] | failed | 0.15682 seconds |
23
- ./spec/integration/image_generation_spec.rb[1:1:5] | passed | 18.69 seconds |
24
- ./spec/integration/image_generation_spec.rb[1:1:6] | passed | 0.00032 seconds |
25
- ./spec/integration/rails_spec.rb[1:1] | passed | 4.05 seconds |
26
- ./spec/integration/rails_spec.rb[1:2] | passed | 1.82 seconds |
27
- ./spec/integration/streaming_spec.rb[1:1:1:1] | passed | 0.58445 seconds |
28
- ./spec/integration/streaming_spec.rb[1:1:1:2] | passed | 6.04 seconds |
29
- ./spec/integration/streaming_spec.rb[1:1:2:1] | passed | 0.47171 seconds |
30
- ./spec/integration/streaming_spec.rb[1:1:2:2] | passed | 2.39 seconds |
31
- ./spec/integration/streaming_spec.rb[1:1:3:1] | passed | 0.72016 seconds |
32
- ./spec/integration/streaming_spec.rb[1:1:3:2] | passed | 3.59 seconds |
33
- ./spec/integration/tools_spec.rb[1:1:1:1] | passed | 3.1 seconds |
34
- ./spec/integration/tools_spec.rb[1:1:1:2] | passed | 7.04 seconds |
35
- ./spec/integration/tools_spec.rb[1:1:2:1] | passed | 1.42 seconds |
36
- ./spec/integration/tools_spec.rb[1:1:2:2] | passed | 2.24 seconds |
37
- ./spec/integration/tools_spec.rb[1:1:3:1] | passed | 2.16 seconds |
38
- ./spec/integration/tools_spec.rb[1:1:3:2] | passed | 5.26 seconds |
3
+ ./spec/integration/chat_spec.rb[1:1:1:1] | passed | 0.84333 seconds |
4
+ ./spec/integration/chat_spec.rb[1:1:1:2] | passed | 3.81 seconds |
5
+ ./spec/integration/chat_spec.rb[1:1:2:1] | passed | 0.54605 seconds |
6
+ ./spec/integration/chat_spec.rb[1:1:2:2] | passed | 1.25 seconds |
7
+ ./spec/integration/chat_spec.rb[1:1:3:1] | passed | 0.66439 seconds |
8
+ ./spec/integration/chat_spec.rb[1:1:3:2] | passed | 2.84 seconds |
9
+ ./spec/integration/content_spec.rb[1:1:1] | passed | 3.51 seconds |
10
+ ./spec/integration/content_spec.rb[1:1:2] | passed | 1.11 seconds |
11
+ ./spec/integration/content_spec.rb[1:1:3] | passed | 1.77 seconds |
12
+ ./spec/integration/content_spec.rb[1:2:1] | passed | 1.68 seconds |
13
+ ./spec/integration/content_spec.rb[1:2:2] | passed | 2.01 seconds |
14
+ ./spec/integration/embeddings_spec.rb[1:1:1:1] | passed | 0.28694 seconds |
15
+ ./spec/integration/embeddings_spec.rb[1:1:1:2] | passed | 0.32456 seconds |
16
+ ./spec/integration/embeddings_spec.rb[1:1:2:1] | passed | 0.85006 seconds |
17
+ ./spec/integration/embeddings_spec.rb[1:1:2:2] | passed | 0.82832 seconds |
18
+ ./spec/integration/error_handling_spec.rb[1:1] | passed | 0.19746 seconds |
19
+ ./spec/integration/image_generation_spec.rb[1:1:1] | passed | 10.73 seconds |
20
+ ./spec/integration/image_generation_spec.rb[1:1:2] | passed | 16.95 seconds |
21
+ ./spec/integration/image_generation_spec.rb[1:1:3] | passed | 0.00024 seconds |
22
+ ./spec/integration/rails_spec.rb[1:1] | passed | 3.39 seconds |
23
+ ./spec/integration/rails_spec.rb[1:2] | passed | 1.74 seconds |
24
+ ./spec/integration/streaming_spec.rb[1:1:1:1] | passed | 0.56418 seconds |
25
+ ./spec/integration/streaming_spec.rb[1:1:1:2] | passed | 6.33 seconds |
26
+ ./spec/integration/streaming_spec.rb[1:1:2:1] | passed | 0.51911 seconds |
27
+ ./spec/integration/streaming_spec.rb[1:1:2:2] | passed | 2.31 seconds |
28
+ ./spec/integration/streaming_spec.rb[1:1:3:1] | passed | 0.78299 seconds |
29
+ ./spec/integration/streaming_spec.rb[1:1:3:2] | passed | 3.82 seconds |
30
+ ./spec/integration/tools_spec.rb[1:1:1:1] | passed | 3.89 seconds |
31
+ ./spec/integration/tools_spec.rb[1:1:1:2] | passed | 7.78 seconds |
32
+ ./spec/integration/tools_spec.rb[1:1:2:1] | passed | 1.25 seconds |
33
+ ./spec/integration/tools_spec.rb[1:1:2:2] | passed | 2.1 seconds |
34
+ ./spec/integration/tools_spec.rb[1:1:3:1] | passed | 1.59 seconds |
35
+ ./spec/integration/tools_spec.rb[1:1:3:2] | passed | 3.05 seconds |
data/README.md CHANGED
@@ -12,8 +12,13 @@ A delightful Ruby way to work with AI. Chat in text, analyze and generate images
12
12
  <img src="https://upload.wikimedia.org/wikipedia/commons/e/ec/DeepSeek_logo.svg" alt="DeepSeek" height="40" width="120">
13
13
  </p>
14
14
 
15
- [![Gem Version](https://badge.fury.io/rb/ruby_llm.svg)](https://badge.fury.io/rb/ruby_llm)
16
- [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
15
+ <p align="center">
16
+ <a href="https://badge.fury.io/rb/ruby_llm"><img src="https://badge.fury.io/rb/ruby_llm.svg" alt="Gem Version" /></a>
17
+ <a href="https://github.com/testdouble/standard"><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="Ruby Style Guide" /></a>
18
+ <a href="https://rubygems.org/gems/ruby_llm"><img alt="Gem Total Downloads" src="https://img.shields.io/gem/dt/ruby_llm"></a>
19
+ <a href="https://github.com/crmne/ruby_llm/actions/workflows/cicd.yml"><img src="https://github.com/crmne/ruby_llm/actions/workflows/cicd.yml/badge.svg" alt="CI" /></a>
20
+ <a href="https://codecov.io/gh/crmne/ruby_llm"><img src="https://codecov.io/gh/crmne/ruby_llm/branch/main/graph/badge.svg" alt="codecov" /></a>
21
+ </p>
17
22
 
18
23
  ## Features
19
24
 
@@ -114,7 +119,7 @@ last_message = chat.messages.last
114
119
  puts "Conversation used #{last_message.input_tokens} input tokens and #{last_message.output_tokens} output tokens"
115
120
  ```
116
121
 
117
- You can provide content as local files or URLs - RubyLLM handles the rest. Vision and audio capabilities are available with compatible models (Claude 3, GPT-4V, Gemini Pro Vision). The API stays clean and consistent whether you're working with text, images, or audio.
122
+ You can provide content as local files or URLs - RubyLLM handles the rest. Vision and audio capabilities are available with compatible models. The API stays clean and consistent whether you're working with text, images, or audio.
118
123
 
119
124
  ## Image Generation
120
125
 
@@ -155,6 +155,22 @@
155
155
  "output_price_per_million": 15.0,
156
156
  "metadata": {}
157
157
  },
158
+ {
159
+ "id": "claude-3-7-sonnet-20250219",
160
+ "created_at": "2025-02-19T00:00:00Z",
161
+ "display_name": "Claude 3.7 Sonnet",
162
+ "provider": "anthropic",
163
+ "context_window": 200000,
164
+ "max_tokens": 4096,
165
+ "type": "chat",
166
+ "family": "claude2",
167
+ "supports_vision": true,
168
+ "supports_functions": true,
169
+ "supports_json_mode": true,
170
+ "input_price_per_million": 3.0,
171
+ "output_price_per_million": 15.0,
172
+ "metadata": {}
173
+ },
158
174
  {
159
175
  "id": "claude-3-haiku-20240307",
160
176
  "created_at": "2024-03-07T00:00:00Z",
@@ -830,6 +846,44 @@
830
846
  "owned_by": "google"
831
847
  }
832
848
  },
849
+ {
850
+ "id": "gemini-2.0-flash-lite",
851
+ "created_at": null,
852
+ "display_name": "Gemini 2.0 Flash Lite",
853
+ "provider": "gemini",
854
+ "context_window": 1048576,
855
+ "max_tokens": 8192,
856
+ "type": "chat",
857
+ "family": "gemini20_flash_lite",
858
+ "supports_vision": true,
859
+ "supports_functions": false,
860
+ "supports_json_mode": true,
861
+ "input_price_per_million": 0.075,
862
+ "output_price_per_million": 0.3,
863
+ "metadata": {
864
+ "object": "model",
865
+ "owned_by": "google"
866
+ }
867
+ },
868
+ {
869
+ "id": "gemini-2.0-flash-lite-001",
870
+ "created_at": null,
871
+ "display_name": "Gemini 2.0 Flash Lite 001",
872
+ "provider": "gemini",
873
+ "context_window": 1048576,
874
+ "max_tokens": 8192,
875
+ "type": "chat",
876
+ "family": "gemini20_flash_lite",
877
+ "supports_vision": true,
878
+ "supports_functions": false,
879
+ "supports_json_mode": true,
880
+ "input_price_per_million": 0.075,
881
+ "output_price_per_million": 0.3,
882
+ "metadata": {
883
+ "object": "model",
884
+ "owned_by": "google"
885
+ }
886
+ },
833
887
  {
834
888
  "id": "gemini-2.0-flash-lite-preview",
835
889
  "created_at": null,
@@ -868,6 +922,44 @@
868
922
  "owned_by": "google"
869
923
  }
870
924
  },
925
+ {
926
+ "id": "gemini-2.0-flash-mmgen-rev17",
927
+ "created_at": null,
928
+ "display_name": "Gemini 2.0 Flash Mmgen Rev17",
929
+ "provider": "gemini",
930
+ "context_window": 1048576,
931
+ "max_tokens": 8192,
932
+ "type": "chat",
933
+ "family": "gemini20_flash",
934
+ "supports_vision": true,
935
+ "supports_functions": true,
936
+ "supports_json_mode": true,
937
+ "input_price_per_million": 0.1,
938
+ "output_price_per_million": 0.4,
939
+ "metadata": {
940
+ "object": "model",
941
+ "owned_by": "google"
942
+ }
943
+ },
944
+ {
945
+ "id": "gemini-2.0-flash-thinking-001",
946
+ "created_at": null,
947
+ "display_name": "Gemini 2.0 Flash Thinking 001",
948
+ "provider": "gemini",
949
+ "context_window": 1048576,
950
+ "max_tokens": 8192,
951
+ "type": "chat",
952
+ "family": "gemini20_flash",
953
+ "supports_vision": true,
954
+ "supports_functions": true,
955
+ "supports_json_mode": true,
956
+ "input_price_per_million": 0.1,
957
+ "output_price_per_million": 0.4,
958
+ "metadata": {
959
+ "object": "model",
960
+ "owned_by": "google"
961
+ }
962
+ },
871
963
  {
872
964
  "id": "gemini-2.0-flash-thinking-exp",
873
965
  "created_at": null,
@@ -1077,6 +1169,25 @@
1077
1169
  "owned_by": "google"
1078
1170
  }
1079
1171
  },
1172
+ {
1173
+ "id": "gemma-3-27b-it",
1174
+ "created_at": null,
1175
+ "display_name": "Gemma 3 27b It",
1176
+ "provider": "gemini",
1177
+ "context_window": 32768,
1178
+ "max_tokens": 4096,
1179
+ "type": "chat",
1180
+ "family": "other",
1181
+ "supports_vision": false,
1182
+ "supports_functions": false,
1183
+ "supports_json_mode": false,
1184
+ "input_price_per_million": 0.075,
1185
+ "output_price_per_million": 0.3,
1186
+ "metadata": {
1187
+ "object": "model",
1188
+ "owned_by": "google"
1189
+ }
1190
+ },
1080
1191
  {
1081
1192
  "id": "gpt-3.5-turbo",
1082
1193
  "created_at": "2023-02-28T19:56:42+01:00",
@@ -2046,6 +2157,25 @@
2046
2157
  "owned_by": "system"
2047
2158
  }
2048
2159
  },
2160
+ {
2161
+ "id": "veo-2.0-generate-001",
2162
+ "created_at": null,
2163
+ "display_name": "Veo 2.0 Generate 001",
2164
+ "provider": "gemini",
2165
+ "context_window": 32768,
2166
+ "max_tokens": 4096,
2167
+ "type": "chat",
2168
+ "family": "other",
2169
+ "supports_vision": false,
2170
+ "supports_functions": false,
2171
+ "supports_json_mode": false,
2172
+ "input_price_per_million": 0.075,
2173
+ "output_price_per_million": 0.3,
2174
+ "metadata": {
2175
+ "object": "model",
2176
+ "owned_by": "google"
2177
+ }
2178
+ },
2049
2179
  {
2050
2180
  "id": "whisper-1",
2051
2181
  "created_at": "2023-02-27T22:13:04+01:00",
@@ -53,9 +53,7 @@ module RubyLLM
53
53
  end
54
54
 
55
55
  def refresh!
56
- @all = RubyLLM.providers.flat_map do |provider|
57
- provider.new.list_models
58
- end.sort_by(&:id)
56
+ @all = RubyLLM.providers.flat_map(&:list_models).sort_by(&:id)
59
57
  end
60
58
  end
61
59
  end
@@ -23,7 +23,7 @@ module RubyLLM
23
23
  req.headers.merge! headers
24
24
  end
25
25
 
26
- parse_list_models_response response
26
+ parse_list_models_response response, slug, capabilities
27
27
  end
28
28
 
29
29
  def embed(text, model:)
@@ -150,15 +150,6 @@ module RubyLLM
150
150
  body.is_a?(Hash) ? body.dig('error', 'message') : body
151
151
  end
152
152
 
153
- def capabilities
154
- provider_name = self.class.name.split('::').last
155
- provider_name::Capabilities
156
- end
157
-
158
- def slug
159
- self.class.name.split('::').last.downcase
160
- end
161
-
162
153
  class << self
163
154
  def extended(base)
164
155
  base.extend(Methods)
@@ -11,7 +11,7 @@ module RubyLLM
11
11
  '/v1/models'
12
12
  end
13
13
 
14
- def parse_list_models_response(response) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
14
+ def parse_list_models_response(response, slug, capabilities) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
15
15
  (response.body['data'] || []).map do |model|
16
16
  ModelInfo.new(
17
17
  id: model['id'],
@@ -24,6 +24,14 @@ module RubyLLM
24
24
  'anthropic-version' => '2023-06-01'
25
25
  }
26
26
  end
27
+
28
+ def capabilities
29
+ Anthropic::Capabilities
30
+ end
31
+
32
+ def slug
33
+ 'anthropic'
34
+ end
27
35
  end
28
36
  end
29
37
  end
@@ -17,6 +17,14 @@ module RubyLLM
17
17
  'Authorization' => "Bearer #{RubyLLM.config.deepseek_api_key}"
18
18
  }
19
19
  end
20
+
21
+ def capabilities
22
+ DeepSeek::Capabilities
23
+ end
24
+
25
+ def slug
26
+ 'deepseek'
27
+ end
20
28
  end
21
29
  end
22
30
  end
@@ -126,8 +126,6 @@ module RubyLLM
126
126
  end
127
127
  end
128
128
 
129
- private
130
-
131
129
  def long_context_model?(model_id)
132
130
  model_id.match?(/gemini-1\.5-(?:pro|flash)/)
133
131
  end
@@ -7,12 +7,12 @@ module RubyLLM
7
7
  module Models
8
8
  module_function
9
9
 
10
- def parse_list_models_response(response)
10
+ def parse_list_models_response(response, slug, capabilities)
11
11
  response.body['data']&.each do |model|
12
12
  model['id'] = model['id'].delete_prefix('models/')
13
13
  end
14
14
 
15
- OpenAI::Models.parse_list_models_response(response)
15
+ OpenAI::Models.parse_list_models_response(response, slug, capabilities)
16
16
  end
17
17
  end
18
18
  end
@@ -18,6 +18,14 @@ module RubyLLM
18
18
  'Authorization' => "Bearer #{RubyLLM.config.gemini_api_key}"
19
19
  }
20
20
  end
21
+
22
+ def capabilities
23
+ Gemini::Capabilities
24
+ end
25
+
26
+ def slug
27
+ 'gemini'
28
+ end
21
29
  end
22
30
  end
23
31
  end
@@ -107,8 +107,6 @@ module RubyLLM
107
107
  end
108
108
  end
109
109
 
110
- private
111
-
112
110
  PRICES = {
113
111
  o1: { input: 15.0, cached_input: 7.5, output: 60.0 },
114
112
  o1_mini: { input: 1.10, cached_input: 0.55, output: 4.40 },
@@ -11,7 +11,7 @@ module RubyLLM
11
11
  'models'
12
12
  end
13
13
 
14
- def parse_list_models_response(response) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
14
+ def parse_list_models_response(response, slug, capabilities) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
15
15
  (response.body['data'] || []).map do |model|
16
16
  ModelInfo.new(
17
17
  id: model['id'],
@@ -37,6 +37,14 @@ module RubyLLM
37
37
  'Authorization' => "Bearer #{RubyLLM.config.openai_api_key}"
38
38
  }
39
39
  end
40
+
41
+ def capabilities
42
+ OpenAI::Capabilities
43
+ end
44
+
45
+ def slug
46
+ 'openai'
47
+ end
40
48
  end
41
49
  end
42
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLLM
4
- VERSION = '0.1.0.pre33'
4
+ VERSION = '0.1.0.pre35'
5
5
  end
@@ -12,7 +12,7 @@ PROVIDER_DOCS = {
12
12
  },
13
13
  gemini: {
14
14
  models: 'https://ai.google.dev/gemini-api/docs/models/gemini',
15
- pricing: 'https://ai.google.dev/pricing'
15
+ pricing: 'https://ai.google.dev/gemini-api/docs/pricing'
16
16
  },
17
17
  deepseek: {
18
18
  models: 'https://api-docs.deepseek.com/quick_start/pricing/'
@@ -102,11 +102,12 @@ namespace :models do # rubocop:disable Metrics/BlockLength
102
102
  puts "Processing #{provider}..."
103
103
 
104
104
  # Initialize our AI assistants
105
+ #
105
106
  gemini = RubyLLM.chat(model: 'gemini-2.0-flash').with_temperature(0)
106
- claude = RubyLLM.chat(model: 'claude-3-5-sonnet-20241022').with_temperature(0)
107
+ claude = RubyLLM.chat(model: 'claude-3-7-sonnet-20250219').with_temperature(0)
107
108
 
108
109
  # Read existing capabilities file if present
109
- existing_file = "lib/ruby_llm/model_capabilities/#{provider}.rb"
110
+ existing_file = "lib/ruby_llm/providers/#{provider}/capabilities.rb"
110
111
  existing_code = File.read(existing_file) if File.exist?(existing_file)
111
112
 
112
113
  begin
@@ -155,18 +156,17 @@ namespace :models do # rubocop:disable Metrics/BlockLength
155
156
 
156
157
  #{model_info}
157
158
 
158
- The module should go in lib/ruby_llm/model_capabilities/#{provider}.rb and follow these conventions:
159
+ The module should go in lib/ruby_llm/providers/#{provider}/capabilities.rb and follow these conventions:
159
160
 
160
- 1. Module name should be RubyLLM::ModelCapabilities::#{provider.to_s.capitalize}
161
- 2. Include methods for determining context windows, token limits, pricing, and capabilities
162
- 3. Use consistent naming with other providers
163
- 4. Include detailed pricing information in a PRICES constant
164
- 5. Follow the existing structure in the codebase
165
- 6. Use Ruby idioms and clean code practices
166
- 7. Include module_function to make methods callable at module level
167
- 8. Include all necessary method documentation
161
+ 1. Include methods for determining context windows, token limits, pricing, and capabilities
162
+ 2. Use consistent naming with other providers
163
+ 3. Include detailed pricing information in a PRICES constant
164
+ 4. Follow the existing structure in the codebase
165
+ 5. Use Ruby idioms and clean code practices
166
+ 6. Include module_function to make methods callable at module level
167
+ 7. Include all necessary method documentation
168
168
 
169
- Here's the existing implementation for reference (maintain similar structure):
169
+ Here's the existing implementation for reference (maintain similar structure and same method names):
170
170
 
171
171
  #{existing_code}
172
172
 
@@ -176,7 +176,7 @@ namespace :models do # rubocop:disable Metrics/BlockLength
176
176
  response = claude.ask(code_prompt)
177
177
 
178
178
  # Save the file
179
- file_path = "lib/ruby_llm/model_capabilities/#{provider}.rb"
179
+ file_path = "lib/ruby_llm/providers/#{provider}/capabilities.rb"
180
180
  puts " Writing #{file_path}..."
181
181
 
182
182
  FileUtils.mkdir_p(File.dirname(file_path))
data/ruby_llm.gemspec CHANGED
@@ -45,6 +45,7 @@ Gem::Specification.new do |spec|
45
45
 
46
46
  # Development dependencies
47
47
  spec.add_development_dependency 'bundler', '>= 2.0'
48
+ spec.add_development_dependency 'codecov'
48
49
  spec.add_development_dependency 'dotenv'
49
50
  spec.add_development_dependency 'irb'
50
51
  spec.add_development_dependency 'nokogiri'
@@ -57,6 +58,7 @@ Gem::Specification.new do |spec|
57
58
  spec.add_development_dependency 'rubocop', '>= 1.0'
58
59
  spec.add_development_dependency 'rubocop-rake', '>= 0.6'
59
60
  spec.add_development_dependency 'simplecov', '>= 0.21'
61
+ spec.add_development_dependency 'simplecov-cobertura'
60
62
  spec.add_development_dependency 'sqlite3'
61
63
  spec.add_development_dependency 'webmock', '~> 3.18'
62
64
  spec.add_development_dependency 'yard', '>= 0.9'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre33
4
+ version: 0.1.0.pre35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carmine Paolino
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-20 00:00:00.000000000 Z
11
+ date: 2025-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: event_stream_parser
@@ -140,6 +140,20 @@ dependencies:
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
142
  version: '2.0'
143
+ - !ruby/object:Gem::Dependency
144
+ name: codecov
145
+ requirement: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
143
157
  - !ruby/object:Gem::Dependency
144
158
  name: dotenv
145
159
  requirement: !ruby/object:Gem::Requirement
@@ -308,6 +322,20 @@ dependencies:
308
322
  - - ">="
309
323
  - !ruby/object:Gem::Version
310
324
  version: '0.21'
325
+ - !ruby/object:Gem::Dependency
326
+ name: simplecov-cobertura
327
+ requirement: !ruby/object:Gem::Requirement
328
+ requirements:
329
+ - - ">="
330
+ - !ruby/object:Gem::Version
331
+ version: '0'
332
+ type: :development
333
+ prerelease: false
334
+ version_requirements: !ruby/object:Gem::Requirement
335
+ requirements:
336
+ - - ">="
337
+ - !ruby/object:Gem::Version
338
+ version: '0'
311
339
  - !ruby/object:Gem::Dependency
312
340
  name: sqlite3
313
341
  requirement: !ruby/object:Gem::Requirement
@@ -395,7 +423,7 @@ files:
395
423
  - lib/ruby_llm/providers/anthropic/streaming.rb
396
424
  - lib/ruby_llm/providers/anthropic/tools.rb
397
425
  - lib/ruby_llm/providers/deepseek.rb
398
- - lib/ruby_llm/providers/deepseek/capabilites.rb
426
+ - lib/ruby_llm/providers/deepseek/capabilities.rb
399
427
  - lib/ruby_llm/providers/gemini.rb
400
428
  - lib/ruby_llm/providers/gemini/capabilities.rb
401
429
  - lib/ruby_llm/providers/gemini/models.rb