@sixb/azure-ai-foundry 0.1.1

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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +218 -0
  3. package/dist/accounting.d.ts +5 -0
  4. package/dist/accounting.d.ts.map +1 -0
  5. package/dist/catalog.d.ts +29 -0
  6. package/dist/catalog.d.ts.map +1 -0
  7. package/dist/chat-accounting.d.ts +4 -0
  8. package/dist/chat-accounting.d.ts.map +1 -0
  9. package/dist/chat-request.d.ts +18 -0
  10. package/dist/chat-request.d.ts.map +1 -0
  11. package/dist/diagnostics.d.ts +10 -0
  12. package/dist/diagnostics.d.ts.map +1 -0
  13. package/dist/discovery.d.ts +63 -0
  14. package/dist/discovery.d.ts.map +1 -0
  15. package/dist/index.d.ts +6 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +1898 -0
  18. package/dist/index.js.map +25 -0
  19. package/dist/messages-accounting.d.ts +5 -0
  20. package/dist/messages-accounting.d.ts.map +1 -0
  21. package/dist/messages-request.d.ts +11 -0
  22. package/dist/messages-request.d.ts.map +1 -0
  23. package/dist/messages-schema.d.ts +4 -0
  24. package/dist/messages-schema.d.ts.map +1 -0
  25. package/dist/provider.d.ts +64 -0
  26. package/dist/provider.d.ts.map +1 -0
  27. package/dist/publisher.d.ts +7 -0
  28. package/dist/publisher.d.ts.map +1 -0
  29. package/dist/request.d.ts +20 -0
  30. package/dist/request.d.ts.map +1 -0
  31. package/dist/resolution.d.ts +36 -0
  32. package/dist/resolution.d.ts.map +1 -0
  33. package/dist/structured-output.d.ts +4 -0
  34. package/dist/structured-output.d.ts.map +1 -0
  35. package/dist/transport.d.ts +30 -0
  36. package/dist/transport.d.ts.map +1 -0
  37. package/dist/tsconfig.json +5 -0
  38. package/dist/util.d.ts +6 -0
  39. package/dist/util.d.ts.map +1 -0
  40. package/package.json +54 -0
  41. package/src/accounting.ts +117 -0
  42. package/src/catalog.ts +328 -0
  43. package/src/chat-accounting.ts +134 -0
  44. package/src/chat-request.ts +161 -0
  45. package/src/diagnostics.ts +34 -0
  46. package/src/discovery.ts +385 -0
  47. package/src/index.ts +17 -0
  48. package/src/messages-accounting.ts +105 -0
  49. package/src/messages-request.ts +164 -0
  50. package/src/messages-schema.ts +101 -0
  51. package/src/provider.ts +416 -0
  52. package/src/publisher.ts +34 -0
  53. package/src/request.ts +266 -0
  54. package/src/resolution.ts +179 -0
  55. package/src/structured-output.ts +135 -0
  56. package/src/transport.ts +268 -0
  57. package/src/util.ts +16 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sixb contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # @sixb/azure-ai-foundry
