lex-llm-openai 0.3.8 → 0.3.9

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: 3d33116aa45f6463b2944b15a7a8d980224f279f54fe2b594d8ddd012b4829c8
4
- data.tar.gz: ff186b25cc41b291fd793ebccfa10bbae430157d68e256872a523d62fb3c47f3
3
+ metadata.gz: 808223596350fde35cbbf0145a411842ce1c0a3009d431edd354ce500732666c
4
+ data.tar.gz: 9ed2580c07f4d4b1c35f9b90e8108b4ddbd9f74fa032998447b3639dda67e4db
5
5
  SHA512:
6
- metadata.gz: 8ac4b7136e99c9724e694e64862be714fe3a1dc58c3e289efa0df20b19f5695dbba4b92d1385e58750ac3460f8c2c9c8e265e1af32a209fdd11e756ac00fa866
7
- data.tar.gz: ff75e3d1b712dec1addbe902b3dd79dc130cf38b4ea79b47f3791d3dee241ef49b8e7ef62399d240478f7c754b09e40047a3cf24cb3849fb86bb5a169307ae0c
6
+ metadata.gz: a07fffb4a8a5652e3b14303102bc2811915efc374b32369f50e1d39a6397d44a8a2b7822aebedd300af37cecb1d447cbf3b517fdf8502138077de149c9e9e9ea
7
+ data.tar.gz: 51f75db914319c8c086d8ca63a0127b6ed79d21ee92dd1a3c25c45bc9082ba0b1fde55792f8e6040e20c247baad09147634b079d953606e3a8031063422ad7f2
data/.rubocop.yml CHANGED
@@ -14,6 +14,8 @@ Metrics/BlockLength:
14
14
  - spec/**/*
15
15
  Metrics/ClassLength:
16
16
  Max: 200
17
+ Metrics/ModuleLength:
18
+ Max: 110
17
19
  Metrics/MethodLength:
18
20
  Enabled: false
19
21
  RSpec/ExampleLength:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.9 - 2026-05-13
4
+
5
+ - Change `default_model` from `gpt-4o` to `gpt-5.5` in provider default settings and instance discovery fallback.
6
+ - Inject `default_model` into all discovered provider instances so every instance has an explicit model default.
7
+ - Add `context_window` to all `CAPABILITY_MAP` entries (gpt-4o=128K, gpt-4.1/gpt-5=1M, o3/o4/o1=200K, text-embedding=8K).
8
+ - Override `fetch_model_detail` to return `context_window` from the capability map instead of issuing a live API call.
9
+ - Use `model_detail` in `build_model_infos` to populate `context_length` from the cached capability map entry.
10
+
3
11
  ## 0.3.8 - 2026-05-13
4
12
 
5
13
  - Route OpenAI fleet runner and actor diagnostics through `Legion::Logging::Helper` with debug-level request and enablement context.
@@ -19,42 +19,50 @@ module Legion
19
19
  'gpt-4o' => {
20
20
  capabilities: %i[completion streaming function_calling vision structured_output],
21
21
  modalities_input: %w[text image audio],
22
- modalities_output: %w[text]
22
+ modalities_output: %w[text],
23
+ context_window: 128_000
23
24
  },
24
25
  'gpt-4.1' => {
25
26
  capabilities: %i[completion streaming function_calling vision structured_output],
26
27
  modalities_input: %w[text image],
27
- modalities_output: %w[text]
28
+ modalities_output: %w[text],
29
+ context_window: 1_047_576
28
30
  },
29
31
  'gpt-4' => {
30
32
  capabilities: %i[completion streaming function_calling vision],
31
33
  modalities_input: %w[text image],
32
- modalities_output: %w[text]
34
+ modalities_output: %w[text],
35
+ context_window: 128_000
33
36
  },
34
37
  'gpt-5' => {
35
38
  capabilities: %i[completion streaming function_calling vision structured_output reasoning],
36
39
  modalities_input: %w[text image],
37
- modalities_output: %w[text]
40
+ modalities_output: %w[text],
41
+ context_window: 1_047_576
38
42
  },
