@jambonz/llm 0.3.3 → 0.4.0

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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as ServiceAccountJson, A as AuthSpec, P as PromptRequest, a as AdapterFactory, b as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-4d2QrlAe.cjs';
2
- export { c as ApiKeyAuth, d as AuthKind, e as AuthKindSchema, B as BedrockApiKeyAuth, f as BedrockIamAuth, g as ClientOptions, h as ContentBlock, F as FinishReason, i as FormField, j as FormFieldType, G as GoogleApiKeyAuth, k as GoogleServiceAccountAuth, J as JsonSchema, l as LlmEvent, M as Message, m as ModelCapabilities, n as ModelInfo, R as Role, T as Tool, o as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-4d2QrlAe.cjs';
1
+ import { S as ServiceAccountJson, A as AuthSpec, a as AuthKindSchema, P as PromptRequest, b as AdapterFactory, c as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-DxknK0Rc.cjs';
2
+ export { d as ApiKeyAuth, e as AuthKind, f as AzureOpenAIApiKeyAuth, B as BedrockApiKeyAuth, g as BedrockIamAuth, h as ClientOptions, i as ContentBlock, F as FinishReason, j as FormField, k as FormFieldType, G as GoogleApiKeyAuth, l as GoogleServiceAccountAuth, J as JsonSchema, m as LlmEvent, M as Message, n as ModelCapabilities, o as ModelInfo, R as Role, T as Tool, p as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-DxknK0Rc.cjs';
3
3
 
4
4
  /**
5
5
  * The loose "DB-shape" input accepted by `normalizeAuth`.
@@ -21,18 +21,46 @@ interface RawCredential {
21
21
  api_url?: string | null;
22
22
  project_id?: string | null;
23
23
  location?: string | null;
24
+ /** Azure OpenAI resource endpoint, e.g. `https://my-resource.openai.azure.com`. */
25
+ endpoint?: string | null;
26
+ /** Azure OpenAI deployment name (the user-created deployment, not the model id). */
27
+ deployment?: string | null;
28
+ /** Azure OpenAI data-plane api-version, e.g. `2024-10-21`. */
29
+ api_version?: string | null;
24
30
  }
25
31
  /**
26
32
  * Convert a vendor + raw credential into an `AuthSpec` discriminated union member.
27
33
  *
28
34
  * Supported vendors: openai, deepseek, anthropic, google, vertex (alias for
29
35
  * vertex-gemini + vertex-openai — both accept the same auth shape), vertex-gemini,
30
- * vertex-openai, bedrock.
36
+ * vertex-openai, bedrock, azure-openai.
31
37
  *
32
38
  * Throws with a clear message if the raw credential is missing required fields.
33
39
  */
34
40
  declare function normalizeAuth(vendor: string, raw: RawCredential): AuthSpec;
35
41
 
42
+ /**
43
+ * Given a vendor id and a raw snake_case credential blob, return the
44
+ * `AuthKindSchema` from the vendor's manifest that matches the blob.
45
+ *
46
+ * Purpose: let credential-handling consumers (api-server's `encryptCredential`
47
+ * in particular) validate and serialize the *right* set of fields for a
48
+ * credential without carrying a per-vendor switch of their own. The
49
+ * discriminator logic that distinguishes e.g. `bedrockApiKey` from
50
+ * `bedrockIam` lives here, in the library, right next to `normalizeAuth`.
51
+ *
52
+ * Rules:
53
+ * - Vendor with a single `authKind`: that kind is returned unconditionally.
54
+ * - Bedrock: `access_key_id` + `secret_access_key` → `bedrockIam`; else `bedrockApiKey`.
55
+ * - Google: `service_key` present → `googleServiceAccount`; `api_key` present → `googleApiKey`.
56
+ *
57
+ * Throws if the vendor is unknown or if no declared authKind matches the blob.
58
+ */
59
+ interface RawCredentialLoose extends RawCredential {
60
+ [key: string]: unknown;
61
+ }
62
+ declare function pickAuthKind(vendor: string, raw: RawCredentialLoose): AuthKindSchema;
63
+
36
64
  /**
37
65
  * Validate a PromptRequest against the library's universal preconditions.
38
66
  *
@@ -92,9 +120,11 @@ declare function getManifest(): {
92
120
  * - `createLlm({vendor, auth, client?})` to get a ready-to-stream adapter instance.
93
121
  * - `getManifest()` to enumerate registered vendors (used by api-server).
94
122
  * - `normalizeAuth(vendor, rawCred)` to convert DB-shape creds to AuthSpec.
123
+ * - `pickAuthKind(vendor, rawCred)` to pick the right manifest authKind for
124
+ * a raw credential (used by api-server's `encryptCredential`).
95
125
  * - `registerAdapter(factory)` to add a custom adapter at runtime.
96
126
  */
97
127
 
98
128
  declare function createLlm<A extends AuthSpec = AuthSpec>(args: CreateLlmArgs<A>): Promise<LlmAdapter<A>>;
99
129
 
100
- export { AdapterFactory, AdapterManifest, AuthSpec, CreateLlmArgs, LlmAdapter, PromptRequest, type RawCredential, ServiceAccountJson, assertValidRequest, createLlm, getAdapterFactory, getManifest, listVendors, normalizeAuth, registerAdapter, replaceAdapter, unregisterAdapter };
130
+ export { AdapterFactory, AdapterManifest, AuthKindSchema, AuthSpec, CreateLlmArgs, LlmAdapter, PromptRequest, type RawCredential, type RawCredentialLoose, ServiceAccountJson, assertValidRequest, createLlm, getAdapterFactory, getManifest, listVendors, normalizeAuth, pickAuthKind, registerAdapter, replaceAdapter, unregisterAdapter };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as ServiceAccountJson, A as AuthSpec, P as PromptRequest, a as AdapterFactory, b as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-4d2QrlAe.js';
2
- export { c as ApiKeyAuth, d as AuthKind, e as AuthKindSchema, B as BedrockApiKeyAuth, f as BedrockIamAuth, g as ClientOptions, h as ContentBlock, F as FinishReason, i as FormField, j as FormFieldType, G as GoogleApiKeyAuth, k as GoogleServiceAccountAuth, J as JsonSchema, l as LlmEvent, M as Message, m as ModelCapabilities, n as ModelInfo, R as Role, T as Tool, o as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-4d2QrlAe.js';
1
+ import { S as ServiceAccountJson, A as AuthSpec, a as AuthKindSchema, P as PromptRequest, b as AdapterFactory, c as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-DxknK0Rc.js';
2
+ export { d as ApiKeyAuth, e as AuthKind, f as AzureOpenAIApiKeyAuth, B as BedrockApiKeyAuth, g as BedrockIamAuth, h as ClientOptions, i as ContentBlock, F as FinishReason, j as FormField, k as FormFieldType, G as GoogleApiKeyAuth, l as GoogleServiceAccountAuth, J as JsonSchema, m as LlmEvent, M as Message, n as ModelCapabilities, o as ModelInfo, R as Role, T as Tool, p as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-DxknK0Rc.js';
3
3
 
4
4
  /**
5
5
  * The loose "DB-shape" input accepted by `normalizeAuth`.
@@ -21,18 +21,46 @@ interface RawCredential {
21
21
  api_url?: string | null;
22
22
  project_id?: string | null;
23
23
  location?: string | null;
24
+ /** Azure OpenAI resource endpoint, e.g. `https://my-resource.openai.azure.com`. */
25
+ endpoint?: string | null;
26
+ /** Azure OpenAI deployment name (the user-created deployment, not the model id). */
27
+ deployment?: string | null;
28
+ /** Azure OpenAI data-plane api-version, e.g. `2024-10-21`. */
29
+ api_version?: string | null;
24
30
  }
25
31
  /**
26
32
  * Convert a vendor + raw credential into an `AuthSpec` discriminated union member.
27
33
  *
28
34
  * Supported vendors: openai, deepseek, anthropic, google, vertex (alias for
29
35
  * vertex-gemini + vertex-openai — both accept the same auth shape), vertex-gemini,
30
- * vertex-openai, bedrock.
36
+ * vertex-openai, bedrock, azure-openai.
31
37
  *
32
38
  * Throws with a clear message if the raw credential is missing required fields.
33
39
  */
34
40
  declare function normalizeAuth(vendor: string, raw: RawCredential): AuthSpec;
35
41
 
42
+ /**
43
+ * Given a vendor id and a raw snake_case credential blob, return the
44
+ * `AuthKindSchema` from the vendor's manifest that matches the blob.
45
+ *
46
+ * Purpose: let credential-handling consumers (api-server's `encryptCredential`
47
+ * in particular) validate and serialize the *right* set of fields for a
48
+ * credential without carrying a per-vendor switch of their own. The
49
+ * discriminator logic that distinguishes e.g. `bedrockApiKey` from
50
+ * `bedrockIam` lives here, in the library, right next to `normalizeAuth`.
51
+ *
52
+ * Rules:
53
+ * - Vendor with a single `authKind`: that kind is returned unconditionally.
54
+ * - Bedrock: `access_key_id` + `secret_access_key` → `bedrockIam`; else `bedrockApiKey`.
55
+ * - Google: `service_key` present → `googleServiceAccount`; `api_key` present → `googleApiKey`.
56
+ *
57
+ * Throws if the vendor is unknown or if no declared authKind matches the blob.
58
+ */
59
+ interface RawCredentialLoose extends RawCredential {
60
+ [key: string]: unknown;
61
+ }
62
+ declare function pickAuthKind(vendor: string, raw: RawCredentialLoose): AuthKindSchema;
63
+
36
64
  /**
37
65
  * Validate a PromptRequest against the library's universal preconditions.
38
66
  *
@@ -92,9 +120,11 @@ declare function getManifest(): {
92
120
  * - `createLlm({vendor, auth, client?})` to get a ready-to-stream adapter instance.
93
121
  * - `getManifest()` to enumerate registered vendors (used by api-server).
94
122
  * - `normalizeAuth(vendor, rawCred)` to convert DB-shape creds to AuthSpec.
123
+ * - `pickAuthKind(vendor, rawCred)` to pick the right manifest authKind for
124
+ * a raw credential (used by api-server's `encryptCredential`).
95
125
  * - `registerAdapter(factory)` to add a custom adapter at runtime.
96
126
  */
97
127
 
98
128
  declare function createLlm<A extends AuthSpec = AuthSpec>(args: CreateLlmArgs<A>): Promise<LlmAdapter<A>>;
99
129
 
100
- export { AdapterFactory, AdapterManifest, AuthSpec, CreateLlmArgs, LlmAdapter, PromptRequest, type RawCredential, ServiceAccountJson, assertValidRequest, createLlm, getAdapterFactory, getManifest, listVendors, normalizeAuth, registerAdapter, replaceAdapter, unregisterAdapter };
130
+ export { AdapterFactory, AdapterManifest, AuthKindSchema, AuthSpec, CreateLlmArgs, LlmAdapter, PromptRequest, type RawCredential, type RawCredentialLoose, ServiceAccountJson, assertValidRequest, createLlm, getAdapterFactory, getManifest, listVendors, normalizeAuth, pickAuthKind, registerAdapter, replaceAdapter, unregisterAdapter };
package/dist/index.js CHANGED
@@ -1853,7 +1853,8 @@ var BEDROCK_KNOWN_MODELS = [
1853
1853
  vision: false,
1854
1854
  systemPrompt: true,
1855
1855
  maxContextTokens: 128e3
1856
- }
1856
+ },
1857
+ deprecated: true
1857
1858
  }
1858
1859
  ];
1859
1860
  var BEDROCK_REGIONS = [
@@ -2231,6 +2232,205 @@ var bedrockFactory = {
2231
2232
  create: () => new BedrockAdapter()
2232
2233
  };
2233
2234
 
2235
+ // src/adapters/azure-openai/adapter.ts
2236
+ import { AzureOpenAI } from "openai";
2237
+
2238
+ // src/adapters/azure-openai/manifest.ts
2239
+ var AZURE_OPENAI_KNOWN_MODELS = [
2240
+ {
2241
+ id: "gpt-4o",
2242
+ displayName: "GPT-4o (on Azure)",
2243
+ capabilities: {
2244
+ streaming: true,
2245
+ tools: true,
2246
+ vision: true,
2247
+ systemPrompt: true,
2248
+ maxContextTokens: 128e3
2249
+ }
2250
+ },
2251
+ {
2252
+ id: "gpt-4o-mini",
2253
+ displayName: "GPT-4o mini (on Azure)",
2254
+ capabilities: {
2255
+ streaming: true,
2256
+ tools: true,
2257
+ vision: true,
2258
+ systemPrompt: true,
2259
+ maxContextTokens: 128e3
2260
+ }
2261
+ },
2262
+ {
2263
+ id: "gpt-4-turbo",
2264
+ displayName: "GPT-4 Turbo (on Azure)",
2265
+ capabilities: {
2266
+ streaming: true,
2267
+ tools: true,
2268
+ vision: true,
2269
+ systemPrompt: true,
2270
+ maxContextTokens: 128e3
2271
+ }
2272
+ },
2273
+ {
2274
+ // Azure spells it `gpt-35-turbo` (no dot). Keep their spelling for the id
2275
+ // so capability lookups against deployment names that echo the Azure id
2276
+ // hit.
2277
+ id: "gpt-35-turbo",
2278
+ displayName: "GPT-3.5 Turbo (on Azure)",
2279
+ capabilities: {
2280
+ streaming: true,
2281
+ tools: true,
2282
+ vision: false,
2283
+ systemPrompt: true,
2284
+ maxContextTokens: 16385
2285
+ }
2286
+ },
2287
+ {
2288
+ id: "o1-preview",
2289
+ displayName: "o1 preview \u2014 reasoning (on Azure)",
2290
+ capabilities: {
2291
+ streaming: false,
2292
+ tools: false,
2293
+ vision: false,
2294
+ systemPrompt: false,
2295
+ maxContextTokens: 128e3
2296
+ }
2297
+ },
2298
+ {
2299
+ id: "o1-mini",
2300
+ displayName: "o1 mini \u2014 reasoning (on Azure)",
2301
+ capabilities: {
2302
+ streaming: false,
2303
+ tools: false,
2304
+ vision: false,
2305
+ systemPrompt: false,
2306
+ maxContextTokens: 128e3
2307
+ }
2308
+ }
2309
+ ];
2310
+ var azureOpenAIManifest = {
2311
+ vendor: "azure-openai",
2312
+ displayName: "Azure OpenAI",
2313
+ authKinds: [
2314
+ {
2315
+ kind: "azureOpenAIApiKey",
2316
+ displayName: "API Key",
2317
+ fields: [
2318
+ {
2319
+ name: "apiKey",
2320
+ label: "API Key",
2321
+ type: "password",
2322
+ required: true,
2323
+ help: "Azure OpenAI resource key. Find it in the Azure portal under your OpenAI resource \u2192 Keys and Endpoint."
2324
+ },
2325
+ {
2326
+ name: "endpoint",
2327
+ label: "Endpoint",
2328
+ type: "url",
2329
+ required: true,
2330
+ help: "Resource endpoint URL, e.g. https://my-resource.openai.azure.com. Shown in the Azure portal alongside the keys."
2331
+ },
2332
+ {
2333
+ name: "deployment",
2334
+ label: "Deployment Name",
2335
+ type: "text",
2336
+ required: true,
2337
+ help: "The name you chose for the deployment in Azure AI Studio (NOT the underlying model id \u2014 deployments can be named anything)."
2338
+ },
2339
+ {
2340
+ name: "apiVersion",
2341
+ label: "API Version",
2342
+ type: "text",
2343
+ required: true,
2344
+ default: "2024-10-21",
2345
+ help: "Data-plane api-version, e.g. 2024-10-21. Microsoft rolls these frequently; see Azure OpenAI API reference docs for the current stable GA version."
2346
+ }
2347
+ ]
2348
+ }
2349
+ ],
2350
+ knownModels: AZURE_OPENAI_KNOWN_MODELS,
2351
+ // Azure's list-deployments endpoint is on the control plane (ARM) and
2352
+ // requires AAD credentials the data-plane API key doesn't carry. Return
2353
+ // the curated set from the manifest.
2354
+ supportsModelListing: false,
2355
+ docsUrl: "https://learn.microsoft.com/en-us/azure/ai-services/openai/reference"
2356
+ };
2357
+
2358
+ // src/adapters/azure-openai/adapter.ts
2359
+ var AzureOpenAIAdapter = class {
2360
+ vendor = azureOpenAIManifest.vendor;
2361
+ acceptedAuth = ["azureOpenAIApiKey"];
2362
+ client;
2363
+ init(auth, client) {
2364
+ if (auth.kind !== "azureOpenAIApiKey") {
2365
+ throw new Error(
2366
+ `AzureOpenAIAdapter: unsupported auth kind '${auth.kind}'`
2367
+ );
2368
+ }
2369
+ if (!auth.apiKey) {
2370
+ throw new Error("AzureOpenAIAdapter: apiKey is required");
2371
+ }
2372
+ if (!auth.endpoint) {
2373
+ throw new Error("AzureOpenAIAdapter: endpoint is required");
2374
+ }
2375
+ if (!auth.deployment) {
2376
+ throw new Error("AzureOpenAIAdapter: deployment is required");
2377
+ }
2378
+ if (!auth.apiVersion) {
2379
+ throw new Error("AzureOpenAIAdapter: apiVersion is required");
2380
+ }
2381
+ this.client = new AzureOpenAI({
2382
+ apiKey: auth.apiKey,
2383
+ endpoint: auth.endpoint,
2384
+ apiVersion: auth.apiVersion,
2385
+ deployment: auth.deployment,
2386
+ ...client?.timeout !== void 0 ? { timeout: client.timeout } : {},
2387
+ ...client?.maxRetries !== void 0 ? { maxRetries: client.maxRetries } : {}
2388
+ });
2389
+ }
2390
+ stream(req) {
2391
+ return streamFromOpenAI(this.ensureClient(), req, {
2392
+ knownModels: azureOpenAIManifest.knownModels
2393
+ });
2394
+ }
2395
+ appendAssistantToolCall(history, toolCalls) {
2396
+ return appendOpenAIAssistantToolCall(history, toolCalls);
2397
+ }
2398
+ appendToolResult(history, toolCallId, result) {
2399
+ return appendOpenAIToolResult(history, toolCallId, result);
2400
+ }
2401
+ async listAvailableModels() {
2402
+ return [...azureOpenAIManifest.knownModels];
2403
+ }
2404
+ async testCredential() {
2405
+ const client = this.ensureClient();
2406
+ await client.chat.completions.create({
2407
+ // Azure ignores `model` when a deployment is in the URL, but the SDK
2408
+ // still requires it as a parameter.
2409
+ model: "probe",
2410
+ messages: [{ role: "user", content: "ping" }],
2411
+ max_tokens: 1,
2412
+ stream: false
2413
+ });
2414
+ }
2415
+ async warmup() {
2416
+ }
2417
+ ensureClient() {
2418
+ if (!this.client) {
2419
+ throw new Error(
2420
+ "AzureOpenAIAdapter: init() must be called before stream()/listAvailableModels()"
2421
+ );
2422
+ }
2423
+ return this.client;
2424
+ }
2425
+ };
2426
+
2427
+ // src/adapters/azure-openai/factory.ts
2428
+ var azureOpenAIFactory = {
2429
+ vendor: azureOpenAIManifest.vendor,
2430
+ manifest: azureOpenAIManifest,
2431
+ create: () => new AzureOpenAIAdapter()
2432
+ };
2433
+
2234
2434
  // src/adapters/index.ts
2235
2435
  registerAdapter(openAIFactory);
2236
2436
  registerAdapter(deepseekFactory);
@@ -2239,6 +2439,7 @@ registerAdapter(googleFactory);
2239
2439
  registerAdapter(vertexGeminiFactory);
2240
2440
  registerAdapter(vertexOpenAIFactory);
2241
2441
  registerAdapter(bedrockFactory);
2442
+ registerAdapter(azureOpenAIFactory);
2242
2443
 
2243
2444
  // src/normalize-auth.ts
2244
2445
  function normalizeAuth(vendor, raw) {
@@ -2259,6 +2460,8 @@ function normalizeAuth(vendor, raw) {
2259
2460
  return normalizeVertex(vendor, raw);
2260
2461
  case "bedrock":
2261
2462
  return normalizeBedrock(raw);
2463
+ case "azure-openai":
2464
+ return normalizeAzureOpenAI(raw);
2262
2465
  default:
2263
2466
  throw new Error(
2264
2467
  `normalizeAuth: unknown vendor '${vendor}'. If this is a custom adapter, construct the AuthSpec directly.`
@@ -2338,6 +2541,27 @@ function normalizeBedrock(raw) {
2338
2541
  `normalizeAuth: vendor 'bedrock' requires either (access_key_id + secret_access_key) or api_key`
2339
2542
  );
2340
2543
  }
2544
+ function normalizeAzureOpenAI(raw) {
2545
+ if (!raw.api_key) {
2546
+ throw new Error(`normalizeAuth: vendor 'azure-openai' requires 'api_key'`);
2547
+ }
2548
+ if (!raw.endpoint) {
2549
+ throw new Error(`normalizeAuth: vendor 'azure-openai' requires 'endpoint'`);
2550
+ }
2551
+ if (!raw.deployment) {
2552
+ throw new Error(`normalizeAuth: vendor 'azure-openai' requires 'deployment'`);
2553
+ }
2554
+ if (!raw.api_version) {
2555
+ throw new Error(`normalizeAuth: vendor 'azure-openai' requires 'api_version'`);
2556
+ }
2557
+ return {
2558
+ kind: "azureOpenAIApiKey",
2559
+ apiKey: raw.api_key,
2560
+ endpoint: raw.endpoint,
2561
+ deployment: raw.deployment,
2562
+ apiVersion: raw.api_version
2563
+ };
2564
+ }
2341
2565
  function parseServiceKey(value) {
2342
2566
  if (typeof value === "string") {
2343
2567
  try {
@@ -2349,6 +2573,51 @@ function parseServiceKey(value) {
2349
2573
  return value;
2350
2574
  }
2351
2575
 
2576
+ // src/pick-auth-kind.ts
2577
+ function pickAuthKind(vendor, raw) {
2578
+ const factory = getAdapterFactory(vendor);
2579
+ const { authKinds } = factory.manifest;
2580
+ if (authKinds.length === 1) {
2581
+ return authKinds[0];
2582
+ }
2583
+ switch (vendor) {
2584
+ case "bedrock": {
2585
+ const iam = authKinds.find((k) => k.kind === "bedrockIam");
2586
+ const apiKey = authKinds.find((k) => k.kind === "bedrockApiKey");
2587
+ if (raw.access_key_id && raw.secret_access_key) {
2588
+ if (!iam) throw new Error(`pickAuthKind: bedrock manifest missing 'bedrockIam'`);
2589
+ return iam;
2590
+ }
2591
+ if (raw.api_key) {
2592
+ if (!apiKey) throw new Error(`pickAuthKind: bedrock manifest missing 'bedrockApiKey'`);
2593
+ return apiKey;
2594
+ }
2595
+ throw new Error(
2596
+ `pickAuthKind: bedrock credential missing both 'api_key' and ('access_key_id' + 'secret_access_key')`
2597
+ );
2598
+ }
2599
+ case "google": {
2600
+ const svc = authKinds.find((k) => k.kind === "googleServiceAccount");
2601
+ const apiKey = authKinds.find((k) => k.kind === "googleApiKey");
2602
+ if (raw.service_key) {
2603
+ if (!svc) throw new Error(`pickAuthKind: google manifest missing 'googleServiceAccount'`);
2604
+ return svc;
2605
+ }
2606
+ if (raw.api_key) {
2607
+ if (!apiKey) throw new Error(`pickAuthKind: google manifest missing 'googleApiKey'`);
2608
+ return apiKey;
2609
+ }
2610
+ throw new Error(
2611
+ `pickAuthKind: google credential missing both 'api_key' and 'service_key'`
2612
+ );
2613
+ }
2614
+ default:
2615
+ throw new Error(
2616
+ `pickAuthKind: vendor '${vendor}' declares ${authKinds.length} authKinds but has no discriminator rule. Add one in src/pick-auth-kind.ts.`
2617
+ );
2618
+ }
2619
+ }
2620
+
2352
2621
  // src/index.ts
2353
2622
  async function createLlm(args) {
2354
2623
  const factory = getAdapterFactory(args.vendor);
@@ -2369,6 +2638,7 @@ export {
2369
2638
  getManifest,
2370
2639
  listVendors,
2371
2640
  normalizeAuth,
2641
+ pickAuthKind,
2372
2642
  registerAdapter,
2373
2643
  replaceAdapter,
2374
2644
  unregisterAdapter