2
+
3
+ Azure AI Foundry models for Sixb. A project URL and API key resolve Azure deployments into
4
+ model capabilities, limits, reasoning controls, and reference prices from [models.dev](https://models.dev).
5
+
6
+ ## Install
7
+
8
+ ```sh
9
+ bun add @sixb/azure-ai-foundry
10
+ ```
11
+
12
+ ## Connect
13
+
14
+ ```ts
15
+ import { createAzureAIFoundry } from "@sixb/azure-ai-foundry"
16
+
17
+ const foundry = createAzureAIFoundry({
18
+ endpoint: "https://my-resource.services.ai.azure.com/api/projects/my-project",
19
+ apiKey: () => process.env.AZURE_AI_FOUNDRY_API_KEY,
20
+ })
21
+
22
+ const model = foundry("production") // Your Azure deployment name.
23
+ ```
24
+
25
+ The full project URL and API key are required. The provider uses the same key to fetch project
26
+ deployments and call inference. Keys may be strings or synchronous/asynchronous functions;
27
+ functions receive an abort signal and are evaluated for each Azure HTTP attempt.
28
+
29
+ Model resolution always follows this sequence:
30
+
31
+ 1. Find the deployment in the Azure project and read its model name, version, and publisher.
32
+ 2. Look up the underlying model in models.dev.
33
+ 3. Build the Sixb model definition and cost estimator, intersecting capabilities with adapter support.
34
+ 4. Call Azure using the deployment name.
35
+
36
+ Construction is network-free. `resolve()` returns a pinned model for worker admission and
37
+ execution. A direct `stream()` resolves and pins the handle before inference. Discovery failures
38
+ and missing deployments stop resolution; they never fall back to guessing the model identity.
39
+ If models.dev is unavailable after successful Azure discovery, resolution uses cached catalog
40
+ facts or an explicit `definition`. Without either, it fails. Malformed catalog data still fails;
41
+ missing capabilities and prices remain unknown. Catalog listings and refresh report outages.
42
+
43
+ ## Stream a response
44
+
45
+ ```ts
46
+ const { events } = await model.stream({
47
+ callId: crypto.randomUUID(),
48
+ messages: [
49
+ { role: "user", content: [{ type: "text", text: "Explain digital twins in one sentence." }] },
50
+ ],
51
+ tools: [],
52
+ maxOutputTokens: 256,
53
+ signal: AbortSignal.timeout(30_000),
54
+ })
55
+
56
+ for await (const event of events) {
57
+ if (event.type === "text-delta") process.stdout.write(event.delta)
58
+ if (event.type === "error") throw event.error
59
+ }
60
+ ```
61
+
62
+ ## Inspect and refresh
63
+
64
+ ```ts
65
+ const deployments = await foundry.catalog.deployments()
66
+ const definitions = await foundry.catalog.list()
67
+ const chats = await foundry.catalog.list({ protocol: "chat" })
68
+
69
+ const resolved = await model.resolve()
70
+ console.log(resolved.definition) // Effective capabilities and limits.
71
+ console.log(resolved.protocol) // responses | chat | messages
72
+ console.log(resolved.metadata.catalog) // Catalog source and underlying model ID.
73
+
74
+ await foundry.catalog.refresh()
75
+ const refreshed = await model.resolve()
76
+ const cached = await model.resolve({ offline: true })
77
+ // `resolved` keeps its original definition and prices.
78
+ ```
79
+
80
+ | Behavior | Rule |
81
+ | --- | --- |
82
+ | Catalog listings | Supported project deployments |
83
+ | Azure matching | Unique case-insensitive model ID match |
84
+ | `FW-` fallback | Unique normalized match in the models.dev Fireworks catalog |
85
+ | Fireworks normalization | Removes namespace/`FW-`; normalizes casing and numeric `5p3` → `5.3` |
86
+ | Variants | Preserves variant/date suffixes; excludes moving Fireworks `*-latest` aliases; rejects ambiguity |
87
+ | Missing catalog metadata | Stays unknown; explicit capability and pricing overrides are available |
88
+ | Refresh | Updates future resolutions; existing resolved models stay pinned |
89
+ | Offline resolution | Requires a cached deployment; performs no network requests |
90
+ | Publisher display | Azure publisher names are normalized for model logos; Fireworks GLM, Kimi, and DeepSeek catalog families identify their authors. Unknown families retain the Fireworks publisher. |
91
+
92
+ Resolved definitions include `publisher: { id, name }` and `via: "Azure AI Foundry"` for model
93
+ pickers, including custom provider namespaces. These fields do not change routing or capabilities.
94
+ Use `definition.publisher` to override the displayed author for an unrecognized model family.
95
+
96
+ ## Protocols and controls
97
+
98
+ ```ts
99
+ foundry("production") // Catalog protocol → Responses/Chat/Messages flags → Responses.
100
+ foundry.responses("production")
101
+ foundry.chat("production")
102
+ foundry.messages("claude-production")
103
+ ```
104
+
105
+ Responses and Chat use the project inference URL. Native Messages uses the owning resource's
106
+ `/anthropic/v1/messages` URL, derived from the project URL. A Messages deployment from a project
107
+ connection is rejected because the owning resource cannot be inferred from that record; configure
108
+ the provider with that resource's own project URL and API key.
109
+
110
+ | Feature | Responses | Chat | Messages |
111
+ | --- | --- | --- | --- |
112
+ | Streaming, local tools, structured output | Supported | Supported | Supported |
113
+ | Images | URL / inline | URL / inline | URL / inline |
114
+ | PDFs | Inline | — | URL / inline |
115
+ | Named reasoning efforts | Supported | Supported | Adaptive thinking |
116
+ | Exact reasoning budgets | — | — | Manual thinking |
117
+
118
+ Features require both model capability and adapter support. Unsupported controls fail locally.
119
+ Responses use full-history replay with `store: false` and encrypted reasoning. Replay is scoped to
120
+ the endpoint, deployment, and protocol. Chat compatibility is selected with `profile`;
121
+ DeepSeek reasoning replay uses `reasoningReplay: "tool-continuation"`.
122
+
123
+ Messages `thinkingMode` selects manual or adaptive thinking. Manual budgets start at 1024 tokens
124
+ and must stay below the output ceiling. Inline media has a 20 MiB aggregate default limit,
125
+ configurable with `maxInputFileBytes`. Provider-native tools, audio/video, and worker native-PDF
126
+ projection are unsupported. Direct calls rely on Azure for input/context enforcement.
127
+
128
+ Responses defaults to `reasoningSummary: "auto"` when Azure identifies the publisher as OpenAI,
129
+ the base model is `gpt-5`, `gpt-5-mini`, `gpt-5-nano`, `o3`, or `o4-mini`, and the resolved
130
+ capabilities declare reasoning. The automatic default is omitted when reasoning is `"none"`.
131
+ Set `reasoningSummary: false` to opt out, or select `"auto"`, `"concise"`, or `"detailed"` explicitly.
132
+ Unknown models and other publishers require an explicit setting; Chat and Messages are unchanged.
133
+ Encrypted reasoning is retained for replay separately and is not displayable text.
134
+
135
+ ## Override capabilities and prices
136
+
137
+ Overrides supplement discovered model facts; deployment discovery remains mandatory. A new
138
+ binding exposes only its definition's identity until resolution. Limits and capabilities,
139
+ including explicit overrides, become available on the resolved model (or after direct streaming).
140
+
141
+ ```ts
142
+ const model = foundry.chat("production", {
143
+ definition: {
144
+ contextWindow: 128_000,
145
+ maxOutputTokens: 4096,
146
+ capabilities: { localTools: true },
147
+ },
148
+ rateCard: {
149
+ currency: "USD",
150
+ unit: "million-tokens",
151
+ input: "1.00", // Illustrative rates; replace with your prices.
152
+ output: "4.00",
153
+ cacheReadInput: "0.25",
154
+ },
155
+ })
156
+ ```
157
+
158
+ Use either `rateCard` or `costEstimator`. Explicit definitions and prices override catalog defaults.
159
+ Model identity always comes from Azure.
160
+
161
+ ## Usage and cost
162
+
163
+ Catalog prices are reference estimates, not Azure invoice prices. Fireworks fallback uses
164
+ direct-Fireworks reference prices. Supply your own rates for effective Azure pricing.
165
+
166
+ | Accounting | Behavior |
167
+ | --- | --- |
168
+ | Supported prices | Flat input/output/cache rates and context-based `cost.tiers` |
169
+ | Tier selection | Total input, including cached tokens, must exceed the threshold; selected rates apply to the whole call |
170
+ | Legacy pricing | `context_over_200k` must agree with the exact tier |
171
+ | Reservations | Conservative highest rates; same pinned card as completed estimates |
172
+ | Cache and reasoning | Partitions of totals; never counted twice |
173
+ | Zero cache writes | Need no price; positive writes without rates remain unpriceable |
174
+ | Messages cache TTLs | Catalog write rates cover five minutes only; one-hour writes need explicit rates, and reservations are unavailable when the requested TTL has no rate |
175
+ | Missing or ambiguous usage/prices | Explicitly unpriceable; missing counters are not zero |
176
+ | Unknown billing dimensions | Require a custom estimator |
177
+ | Response model mismatch | Not priced using the requested model's rates |
178
+ | Reasoning counts | Positive reports retained; zero trusted automatically only for OpenAI |
179
+ | `reasoningUsage` override | `"reported"` trusts reported zero; `"unknown"` omits reasoning partitions |
180
+
181
+ ## Transport and caching
182
+
183
+ | Option / behavior | Default / contract |
184
+ | --- | --- |
185
+ | `catalog.ttlMs` / `catalog.timeoutMs` | One hour / 10 seconds |
186
+ | Catalog listing | One public snapshot per list/get/refresh, including with `catalog.ttlMs: 0` |
187
+ | `discovery.ttlMs` / `discovery.timeoutMs` | One hour / 5 seconds |
188
+ | Discovery bounds | 100 pages, 10,000 records, 4 MiB |
189
+ | Public catalog bound | 32 MiB; receives no Azure credentials or custom headers |
190
+ | Custom transport | `fetch`, `headers` shared by discovery and inference; `catalog.fetch` for the public catalog |
191
+ | Retries | Transient inference HTTP failures; no replay after stream acceptance or ambiguous network failure |
192
+ | Cancellation | Bounds waits; early stream return cancels and releases the reader |
193
+ | Diagnostics | Redacts acquired credentials/custom header values; preserves status, codes and retry timing |
194
+
195
+ ## Test
196
+
197
+ From the repository root:
198
+
199
+ ```sh
200
+ bun test ./models/azure-ai-foundry/tests/*.test.ts
201
+ ```
202
+
203
+ Live tests require a project URL, API key, and deployment names configured in the test files.
204
+ They are billable; run one suite at a time.
205
+
206
+ ```sh
207
+ SIXB_FOUNDRY_E2E=1 \
208
+ bun --env-file=.env.test --env-file=.local/drafts/foundry-live.env \
209
+ test ./models/azure-ai-foundry/tests/profiles.e2e.ts
210
+ ```
211
+
212
+ | Live suite | Coverage | Request / output-token ceiling |
213
+ | --- | --- | --- |
214
+ | `profiles.e2e.ts` | Discovered deployment profiles | 8 / 4,096 |
215
+ | `contracts.e2e.ts` | Tools, images, durable replay, strict JSON and accounting | 16 / 16,384 |
216
+ | `provider.e2e.ts` | Protocol controls, tools, media, cancellation and errors | 40 / 16,000 |
217
+
218
+ Native Messages has fixture coverage; live verification requires a deployed Claude model.
@@ -0,0 +1,5 @@
1
+ import { type JsonObject, type LanguageModelRateCard, type ModelCostEstimator, type ModelUsage } from "@sixb/core/models";
2
+ export declare function foundryUsage(raw: JsonObject | undefined, reliableReasoning: boolean | undefined): ModelUsage;
3
+ export declare function foundryEstimator(card: LanguageModelRateCard | undefined, request: JsonObject | undefined, modelName?: string, modelVersion?: string, aliases?: readonly string[]): ModelCostEstimator;
4
+ export declare function tokenEstimator(card: LanguageModelRateCard | undefined, request: JsonObject | undefined, requestKeys: readonly string[], tokenMeters: (raw: JsonObject | undefined) => boolean, modelName?: string, modelVersion?: string, aliases?: readonly string[]): ModelCostEstimator;
5
+ //# sourceMappingURL=accounting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting.d.ts","sourceRoot":"","sources":["../src/accounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAEhB,MAAM,mBAAmB,CAAA;AAI1B,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,GAAG,SAAS,EAC3B,iBAAiB,EAAE,OAAO,GAAG,SAAS,GACrC,UAAU,CA4BZ;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,qBAAqB,GAAG,SAAS,EACvC,OAAO,EAAE,UAAU,GAAG,SAAS,EAC/B,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAC1B,kBAAkB,CAUpB;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,qBAAqB,GAAG,SAAS,EACvC,OAAO,EAAE,UAAU,GAAG,SAAS,EAC/B,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,KAAK,OAAO,EACrD,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAC1B,kBAAkB,CAmBpB"}
@@ -0,0 +1,29 @@
1
+ import { defineLanguageModel, type LanguageModelRateCard } from "@sixb/core/models";
2
+ import type { FoundryProtocol } from "./transport";
3
+ export interface AzureAIFoundryCatalogOptions {
4
+ readonly ttlMs?: number;
5
+ readonly timeoutMs?: number;
6
+ readonly fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
7
+ }
8
+ export interface CatalogModel {
9
+ readonly catalogProvider: "azure" | "fireworks-ai";
10
+ readonly modelName: string;
11
+ readonly protocol?: FoundryProtocol;
12
+ readonly definition: ReturnType<typeof defineLanguageModel>;
13
+ readonly rateCard?: LanguageModelRateCard;
14
+ }
15
+ /** Provider-scoped models.dev snapshot. Construction and offline reads never perform I/O. */
16
+ export declare class RemoteModelsDevCatalog {
17
+ private snapshot;
18
+ private loadedAt;
19
+ private pending?;
20
+ private readonly options;
21
+ constructor(options?: AzureAIFoundryCatalogOptions);
22
+ invalidate(): void;
23
+ get(name: string, offline?: boolean): Promise<CatalogModel | undefined>;
24
+ /** Capture one snapshot so a batch of lookups cannot expire between deployments. */
25
+ lookup(offline?: boolean): Promise<(name: string) => CatalogModel | undefined>;
26
+ private load;
27
+ private fetchModels;
28
+ }
29
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,KAAK,qBAAqB,EAI3B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKlD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC1F;AACD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,eAAe,EAAE,OAAO,GAAG,cAAc,CAAA;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAA;CAC1C;AAED,6FAA6F;AAC7F,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,QAAQ,CAAI;IACpB,OAAO,CAAC,OAAO,CAAC,CAAkC;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;gBAC1C,OAAO,GAAE,4BAAiC;IAYtD,UAAU;IAGJ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAG3E,oFAAoF;IAC9E,MAAM,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,CAAC;IAyBlF,OAAO,CAAC,IAAI;YAcE,WAAW;CA8F1B"}
@@ -0,0 +1,4 @@
1
+ import type { JsonObject, LanguageModelRateCard, ModelCostEstimator, ModelUsage } from "@sixb/core/models";
2
+ export declare function foundryChatUsage(raw: JsonObject | undefined, reliableReasoning: boolean | undefined): ModelUsage;
3
+ export declare function foundryChatEstimator(card: LanguageModelRateCard | undefined, request: JsonObject | undefined, modelName?: string, modelVersion?: string, aliases?: readonly string[]): ModelCostEstimator;
4
+ //# sourceMappingURL=chat-accounting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-accounting.d.ts","sourceRoot":"","sources":["../src/chat-accounting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACX,MAAM,mBAAmB,CAAA;AAM1B,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,UAAU,GAAG,SAAS,EAC3B,iBAAiB,EAAE,OAAO,GAAG,SAAS,GACrC,UAAU,CA4BZ;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,qBAAqB,GAAG,SAAS,EACvC,OAAO,EAAE,UAAU,GAAG,SAAS,EAC/B,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAC1B,kBAAkB,CAkBpB"}
@@ -0,0 +1,18 @@
1
+ import { type JsonObject, type LanguageModelDefinition, type LanguageModelRequest } from "@sixb/core/models";
2
+ export interface ChatRequestOptions {
3
+ readonly maxOutputTokens?: number;
4
+ readonly maxInputFileBytes?: number;
5
+ readonly request?: JsonObject;
6
+ /** Default: OpenAI-compatible. Select DeepSeek compatibility explicitly when required. */
7
+ readonly profile?: "openai" | "deepseek";
8
+ readonly systemRole?: "system" | "developer";
9
+ /** Defaults to max_completion_tokens. Use max_tokens only for deployments requiring the older field. */
10
+ readonly maxTokensParameter?: "max_completion_tokens" | "max_tokens";
11
+ /** Request a final usage chunk (default true). Disable for offerings that reject stream_options. */
12
+ readonly includeUsage?: boolean;
13
+ /** Default: omit. Opt in only when the deployed model requires reasoning for tool continuation. */
14
+ readonly reasoningReplay?: "omit" | "tool-continuation";
15
+ }
16
+ export declare function validateChatOptions(options: ChatRequestOptions): void;
17
+ export declare function foundryChatRequest(request: LanguageModelRequest, definition: LanguageModelDefinition, options: ChatRequestOptions, scope: string): JsonObject;
18
+ //# sourceMappingURL=chat-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-request.d.ts","sourceRoot":"","sources":["../src/chat-request.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAG1B,MAAM,mBAAmB,CAAA;AAM1B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAA;IAC7B,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IAC5C,wGAAwG;IACxG,QAAQ,CAAC,kBAAkB,CAAC,EAAE,uBAAuB,GAAG,YAAY,CAAA;IACpE,oGAAoG;IACpG,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B,mGAAmG;IACnG,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAA;CACxD;AAwBD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAiBrE;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,oBAAoB,EAC7B,UAAU,EAAE,uBAAuB,EACnC,OAAO,EAAE,kBAAkB,EAC3B,KAAK,EAAE,MAAM,GACZ,UAAU,CAuFZ"}
@@ -0,0 +1,10 @@
1
+ import { ModelProviderError } from "@sixb/core/models";
2
+ /** Credentials belong to one request, including its retries, never to the provider instance. */
3
+ export declare class RequestDiagnostics {
4
+ private readonly secrets;
5
+ add(value: string): void;
6
+ text(value: string): string;
7
+ providerError(error: ModelProviderError): ModelProviderError;
8
+ failure(error: unknown): Error;
9
+ }
10
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,gGAAgG;AAChG,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAE5C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIxB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAM3B,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,kBAAkB;IAU5D,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK;CAO/B"}
@@ -0,0 +1,63 @@
1
+ import { type LanguageModelDefinition, type LanguageModelDefinitionCatalog } from "@sixb/core/models";
2
+ import type { FoundryProtocol } from "./transport";
3
+ import { type FoundryTransport } from "./transport";
4
+ export interface AzureAIFoundryDiscoveryOptions {
5
+ readonly ttlMs?: number;
6
+ /** Deadline for credentials, all pages, and body reads together. Default: 5,000 ms. */
7
+ readonly timeoutMs?: number;
8
+ readonly maxPages?: number;
9
+ readonly maxDeployments?: number;
10
+ /** Aggregate response bytes across all pages. Default: 4 MiB. */
11
+ readonly maxResponseBytes?: number;
12
+ }
13
+ export interface AzureAIFoundryDeployment {
14
+ readonly name: string;
15
+ readonly modelName: string;
16
+ readonly modelVersion: string;
17
+ readonly modelPublisher: string;
18
+ readonly connectionName?: string;
19
+ readonly capabilities: Readonly<Record<string, string>>;
20
+ readonly sku: {
21
+ readonly name: string;
22
+ readonly capacity?: number;
23
+ readonly family?: string;
24
+ readonly size?: string;
25
+ readonly tier?: string;
26
+ };
27
+ }
28
+ export interface AzureAIFoundryCatalog extends LanguageModelDefinitionCatalog {
29
+ get(name: string, options?: {
30
+ readonly protocol?: FoundryProtocol;
31
+ }): Promise<LanguageModelDefinition | undefined>;
32
+ list(options?: {
33
+ readonly protocol?: FoundryProtocol;
34
+ }): Promise<readonly LanguageModelDefinition[]>;
35
+ refresh(options?: {
36
+ readonly protocol?: FoundryProtocol;
37
+ }): Promise<readonly LanguageModelDefinition[]>;
38
+ /** All discovered ModelDeployment records, including non-Responses offerings. */
39
+ deployments(): Promise<readonly AzureAIFoundryDeployment[]>;
40
+ }
41
+ export interface ResolvedDeployment {
42
+ readonly deployment: AzureAIFoundryDeployment;
43
+ readonly discoveredAt: string;
44
+ }
45
+ export declare class FoundryDeployments {
46
+ private readonly providerId;
47
+ private readonly transport;
48
+ private readonly settings;
49
+ private cached?;
50
+ private expiresAt;
51
+ private pending?;
52
+ constructor(providerId: string, transport: FoundryTransport, discovery?: AzureAIFoundryDiscoveryOptions);
53
+ list(refresh?: boolean): Promise<readonly AzureAIFoundryDeployment[]>;
54
+ resolve(name: string, offline: boolean): Promise<ResolvedDeployment>;
55
+ private load;
56
+ private fetchSnapshot;
57
+ private pageUrl;
58
+ private fetchPage;
59
+ private readPage;
60
+ private invalid;
61
+ private unavailable;
62
+ }
63
+ //# sourceMappingURL=discovery.d.ts.map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YAoBE,aAAa;IAoE3B,OAAO,CAAC,OAAO;YA0BD,SAAS;YAoCT,QAAQ;IA8BtB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,WAAW;CAKpB"}
@@ -0,0 +1,6 @@
1
+ export type { AzureAIFoundryCatalogOptions } from "./catalog";
2
+ export type { AzureAIFoundryCatalog, AzureAIFoundryDeployment, AzureAIFoundryDiscoveryOptions, } from "./discovery";
3
+ export type { AzureAIFoundryChatOptions, AzureAIFoundryMessagesOptions, AzureAIFoundryModel, AzureAIFoundryModelMetadata, AzureAIFoundryModelOptions, AzureAIFoundryOptions, AzureAIFoundryProvider, } from "./provider";
4
+ export { createAzureAIFoundry } from "./provider";
5
+ export type { FoundryProtocol } from "./transport";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAA;AAC7D,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,yBAAyB,EACzB,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}