39
43
  'o4' => {
40
44
  capabilities: %i[completion streaming function_calling vision reasoning],
41
45
  modalities_input: %w[text image],
42
- modalities_output: %w[text]
46
+ modalities_output: %w[text],
47
+ context_window: 200_000
43
48
  },
44
49
  'o3' => {
45
50
  capabilities: %i[completion streaming function_calling vision reasoning],
46
51
  modalities_input: %w[text image],
47
- modalities_output: %w[text]
52
+ modalities_output: %w[text],
53
+ context_window: 200_000
48
54
  },
49
55
  'o1' => {
50
56
  capabilities: %i[completion streaming function_calling vision reasoning],
51
57
  modalities_input: %w[text image],
52
- modalities_output: %w[text]
58
+ modalities_output: %w[text],
59
+ context_window: 200_000
53
60
  },
54
61
  'text-embedding-' => {
55
62
  capabilities: %i[embedding],
56
63
  modalities_input: %w[text],
57
- modalities_output: %w[embeddings]
64
+ modalities_output: %w[embeddings],
65
+ context_window: 8_191
58
66
  },
59
67
  'omni-moderation' => {
60
68
  capabilities: %i[moderation],
@@ -199,12 +207,15 @@ module Legion
199
207
  body.fetch('data', []).map do |raw_model|
200
208
  id = raw_model.fetch('id')
201
209
  cap_entry = capability_entry_for(id)
210
+ detail = model_detail(id)
211
+ ctx = detail&.dig(:context_window) || cap_entry[:context_window]
202
212
 
203
213
  Legion::Extensions::Llm::Model::Info.new(
204
214
  id: id,
205
215
  name: id,
206
216
  provider: :openai,
207
217
  capabilities: cap_entry[:capabilities],
218
+ context_length: ctx,
208
219
  modalities_input: cap_entry[:modalities_input],
209
220
  modalities_output: cap_entry[:modalities_output],
210
221
  metadata: {
@@ -220,7 +231,6 @@ module Legion
220
231
  return entry if model_id.start_with?(prefix)
221
232
  end
222
233
 
223
- # Fallback for unknown models: assume chat-capable
224
234
  {
225
235
  capabilities: %i[completion streaming],
226
236
  modalities_input: %w[text],
@@ -228,6 +238,12 @@ module Legion
228
238
  }
229
239
  end
230
240
 
241
+ def fetch_model_detail(model_name)
242
+ entry = capability_entry_for(model_name)
243
+ ctx = entry[:context_window]
244
+ ctx ? { context_window: ctx } : nil
245
+ end
246
+
231
247
  def model_created_at(value)
232
248
  value.is_a?(Numeric) ? Time.at(value).utc : value
233
249
  end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Llm
6
6
  module Openai
7
- VERSION = '0.3.8'
7
+ VERSION = '0.3.9'
8
8
  end
9
9
  end
10
10
  end
@@ -20,7 +20,7 @@ module Legion
20
20
  family: PROVIDER_FAMILY,
21
21
  instance: {
22
22
  endpoint: 'https://api.openai.com',
23
- default_model: 'gpt-4o',
23
+ default_model: 'gpt-5.5',
24
24
  tier: :frontier,
25
25
  transport: :http,
26
26
  credentials: {
@@ -101,9 +101,11 @@ module Legion
101
101
  candidates[name.to_sym] = normalized.merge(tier: :frontier)
102
102
  end
103
103
 
104
- # 8. Dedup
104
+ # 8. Dedup + inject default_model
105
105
  discovered = CredentialSources.dedup_credentials(candidates).transform_values do |config|
106
- sanitize_instance_config(config)
106
+ sanitized = sanitize_instance_config(config)
107
+ sanitized[:default_model] ||= 'gpt-5.5'
108
+ sanitized
107
109
  end
108
110
  instance_names = discovered.keys.sort_by(&:to_s).join(', ')
109
111
  log.debug { "Discovered #{discovered.size} OpenAI provider instance candidate(s): #{instance_names}" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-llm-openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - LegionIO