lex-llm-openai 0.3.8 → 0.3.10
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 +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +14 -0
- data/lib/legion/extensions/llm/openai/provider.rb +32 -12
- data/lib/legion/extensions/llm/openai/version.rb +1 -1
- data/lib/legion/extensions/llm/openai.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35f7b923651392686a2c504e6ec30249ee8efa6c3f51c7171e18a11d124bc1d8
|
|
4
|
+
data.tar.gz: 7bc891da29aee08bb0bfa4600cd7cea7f0562703b210774d67b543682715143a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2efc2485c6e46d476c654cab015262030455c366546a649011e16be3fc4e0613d1d46d45ff5122d68a7335612bda14c9cebee0cff37012bfce7ee2df1a35687f
|
|
7
|
+
data.tar.gz: 72c4c111bf0c447e0e8646067508382e52524de22f66381824f143f8717edbadf17d424ff12c4935c773e670d8a46aa8e0a2a2c5307f648fbc33ebeaf2b230d8
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.10 - 2026-05-21
|
|
4
|
+
|
|
5
|
+
- api_base reads from settings[:endpoint] fallback
|
|
6
|
+
- Identity headers included via base provider
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 0.3.9 - 2026-05-13
|
|
10
|
+
|
|
11
|
+
- Change `default_model` from `gpt-4o` to `gpt-5.5` in provider default settings and instance discovery fallback.
|
|
12
|
+
- Inject `default_model` into all discovered provider instances so every instance has an explicit model default.
|
|
13
|
+
- Add `context_window` to all `CAPABILITY_MAP` entries (gpt-4o=128K, gpt-4.1/gpt-5=1M, o3/o4/o1=200K, text-embedding=8K).
|
|
14
|
+
- Override `fetch_model_detail` to return `context_window` from the capability map instead of issuing a live API call.
|
|
15
|
+
- Use `model_detail` in `build_model_infos` to populate `context_length` from the cached capability map entry.
|
|
16
|
+
|
|
3
17
|
## 0.3.8 - 2026-05-13
|
|
4
18
|
|
|
5
19
|
- 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],
|
|
@@ -153,16 +161,20 @@ module Legion
|
|
|
153
161
|
|
|
154
162
|
def stream_usage_supported? = true
|
|
155
163
|
|
|
164
|
+
def settings
|
|
165
|
+
Openai.default_settings
|
|
166
|
+
end
|
|
167
|
+
|
|
156
168
|
def api_base
|
|
157
|
-
config.openai_api_base || 'https://api.openai.com'
|
|
169
|
+
config.openai_api_base || settings[:endpoint] || 'https://api.openai.com'
|
|
158
170
|
end
|
|
159
171
|
|
|
160
172
|
def headers
|
|
161
|
-
{
|
|
173
|
+
identity_headers.merge({
|
|
162
174
|
'Authorization' => "Bearer #{config.openai_api_key}",
|
|
163
175
|
'OpenAI-Organization' => config.openai_organization_id,
|
|
164
176
|
'OpenAI-Project' => config.openai_project_id
|
|
165
|
-
}.compact
|
|
177
|
+
}.compact)
|
|
166
178
|
end
|
|
167
179
|
|
|
168
180
|
def chat_url = completion_url
|
|
@@ -199,12 +211,15 @@ module Legion
|
|
|
199
211
|
body.fetch('data', []).map do |raw_model|
|
|
200
212
|
id = raw_model.fetch('id')
|
|
201
213
|
cap_entry = capability_entry_for(id)
|
|
214
|
+
detail = model_detail(id)
|
|
215
|
+
ctx = detail&.dig(:context_window) || cap_entry[:context_window]
|
|
202
216
|
|
|
203
217
|
Legion::Extensions::Llm::Model::Info.new(
|
|
204
218
|
id: id,
|
|
205
219
|
name: id,
|
|
206
220
|
provider: :openai,
|
|
207
221
|
capabilities: cap_entry[:capabilities],
|
|
222
|
+
context_length: ctx,
|
|
208
223
|
modalities_input: cap_entry[:modalities_input],
|
|
209
224
|
modalities_output: cap_entry[:modalities_output],
|
|
210
225
|
metadata: {
|
|
@@ -220,7 +235,6 @@ module Legion
|
|
|
220
235
|
return entry if model_id.start_with?(prefix)
|
|
221
236
|
end
|
|
222
237
|
|
|
223
|
-
# Fallback for unknown models: assume chat-capable
|
|
224
238
|
{
|
|
225
239
|
capabilities: %i[completion streaming],
|
|
226
240
|
modalities_input: %w[text],
|
|
@@ -228,6 +242,12 @@ module Legion
|
|
|
228
242
|
}
|
|
229
243
|
end
|
|
230
244
|
|
|
245
|
+
def fetch_model_detail(model_name)
|
|
246
|
+
entry = capability_entry_for(model_name)
|
|
247
|
+
ctx = entry[:context_window]
|
|
248
|
+
ctx ? { context_window: ctx } : nil
|
|
249
|
+
end
|
|
250
|
+
|
|
231
251
|
def model_created_at(value)
|
|
232
252
|
value.is_a?(Numeric) ? Time.at(value).utc : value
|
|
233
253
|
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-
|
|
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}" }
|