lex-llm-azure-foundry 0.2.5 → 0.2.7

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: dc801cd438178d5431250e6b2dbfb3d2b6dce8af6fb7a266cd2bf65eeb24b7a9
4
- data.tar.gz: '04928abba688736869565f51365019a470980ddf4502d866d0a3f169bb30524b'
3
+ metadata.gz: 2685de78719c6f5733c93f2b9b66bfbc568115fa40c332754a7ce27ce2cf74ea
4
+ data.tar.gz: 4af76d69f22a4c6df093e4916def72c7e7b13ff5c27589e9db099dc815dad051
5
5
  SHA512:
6
- metadata.gz: 93d13277c3dfbe8bdb683f623d65800e8bedc771541573684f7181ff81fa49fb37f0a7c228aa87bf9f380f5685682760ba1e5b91720fb6e434bb9a28ae3c606c
7
- data.tar.gz: cca5a4ea13dde3029a3402cec8dd58ced8592572236d7646cd6162f27473a143f434838c7495d67ec366553b647b142d99981631a30a9136eed0785479fd4c29
6
+ metadata.gz: 520b040a7aadd89ce62fe7213a4c1a16d2a769ab0236e9672b47635157c445957cb52d58dcae63e5231aa3070e1e4b8be2104785383b5e7042da82d74c3ecf51
7
+ data.tar.gz: 91c9bdf31e9767f1f93e1ac2bc85ae07a73974bd9be5959c7e3f1281161036bcc26fed59eed7766cba813148db9a8aefcdd1600e409b379adbd5f23198337999
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.7 - 2026-06-02
4
+
5
+ - Add per-provider scoped discovery refresh actor
6
+
7
+ ## 0.2.6 - 2026-05-21
8
+
9
+ - Add `default_transport`/`default_tier` class declarations, remove `configured_transport`/`configured_tier`
10
+ - Add `model_allowed?` filtering in `discover_offerings`
11
+ - Default tier set to :cloud
12
+ - Identity headers included via base provider
13
+
14
+
3
15
  ## 0.2.5 - 2026-05-06
4
16
 
5
17
  - Load provider-owned fleet actors through the LegionIO subscription base and the canonical Azure Foundry provider root.
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'legion/extensions/actors/every'
5
+ rescue LoadError => e
6
+ warn(e.message) if $VERBOSE
7
+ end
8
+
9
+ return unless defined?(Legion::Extensions::Actors::Every)
10
+
11
+ module Legion
12
+ module Extensions
13
+ module Llm
14
+ module AzureFoundry
15
+ module Actor
16
+ class DiscoveryRefresh < Legion::Extensions::Actors::Every # rubocop:disable Style/Documentation
17
+ include Legion::Logging::Helper
18
+
19
+ REFRESH_INTERVAL = 1800
20
+
21
+ def runner_class = self.class
22
+ def runner_function = 'manual'
23
+ def run_now? = true
24
+ def use_runner? = false
25
+ def check_subtask? = false
26
+ def generate_task? = false
27
+
28
+ def time
29
+ return REFRESH_INTERVAL unless defined?(Legion::Settings)
30
+
31
+ Legion::Settings.dig(:extensions, :llm, :azure_foundry, :discovery_interval) || REFRESH_INTERVAL
32
+ end
33
+
34
+ def manual
35
+ log.debug('[azure_foundry][discovery_refresh] refreshing model list')
36
+ return unless defined?(Legion::LLM::Discovery)
37
+
38
+ Legion::LLM::Discovery.refresh_discovered_models!(provider: :azure_foundry)
39
+ rescue StandardError => e
40
+ handle_exception(e, level: :warn, handled: true, operation: 'azure_foundry.actor.discovery_refresh')
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -18,6 +18,8 @@ module Legion
18
18
 
19
19
  class << self
20
20
  def slug = 'azure_foundry'
21
+ def default_transport = :http
22
+ def default_tier = :cloud
21
23
  def configuration_requirements = %i[azure_foundry_endpoint]
22
24
 
23
25
  def configuration_options
@@ -128,10 +130,10 @@ module Legion
128
130
  end
129
131
 
130
132
  def headers
131
- {
133
+ identity_headers.merge({
132
134
  'api-key' => config.azure_foundry_api_key,
133
135
  'Authorization' => bearer_header
134
- }.compact
136
+ }.compact)
135
137
  end
136
138
 
137
139
  def completion_url = path_for('chat/completions')
@@ -143,10 +145,10 @@ module Legion
143
145
 
144
146
  def discover_offerings(live: false, **filters)
145
147
  log.info { "discovering offerings live=#{live} from #{api_base}" }
146
- offerings = configured_deployments.filter_map { |deployment| offering_from_config(deployment) }
147
- return filter_offerings(offerings, **filters) unless live
148
+ offerings = filter_offerings(allowed_offerings, **filters)
149
+ return offerings unless live
148
150
 
149
- filter_offerings(offerings, **filters).map do |offering|
151
+ offerings.map do |offering|
150
152
  with_live_metadata(offering)
151
153
  rescue StandardError => e
152
154
  handle_exception(e, level: :warn, handled: true, operation: 'azure_foundry.discover_offerings')
@@ -300,6 +302,18 @@ module Legion
300
302
  self.class.normalize_deployments(config.azure_foundry_deployments)
301
303
  end
302
304
 
305
+ def allowed_offerings
306
+ configured_deployments.filter_map do |deployment|
307
+ offering = offering_from_config(deployment)
308
+ next unless offering
309
+
310
+ mid = offering.respond_to?(:model) ? offering.model : (offering[:model] || deployment[:model])
311
+ next unless model_allowed?(mid.to_s)
312
+
313
+ offering
314
+ end
315
+ end
316
+
303
317
  def offering_from_config(deployment)
304
318
  deployment_name = value_for(deployment, :deployment) || value_for(deployment, :model)
305
319
  return nil if deployment_name.to_s.empty?
@@ -319,8 +333,8 @@ module Legion
319
333
  Legion::Extensions::Llm::Routing::ModelOffering.new(
320
334
  provider_family: :azure_foundry,
321
335
  instance_id: instance_id,
322
- transport: configured_transport(:http),
323
- tier: configured_tier(:frontier),
336
+ transport: offering_transport,
337
+ tier: offering_tier,
324
338
  model: model,
325
339
  usage_type: usage_type.to_sym,
326
340
  capabilities: capabilities,
@@ -332,14 +346,6 @@ module Legion
332
346
  )
333
347
  end
334
348
 
335
- def configured_transport(default)
336
- config.respond_to?(:transport) ? config.transport : default
337
- end
338
-
339
- def configured_tier(default)
340
- config.respond_to?(:tier) ? config.tier : default
341
- end
342
-
343
349
  def with_live_metadata(offering)
344
350
  response = connection.get(models_url)
345
351
  metadata = offering.metadata.merge(model_info: response.body)
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Llm
6
6
  module AzureFoundry
7
- VERSION = '0.2.5'
7
+ VERSION = '0.2.7'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-llm-azure-foundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - LegionIO
@@ -98,6 +98,7 @@ files:
98
98
  - README.md
99
99
  - lex-llm-azure-foundry.gemspec
100
100
  - lib/legion/extensions/llm/azure_foundry.rb
101
+ - lib/legion/extensions/llm/azure_foundry/actors/discovery_refresh.rb
101
102
  - lib/legion/extensions/llm/azure_foundry/actors/fleet_worker.rb
102
103
  - lib/legion/extensions/llm/azure_foundry/provider.rb
103
104
  - lib/legion/extensions/llm/azure_foundry/runners/fleet_worker.rb