lex-llm-azure-foundry 0.4.2 → 0.4.8
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/.github/workflows/ci.yml +6 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +0 -1
- data/CHANGELOG.md +63 -0
- data/Gemfile +8 -5
- data/README.md +248 -149
- data/lex-llm-azure-foundry.gemspec +2 -4
- data/lib/legion/extensions/llm/azure_foundry/actors/discovery.rb +0 -4
- data/lib/legion/extensions/llm/azure_foundry/actors/fleet_worker.rb +4 -18
- data/lib/legion/extensions/llm/azure_foundry/authentication.rb +101 -0
- data/lib/legion/extensions/llm/azure_foundry/declared_catalog_parser.rb +93 -0
- data/lib/legion/extensions/llm/azure_foundry/deployment_catalog_parser.rb +93 -0
- data/lib/legion/extensions/llm/azure_foundry/endpoint.rb +70 -0
- data/lib/legion/extensions/llm/azure_foundry/helpers/endpoint_access.rb +122 -0
- data/lib/legion/extensions/llm/azure_foundry/helpers/offering_evidence.rb +93 -104
- data/lib/legion/extensions/llm/azure_foundry/helpers/project_catalog.rb +116 -0
- data/lib/legion/extensions/llm/azure_foundry/helpers/project_connection.rb +68 -0
- data/lib/legion/extensions/llm/azure_foundry/model_catalog_parser.rb +31 -95
- data/lib/legion/extensions/llm/azure_foundry/provider.rb +94 -151
- data/lib/legion/extensions/llm/azure_foundry/runners/discovery.rb +74 -137
- data/lib/legion/extensions/llm/azure_foundry/runners/fleet_worker.rb +1 -4
- data/lib/legion/extensions/llm/azure_foundry/settings.rb +31 -0
- data/lib/legion/extensions/llm/azure_foundry/version.rb +1 -1
- data/lib/legion/extensions/llm/azure_foundry.rb +70 -106
- metadata +11 -4
- data/lib/legion/extensions/llm/azure_foundry/helpers/callable.rb +0 -143
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8a8de79561aa047b730c51a625ea7fae9a1acb8825d6c52767c4da09069573a
|
|
4
|
+
data.tar.gz: 2d96e9474562236789c973fd7800802a20c88e86422dbc26f79e5ac99413d69a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72d7ca008c76373ceb1fe3bb0f171a31ab22968c82ededb00148454514e730167a1855ad35101783a512620cdf2e3bb9b4d3757104b4d113074948568cb9e93f
|
|
7
|
+
data.tar.gz: 77cc491ae1c8fc3d0890af213b1a580bdb8c32a156b2a12de967c4e66a86fb9353eee23531eee02f6c7c422ceb2a8bf97d580b9077fc2da79b157f87353debe7
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -7,12 +7,18 @@ on:
|
|
|
7
7
|
jobs:
|
|
8
8
|
ci:
|
|
9
9
|
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
10
|
+
with:
|
|
11
|
+
companion-gems: >-
|
|
12
|
+
{"lex-llm":{"repository":"LegionIO/lex-llm","ref":"c283d5e7db85a736cc9394d448dea98f32eee311"}}
|
|
10
13
|
|
|
11
14
|
excluded-files:
|
|
12
15
|
uses: LegionIO/.github/.github/workflows/excluded-files.yml@main
|
|
13
16
|
|
|
14
17
|
security:
|
|
15
18
|
uses: LegionIO/.github/.github/workflows/security-scan.yml@main
|
|
19
|
+
with:
|
|
20
|
+
companion-gems: >-
|
|
21
|
+
{"lex-llm":{"repository":"LegionIO/lex-llm","ref":"c283d5e7db85a736cc9394d448dea98f32eee311"}}
|
|
16
22
|
|
|
17
23
|
version-changelog:
|
|
18
24
|
uses: LegionIO/.github/.github/workflows/version-changelog.yml@main
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.8] - 2026-11-20
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Use the shared `output_token_limit_key` protocol hook to render OpenAI v1 output allowances as `max_completion_tokens`; keep model-inference allowances as `max_tokens`. Preserve the canonical budget unchanged, emit only one native key, and omit absent limits in buffered and streaming requests.
|
|
7
|
+
- Publish documented GPT-5-mini 2025-08-07 GlobalStandard metadata: 400,000-token context, 128,000-token output allowance, and reasoning/tool/vision/streaming support. Explicit live facts retain precedence and unknown versions remain unknown.
|
|
8
|
+
- Require `lex-llm >= 0.8.11` for the shared output-token key hook. Native reasoning effort values remain unchanged; unsupported effort values are not silently reduced.
|
|
9
|
+
|
|
10
|
+
## [0.4.7] - 2026-11-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Publish documented unsupported thinking evidence for the exact GPT-4o-mini 2024-07-18 GlobalStandard and GPT-4.1 2025-04-14 GlobalStandard tuples, using `model_metadata` provenance instead of leaving their thinking capability unknown.
|
|
14
|
+
- Preserve explicit live catalog capability precedence, including positive thinking evidence. Other models, versions, and deployment types remain unknown unless their own evidence establishes support.
|
|
15
|
+
|
|
16
|
+
## [0.4.6] - 2026-11-20
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Replace unsupported project API-key discovery with explicit `model_info`, `project`, or `declared` discovery sources. Project discovery requires Entra bearer/broker authentication; there is no runtime fallback between sources.
|
|
20
|
+
- Support API-key access through declared deployment identity bindings joined to exact authenticated resource model-catalog records. Publish only declared names through the shared inventory with `declared: true` metadata and `provider_static_catalog` provenance; reject missing/conflicting model records, duplicate names, and capability/limit overrides.
|
|
21
|
+
- Preserve normal snapshot replacement, withdrawal, callable retirement, and last-good retention after failed observations. Readiness remains a non-inference catalog GET.
|
|
22
|
+
- Withdraw an explicitly empty declaration set without fetching remote model facts, even during a catalog outage. Keep startup and cadence readiness checks unchanged.
|
|
23
|
+
- Validate all catalog record identities, but check duplicate/conflicting records only for declared base-model IDs so unrelated catalog duplicates cannot block the selected deployments.
|
|
24
|
+
- Add one immutable vendor metadata owner for exact GPT-4o-mini 2024-07-18 GlobalStandard and GPT-4.1 2025-04-14 GlobalStandard facts. Live catalog facts take precedence, including false capabilities; unknown tuples remain unknown.
|
|
25
|
+
- Normalize observed project model version, SKU, and capability limit fields at the project parser boundary. Both project and declared sources select the same vendor metadata using one explicit tuple, while declared identity remains distinct from observed revision evidence.
|
|
26
|
+
- Require `lex-llm >= 0.8.10` for shared OpenAI-compatible streaming finish-reason preservation; Azure adds no separate completion handling.
|
|
27
|
+
|
|
28
|
+
## [0.4.5] - 2026-11-20
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- Support an explicitly configured `credentials.project_api_key` for project deployment pages and connected-resource metadata lookup through the existing authentication and discovery pipeline.
|
|
32
|
+
- Keep project credentials isolated from resource inference/readiness credentials. Reject ambiguous project API-key, bearer-token, and broker combinations without falling back to another source.
|
|
33
|
+
- Verify real inventory publication, project-key pagination and connection lookup, resource credential isolation, malformed credentials, off-origin continuation rejection, and last-good snapshot retention after a project network-policy failure.
|
|
34
|
+
|
|
35
|
+
## [0.4.4] - 2026-11-20
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
- Register the actual Azure provider instance as the inventory callable. Delete the redundant callable wrapper, duplicate dispatch checks, lazy provider construction, and separate disconnect state; execution and connection disposal use the shared provider directly.
|
|
39
|
+
- Carry the configured instance name into that provider so registry reads and health attribution use the claimed instance instead of defaulting to `default`.
|
|
40
|
+
- Refine shared error classification only when a structured Azure error code and matching HTTP status establish the outcome. Preserve authentication and authorization failures, and stop treating generic 404s or error-message phrases as deployment or endpoint-health facts.
|
|
41
|
+
- Require `lex-llm >= 0.8.9` for canonical tools, thinking, and sampling parameters to be reconstructed at the shared fleet boundary. Remove Azure-specific parameter reconstruction.
|
|
42
|
+
- Load actors through the standard host actor loader. Remove guarded fleet requires, the unused chat URL alias and authentication hook, and unqualified fleet references.
|
|
43
|
+
- Replace fake actor/runtime and provider dispatch classes in specs with real host classes and real provider execution over controlled HTTP transport. Require the shared conformance kit without an optional-load guard.
|
|
44
|
+
|
|
45
|
+
## [0.4.3] - 2026-11-20
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
- Keep the shared `lex-llm` discovery lifecycle and registry as the sole inventory owner. Azure resource model catalogs no longer become deployed offerings merely because their catalog GET succeeds.
|
|
49
|
+
- Discover deployed model names through the Foundry project deployment API, including bounded pagination, distinct project authentication, and retention of the last good snapshot after malformed or partial responses.
|
|
50
|
+
- Support native and connected-resource deployments through normal configured instances. Bind connected instances with `provider.project_connection_name`, verify the connection's endpoint, and filter before duplicate checking. Preserve deployment names across distinct instance/callable identities. Conclusive retargeting removes stale offerings; transport failures retain the last complete snapshot.
|
|
51
|
+
- Resolve configured resource/project broker references through the real host identity broker on every provider call, page, connection lookup, and readiness request. Require one credential source per scope, reject unavailable/expired or unspecified leases, and leave token renewal to the existing broker.
|
|
52
|
+
- Snapshot credential-reference bindings and include endpoint/auth-reference changes in the physical binding fingerprint, reclaiming captured callables on configuration changes while retaining them across broker lease renewal.
|
|
53
|
+
- Accept the documented single-model `/models/info` response and share endpoint normalization between discovery and inference, including endpoints already ending in `/models`.
|
|
54
|
+
- Publish explicit operation and capability evidence. Missing facts remain unknown; model-name guesses and operator limits no longer masquerade as provider evidence.
|
|
55
|
+
- Remove invented quota-domain groupings based only on deployment names, which can repeat across unrelated resources.
|
|
56
|
+
- Preserve distinct deployments of a shared base model, deduplicate identical records, and reject contradictory duplicate records instead of silently choosing capabilities.
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
- Provider connection and discovery defaults live in `azure_foundry/settings.rb`.
|
|
60
|
+
- OpenAI-compatible resources exposing only a base-model catalog require `provider.project_endpoint` and a project bearer credential or explicit project broker reference for deployment discovery. Data-plane credentials are not forwarded to the project API.
|
|
61
|
+
- Use the native settings helper for configured instances and test broker integration against the actual LegionIO host lease service.
|
|
62
|
+
- Updated provider documentation to describe registry snapshot reads and the actual discovery actor and runner.
|
|
63
|
+
- Remove the custom completion/streaming/embedding funnel and legacy capability-name guesses. Inherit shared provider execution and preserve thinking, schemas, headers, and sampling controls through the standard callable contract; regression tests reproduce the previously dropped controls.
|
|
64
|
+
- Remove top-level/flat configuration aliases, model-object coercion, resource-catalog fallback, alternate catalog envelopes, and model-family guesses. Use the shared default merge/deep copy, explicit named-instance configuration, and documented Azure response fields.
|
|
65
|
+
|
|
3
66
|
## [0.4.2] - 2026-08-25
|
|
4
67
|
|
|
5
68
|
### Fixed
|
data/Gemfile
CHANGED
|
@@ -15,10 +15,13 @@ group :development do
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
group :test do
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
# Broker integration is exercised against the actual host lease service.
|
|
19
|
+
legionio_path = File.expand_path('../../LegionIO', __dir__)
|
|
20
|
+
legionio_options = File.directory?(legionio_path) ? { path: legionio_path } : {}
|
|
21
|
+
gem 'legionio', **legionio_options
|
|
22
|
+
|
|
23
|
+
# Use the standard immutable CI companion or adjacent development checkout.
|
|
24
|
+
lex_llm_path = File.expand_path('.ci-dependencies/lex-llm', __dir__)
|
|
25
|
+
lex_llm_path = File.expand_path('../lex-llm', __dir__) unless Dir.exist?(lex_llm_path)
|
|
23
26
|
gem 'lex-llm', path: lex_llm_path if Dir.exist?(lex_llm_path)
|
|
24
27
|
end
|
data/README.md
CHANGED
|
@@ -1,180 +1,279 @@
|
|
|
1
1
|
# lex-llm-azure-foundry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Azure AI Foundry and Azure OpenAI provider adapter for LegionIO. Requests use the
|
|
4
|
+
shared `lex-llm` canonical types, OpenAI-compatible wire translator, discovery
|
|
5
|
+
pipeline, and inventory registry.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Load it with:
|
|
7
|
+
## Install
|
|
8
8
|
|
|
9
9
|
```ruby
|
|
10
|
-
|
|
10
|
+
gem 'lex-llm-azure-foundry'
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(`GET /models/info?api-version=...` on the model-inference surface, `GET /models` on the
|
|
20
|
-
OpenAI-compatible surface) — the same endpoint doubles as the readiness probe
|
|
21
|
-
- Azure OpenAI v1-compatible endpoint support through `/openai/v1/chat/completions` and `/openai/v1/embeddings`
|
|
22
|
-
- Standard lex-llm offering discovery: `list_models` fetches the live catalog and
|
|
23
|
-
`discover_offerings` derives offerings through the shared base-class flow,
|
|
24
|
-
exactly like every other provider
|
|
25
|
-
- Shared `ModelCatalogParser` — the single module both the Provider's `list_models`
|
|
26
|
-
and the SSOT v3 `DiscoveryRefresh` actor parse the wire catalog through
|
|
27
|
-
- Shared OpenAI-compatible request and response mapping through `Legion::Extensions::Llm::Provider::OpenAICompatible`
|
|
28
|
-
- Shared registry availability publishing through `Legion::Extensions::Llm::RegistryPublisher` when transport is available
|
|
29
|
-
- Provider-owned fleet request handling through `Legion::Extensions::Llm::Fleet::ProviderResponder`
|
|
30
|
-
|
|
31
|
-
## Architecture
|
|
13
|
+
Ruby 3.4+ and `lex-llm >= 0.8.11` are required. LegionIO loads the extension and
|
|
14
|
+
runs its discovery actor. The adapter implements chat, streamed chat, and text
|
|
15
|
+
embeddings; a model is eligible only when its published evidence supports the
|
|
16
|
+
requested operation and capabilities.
|
|
17
|
+
|
|
18
|
+
## One inventory owner
|
|
32
19
|
|
|
33
20
|
```text
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
model_info project declared
|
|
22
|
+
/models/info Entra project deployments bindings + resource catalog
|
|
23
|
+
\ | /
|
|
24
|
+
Azure discovery runner: parse identity and explicit evidence
|
|
25
|
+
|
|
|
26
|
+
lex-llm Discovery::Pipeline
|
|
27
|
+
claim -> readiness -> activate/replace -> Registry snapshot
|
|
28
|
+
|
|
|
29
|
+
router / fleet / discover_offerings
|
|
43
30
|
```
|
|
44
31
|
|
|
45
|
-
`AzureFoundry
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
`AzureFoundry::Actor::Discovery` inherits the shared discovery actor.
|
|
33
|
+
`AzureFoundry::Runners::Discovery` includes the shared pipeline and supplies only
|
|
34
|
+
Azure protocol hooks and offering evidence. The shared pipeline owns instance
|
|
35
|
+
reconciliation, probes, replacement, removal, weights, and health publication.
|
|
36
|
+
The host actor builder loads the actor files; requiring the provider alone does
|
|
37
|
+
not preload or conditionally define host actors.
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
| `lib/legion/extensions/llm/azure_foundry/provider.rb` | Provider implementation with chat, stream, embed, health, readiness, and live model listing |
|
|
53
|
-
| `lib/legion/extensions/llm/azure_foundry/model_catalog_parser.rb` | Shared live-catalog envelope and entry parsing |
|
|
54
|
-
| `lib/legion/extensions/llm/azure_foundry/actors/discovery_refresh.rb` | SSOT v3 periodic discovery actor (catalog fetch, OfferingDrafts, readiness probes) |
|
|
55
|
-
| `lib/legion/extensions/llm/azure_foundry/actors/fleet_worker.rb` | Subscription actor gated by ProviderResponder fleet settings |
|
|
56
|
-
| `lib/legion/extensions/llm/azure_foundry/runners/fleet_worker.rb` | Fleet request runner that delegates execution to `ProviderResponder.call` |
|
|
57
|
-
| `lib/legion/extensions/llm/azure_foundry/version.rb` | `VERSION` constant |
|
|
39
|
+
Discovery registers `AzureFoundry::Provider` itself as the callable. There is no
|
|
40
|
+
Azure callable wrapper. The shared registry owns dispatch leases and retirement;
|
|
41
|
+
the shared provider owns execution and connection disposal.
|
|
58
42
|
|
|
59
|
-
|
|
43
|
+
`Provider#discover_offerings` reads activated lanes from that registry.
|
|
44
|
+
It does not fetch Azure or maintain another catalog. Its inherited `live:`
|
|
45
|
+
argument does not change that behavior.
|
|
60
46
|
|
|
61
|
-
|
|
47
|
+
## Deployment identity and discovery sources
|
|
62
48
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
endpoint: https://example.services.ai.azure.com
|
|
70
|
-
api_key: env://AZURE_INFERENCE_CREDENTIAL
|
|
71
|
-
bearer_token: env://AZURE_FOUNDRY_BEARER_TOKEN
|
|
72
|
-
api_version: 2024-05-01-preview
|
|
73
|
-
surface: model_inference
|
|
74
|
-
instances:
|
|
75
|
-
prod:
|
|
76
|
-
endpoint: https://prod.services.ai.azure.com
|
|
77
|
-
api_key: env://AZURE_INFERENCE_CREDENTIAL
|
|
78
|
-
api_version: 2024-05-01-preview
|
|
79
|
-
surface: model_inference
|
|
80
|
-
fleet:
|
|
81
|
-
enabled: true
|
|
82
|
-
respond_to_requests: true
|
|
83
|
-
capabilities:
|
|
84
|
-
- chat
|
|
85
|
-
- stream_chat
|
|
86
|
-
- embed
|
|
87
|
-
```
|
|
49
|
+
Azure resource model catalogs describe base models, not deployed model names.
|
|
50
|
+
Microsoft's [key-authenticated endpoint ADR](https://github.com/microsoft/mosaic-apim/blob/main/docs/adr/0018-key-authenticated-backends.md)
|
|
51
|
+
states that API keys cannot list deployments. The authenticated resource model GET
|
|
52
|
+
checks access without inference, but does not prove that a deployment exists.
|
|
53
|
+
The project deployment API requires Entra authentication. The unsupported
|
|
54
|
+
`project_api_key` option introduced in 0.4.5 is removed and rejected explicitly.
|
|
88
55
|
|
|
89
|
-
|
|
56
|
+
Select `provider.discovery_source` explicitly for OpenAI v1 resources:
|
|
90
57
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
config.azure_foundry_api_version = '2024-05-01-preview'
|
|
97
|
-
config.azure_foundry_surface = :model_inference
|
|
98
|
-
end
|
|
99
|
-
```
|
|
58
|
+
| Source | Identity source | Authentication |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `model_info` | Documented single-model `/models/info` response | Resource credential; requires `model_inference` surface |
|
|
61
|
+
| `project` | Foundry project `GET /deployments?api-version=v1` | Separate project bearer token or broker lease |
|
|
62
|
+
| `declared` | Operator deployment bindings joined to exact resource catalog model IDs | Resource credential; requires `openai_v1` surface |
|
|
100
63
|
|
|
101
|
-
|
|
64
|
+
The default is `model_info`, matching the default `model_inference` surface.
|
|
65
|
+
There is no fallback between sources. A project failure never activates declared
|
|
66
|
+
bindings, and a resource catalog never becomes an inventory of deployments on its own.
|
|
102
67
|
|
|
103
|
-
|
|
68
|
+
For API-key access, declare only deployment identity:
|
|
104
69
|
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# surface: nil
|
|
122
|
-
# },
|
|
123
|
-
# usage: { inference: true, embedding: true, image: false },
|
|
124
|
-
# limits: { concurrency: 4 },
|
|
125
|
-
# fleet: {
|
|
126
|
-
# enabled: false,
|
|
127
|
-
# respond_to_requests: false,
|
|
128
|
-
# capabilities: [:chat, :stream_chat, :embed],
|
|
129
|
-
# lanes: [],
|
|
130
|
-
# concurrency: 4,
|
|
131
|
-
# queue_suffix: nil
|
|
132
|
-
# }
|
|
133
|
-
# }
|
|
134
|
-
# }
|
|
135
|
-
# }
|
|
70
|
+
```yaml
|
|
71
|
+
instances:
|
|
72
|
+
primary:
|
|
73
|
+
endpoint: https://resource.example.openai.azure.com
|
|
74
|
+
credentials:
|
|
75
|
+
api_key: <resource-api-key>
|
|
76
|
+
provider:
|
|
77
|
+
surface: openai_v1
|
|
78
|
+
discovery_source: declared
|
|
79
|
+
deployments:
|
|
80
|
+
- name: production-chat
|
|
81
|
+
model: gpt-4o-mini
|
|
82
|
+
model_version: '2024-07-18'
|
|
83
|
+
deployment_type: GlobalStandard
|
|
84
|
+
- name: embeddings
|
|
85
|
+
model: text-embedding-3-small
|
|
136
86
|
```
|
|
137
87
|
|
|
138
|
-
|
|
88
|
+
Each binding requires `name` and `model`; `model_version` and `deployment_type`
|
|
89
|
+
are optional identity facts. Capabilities and numeric limits are not accepted.
|
|
90
|
+
Names must be unique within an instance. Missing or malformed bindings fail
|
|
91
|
+
configuration; an explicit empty array withdraws all declared offerings.
|
|
92
|
+
That withdrawal does not require a remote catalog read. Startup and cadence
|
|
93
|
+
readiness checks continue through the shared lifecycle.
|
|
94
|
+
|
|
95
|
+
Discovery authenticates `GET <resource>/openai/v1/models` and joins each binding
|
|
96
|
+
to an exact catalog ID. Every record's ID shape is validated, but duplicate/conflict
|
|
97
|
+
checks apply only to selected base-model IDs. Missing selected models, malformed
|
|
98
|
+
catalogs, or conflicting selected records fail the whole refresh. Only declared
|
|
99
|
+
names are published, unchanged, through the
|
|
100
|
+
shared pipeline with `publication_source: provider_static_catalog` and
|
|
101
|
+
`metadata.declared: true`. Multiple instances can use the same deployment name
|
|
102
|
+
without sharing credentials or callables. The selected binding supplies dispatch
|
|
103
|
+
identity; an incorrect deployment name can still produce a provider 404 at inference.
|
|
104
|
+
|
|
105
|
+
For project discovery, use a separately authorized project credential:
|
|
139
106
|
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
provider
|
|
148
|
-
|
|
149
|
-
provider
|
|
150
|
-
|
|
107
|
+
```yaml
|
|
108
|
+
instances:
|
|
109
|
+
connected:
|
|
110
|
+
endpoint: https://connected.example.openai.azure.com
|
|
111
|
+
credentials:
|
|
112
|
+
api_key: <resource-api-key>
|
|
113
|
+
project_broker:
|
|
114
|
+
provider: azure_identity
|
|
115
|
+
qualifier: foundry_project
|
|
116
|
+
provider:
|
|
117
|
+
surface: openai_v1
|
|
118
|
+
discovery_source: project
|
|
119
|
+
project_endpoint: https://resource.example.services.ai.azure.com/api/projects/primary
|
|
120
|
+
project_connection_name: connected-resource
|
|
151
121
|
```
|
|
152
122
|
|
|
153
|
-
`
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
Provider instances can opt in to consuming Legion LLM fleet requests. The actor is enabled only when at least one discovered instance has `fleet.respond_to_requests: true`.
|
|
123
|
+
`project_bearer_token` is the alternative to `project_broker`; select exactly one.
|
|
124
|
+
Project tokens require the `https://ai.azure.com/.default` scope and deployment-read
|
|
125
|
+
authorization. Resource credentials are never implicitly sent to project APIs.
|
|
126
|
+
Without `project_connection_name`, project discovery selects native deployments.
|
|
127
|
+
With it, discovery verifies the named connection target before selecting that
|
|
128
|
+
connection's deployments. A conclusive retarget clears stale offerings; a failed
|
|
129
|
+
request preserves the last complete snapshot. No connection credentials are fetched.
|
|
162
130
|
|
|
163
|
-
|
|
131
|
+
The project parser normalizes observed `modelVersion` and `sku.name` together,
|
|
132
|
+
and reads positive `capabilities.maxContextToken` / `maxOutputToken` values as
|
|
133
|
+
catalog limits. Observed revisions retain `provider_catalog` provenance.
|
|
164
134
|
|
|
165
|
-
|
|
135
|
+
`credentials.broker` and `credentials.project_broker` select existing host-owned
|
|
136
|
+
provider/qualifier leases. Identity issuers acquire scoped credentials; the broker
|
|
137
|
+
owns registered leases and renewal. Azure reads a current valid lease on each
|
|
138
|
+
outbound request and creates no token cache or renewal loop. These references do
|
|
139
|
+
not acquire OAuth consent, grant Azure permissions, or substitute the default
|
|
140
|
+
Graph credential. The broker names above are examples, not automatically registered
|
|
141
|
+
issuers. Missing or expired leases fail authentication.
|
|
166
142
|
|
|
167
|
-
|
|
143
|
+
For a single-model inference endpoint:
|
|
168
144
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
145
|
+
```yaml
|
|
146
|
+
instances:
|
|
147
|
+
serverless:
|
|
148
|
+
endpoint: https://resource.example.services.ai.azure.com/models
|
|
149
|
+
credentials:
|
|
150
|
+
api_key: <resource-api-key>
|
|
151
|
+
provider:
|
|
152
|
+
surface: model_inference
|
|
153
|
+
discovery_source: model_info
|
|
154
|
+
api_version: 2024-05-01-preview
|
|
155
|
+
```
|
|
177
156
|
|
|
178
|
-
|
|
157
|
+
Only named instances with nested `credentials` and `provider` fields are accepted.
|
|
158
|
+
The shared default-settings merge supplies defaults at that boundary. Source selection
|
|
159
|
+
does not rewrite hosts or infer project endpoints. Disabled or credential-less
|
|
160
|
+
instances are not claimed. Bindings refresh through normal snapshot replacement;
|
|
161
|
+
instance removal and endpoint/credential changes use shared callable retirement.
|
|
162
|
+
|
|
163
|
+
## Vendor model metadata
|
|
164
|
+
|
|
165
|
+
Live catalog facts take precedence, including explicit false capabilities.
|
|
166
|
+
When an observed project record or a declared binding identifies an exact documented
|
|
167
|
+
model/version/deployment-type tuple, `Provider::MODEL_METADATA` supplies absent vendor facts with
|
|
168
|
+
`source: model_metadata`. This immutable table is not operator tuning, a second
|
|
169
|
+
inventory, or a model-name heuristic. Unknown versions or deployment types remain
|
|
170
|
+
unknown. Both parser boundaries construct one explicit lookup tuple; declared
|
|
171
|
+
identity fields remain declarations in metadata and never become observed revision evidence.
|
|
172
|
+
|
|
173
|
+
| Exact model | Version | Deployment type | Context | Max output | Thinking |
|
|
174
|
+
| --- | --- | --- | --- | --- | --- |
|
|
175
|
+
| `gpt-4o-mini` | `2024-07-18` | `GlobalStandard` | 128,000 | 16,384 | Unsupported |
|
|
176
|
+
| `gpt-4.1` | `2025-04-14` | `GlobalStandard` | 1,047,576 | 32,768 | Unsupported |
|
|
177
|
+
| `gpt-5-mini` | `2025-08-07` | `GlobalStandard` | 400,000 | 128,000 | Supported |
|
|
178
|
+
|
|
179
|
+
The same exact tuples document chat, streaming, tools, and vision support.
|
|
180
|
+
The GPT-4.1 GlobalStandard facts do not apply to regional Standard, provisioned,
|
|
181
|
+
batch, or unknown SKUs. Sources: [Microsoft model capability tables](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/models-sold-directly-by-azure?pivots=azure-openai),
|
|
182
|
+
[deployment types](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/deployment-types),
|
|
183
|
+
and [Azure GPT-4.1 launch](https://azure.microsoft.com/en-us/blog/announcing-the-gpt-4-1-model-series-for-azure-ai-foundry-developers/).
|
|
184
|
+
|
|
185
|
+
The two GPT-4 tuples publish unsupported thinking evidence with `model_metadata`
|
|
186
|
+
provenance. [OpenAI identifies GPT-4.1 as non-reasoning](https://developers.openai.com/api/docs/models/gpt-4.1),
|
|
187
|
+
and [Microsoft's Azure migration guidance identifies GPT-4o-mini as not supporting the reasoning parameter](https://github.com/Azure-Samples/azure-openai-to-responses/blob/main/skills/azure-openai-to-responses/references/troubleshooting.md#L59).
|
|
188
|
+
Explicit live catalog values retain precedence, including positive reasoning or
|
|
189
|
+
thinking evidence. Other model names, versions, and SKUs do not inherit this negative fact.
|
|
190
|
+
|
|
191
|
+
## Native request controls
|
|
192
|
+
|
|
193
|
+
The shared payload builder keeps `Canonical::Params.max_tokens` unchanged and uses
|
|
194
|
+
the provider's protocol hook to choose its wire name: `max_completion_tokens` for
|
|
195
|
+
OpenAI v1, or `max_tokens` for model inference. It sends only that key, and omits
|
|
196
|
+
an absent limit. This applies equally to buffered and streaming requests.
|
|
197
|
+
|
|
198
|
+
Native reasoning effort values remain model- and API-specific. For GPT-5 mini,
|
|
199
|
+
the canonical `low`, `medium`, and `high` levels are supported; `max` is unsupported
|
|
200
|
+
on Chat Completions. Azure also documents a native `minimal` level, which the
|
|
201
|
+
canonical effort enum does not currently represent.
|
|
202
|
+
The canonical budget conversion maps 16,384 tokens to `high`, while budgets above
|
|
203
|
+
24,576 resolve to `max`. This adapter does not silently lower an unsupported effort.
|
|
204
|
+
Callers must supply controls supported by their selected deployment and API.
|
|
205
|
+
See [Azure reasoning API constraints](https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/reasoning#api-and-feature-support).
|
|
206
|
+
|
|
207
|
+
## Evidence and failure behavior
|
|
208
|
+
|
|
209
|
+
- Explicit catalog capability flags, including false values, become canonical
|
|
210
|
+
evidence. Names such as “embed” or “vision” do not establish capabilities.
|
|
211
|
+
- Facts absent from both the live catalog and exact vendor metadata remain unknown.
|
|
212
|
+
Operator permissions and configured limits are not relabeled as provider facts.
|
|
213
|
+
- Deployment names do not establish quota sharing across resources. Without
|
|
214
|
+
authoritative quota-domain evidence, offerings leave that mapping empty.
|
|
215
|
+
- Provider execution inherits `chat`, `stream_chat`, `complete`, `embed`, `health`,
|
|
216
|
+
and `discover_offerings` from `lex-llm`. The shared fleet worker reconstructs
|
|
217
|
+
serialized canonical controls before dispatch. Azure has no second execution
|
|
218
|
+
funnel, parameter-reconstruction path, or capability-name guesses.
|
|
219
|
+
- Error normalization starts with the shared classifier. Azure refines only
|
|
220
|
+
structured error codes paired with their HTTP status; free-text phrases and
|
|
221
|
+
generic 404s cannot establish endpoint health or deployment existence.
|
|
222
|
+
- Context and output limits use valid positive integer catalog fields first,
|
|
223
|
+
then the exact documented vendor tuple where available.
|
|
224
|
+
- Deployment names remain distinct even when several deployments share one base
|
|
225
|
+
model. Duplicate records with identical facts are collapsed; conflicting facts
|
|
226
|
+
fail the refresh.
|
|
227
|
+
- All deployment pages must succeed before replacement. Pagination is bounded,
|
|
228
|
+
cycles are rejected, and continuation URLs must stay on the same project
|
|
229
|
+
deployment endpoint.
|
|
230
|
+
- Failed or malformed refreshes retain the last good snapshot. A valid empty
|
|
231
|
+
deployment list can publish an empty snapshot.
|
|
232
|
+
- Readiness performs a non-generation data-plane GET. It proves connectivity and
|
|
233
|
+
authentication, not that every base model is deployed.
|
|
234
|
+
- The selected inventory model string reaches provider dispatch unchanged.
|
|
235
|
+
Fleet execution uses the shared `Fleet::ProviderResponder`.
|
|
236
|
+
|
|
237
|
+
The inherited token counter returns an estimate; Azure has no portable native
|
|
238
|
+
token-count endpoint, so authoritative native counting is not advertised.
|
|
239
|
+
|
|
240
|
+
## Defaults
|
|
241
|
+
|
|
242
|
+
All Azure connection and discovery defaults are defined in
|
|
243
|
+
`lib/legion/extensions/llm/azure_foundry/settings.rb` and returned through the
|
|
244
|
+
standard provider `default_settings` contract.
|
|
245
|
+
|
|
246
|
+
| Setting under `extensions.llm.azure_foundry` | Default |
|
|
247
|
+
| --- | --- |
|
|
248
|
+
| `discovery.interval_seconds` | 3600 |
|
|
249
|
+
| `discovery.request_timeout` / `open_timeout` | 10 / 5 seconds |
|
|
250
|
+
| `discovery.health_timeout` / `health_open_timeout` | 5 / 3 seconds |
|
|
251
|
+
| `discovery.max_pages` | 100 |
|
|
252
|
+
| `instances.default.tier` | `cloud` |
|
|
253
|
+
| `instances.default.provider.surface` | `model_inference` |
|
|
254
|
+
| `instances.default.provider.discovery_source` | `model_info` |
|
|
255
|
+
| `instances.default.provider.deployments` | `nil` |
|
|
256
|
+
| `instances.default.provider.api_version` | `2024-05-01-preview` |
|
|
257
|
+
| `instances.default.provider.project_api_version` | `v1` |
|
|
258
|
+
|
|
259
|
+
## Verification
|
|
260
|
+
|
|
261
|
+
Run the full suite and linter:
|
|
262
|
+
|
|
263
|
+
```sh
|
|
264
|
+
bundle exec rspec --format json --out tmp/rspec_results.json --format progress --out tmp/rspec_progress.txt
|
|
265
|
+
bundle exec rubocop -A
|
|
266
|
+
```
|
|
179
267
|
|
|
180
|
-
|
|
268
|
+
Specs exercise the shared SSOT conformance kit, real inventory publication,
|
|
269
|
+
canonical callable payloads, documented model-info parsing, project pagination,
|
|
270
|
+
authentication boundaries, failed-refresh retention, and explicit evidence.
|
|
271
|
+
Broker tests load the real host broker, lease, and renewer from the test dependency.
|
|
272
|
+
Actor tests load the actual host actors and helpers. Publication tests register
|
|
273
|
+
actual provider instances; only external HTTP transport and token issuance are
|
|
274
|
+
controlled fixtures.
|
|
275
|
+
|
|
276
|
+
Microsoft references:
|
|
277
|
+
[model-inference info](https://learn.microsoft.com/en-us/rest/api/microsoftfoundry/model-inference/get-model-info/get-model-info?view=rest-microsoftfoundry-model-inference-2024-05-01-preview),
|
|
278
|
+
[project deployments](https://learn.microsoft.com/en-us/rest/api/microsoft-foundry/aiproject#deployments---list),
|
|
279
|
+
[Azure endpoint and deployment naming](https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-models/concepts/endpoints?view=foundry-classic).
|
|
@@ -27,8 +27,6 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.add_dependency 'legion-logging', '>= 1.3.2'
|
|
28
28
|
spec.add_dependency 'legion-settings', '>= 1.4.2'
|
|
29
29
|
spec.add_dependency 'legion-transport', '>= 1.4.14'
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
# the Registry-snapshot offering read path this gem conforms to.
|
|
33
|
-
spec.add_dependency 'lex-llm', '>= 0.8.0'
|
|
30
|
+
# Shared canonical execution and protocol-specific output-token key hook.
|
|
31
|
+
spec.add_dependency 'lex-llm', '>= 0.8.11'
|
|
34
32
|
end
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require 'legion/extensions/llm/discovery/actor'
|
|
4
4
|
|
|
5
|
-
# The base discovery actor only exists inside the daemon (it inherits the
|
|
6
|
-
# LegionIO time-based Every actor). In a standalone load, define nothing.
|
|
7
|
-
return unless defined?(Legion::Extensions::Llm::Discovery::Actor)
|
|
8
|
-
|
|
9
5
|
module Legion
|
|
10
6
|
module Extensions
|
|
11
7
|
module Llm
|
|
@@ -3,23 +3,7 @@
|
|
|
3
3
|
require 'legion/extensions/llm/azure_foundry'
|
|
4
4
|
require 'legion/extensions/llm/fleet/provider_responder'
|
|
5
5
|
require 'legion/extensions/llm/azure_foundry/runners/fleet_worker'
|
|
6
|
-
|
|
7
|
-
unless defined?(Legion::Extensions::Actors::Subscription)
|
|
8
|
-
begin
|
|
9
|
-
require 'legion/extensions/actors/subscription'
|
|
10
|
-
rescue LoadError => e
|
|
11
|
-
Legion::Extensions::Llm::AzureFoundry.handle_exception(
|
|
12
|
-
e,
|
|
13
|
-
level: :warn,
|
|
14
|
-
handled: true,
|
|
15
|
-
operation: 'azure_foundry.fleet_worker.load_subscription'
|
|
16
|
-
)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
unless defined?(Legion::Extensions::Actors::Subscription)
|
|
21
|
-
raise LoadError, 'LegionIO actor runtime is required for Azure Foundry fleet worker'
|
|
22
|
-
end
|
|
6
|
+
require 'legion/extensions/actors/subscription'
|
|
23
7
|
|
|
24
8
|
module Legion
|
|
25
9
|
module Extensions
|
|
@@ -45,7 +29,9 @@ module Legion
|
|
|
45
29
|
end
|
|
46
30
|
|
|
47
31
|
def enabled?
|
|
48
|
-
Legion::Extensions::Llm::Fleet::ProviderResponder.enabled_for?(
|
|
32
|
+
Legion::Extensions::Llm::Fleet::ProviderResponder.enabled_for?(
|
|
33
|
+
Legion::Extensions::Llm::AzureFoundry.discover_instances
|
|
34
|
+
)
|
|
49
35
|
end
|
|
50
36
|
end
|
|
51
37
|
end
|