@xberg-io/liter-llm 2.1.1 → 2.1.2
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/index.d.ts +500 -501
- package/liter-llm-node.darwin-arm64.node +0 -0
- package/liter-llm-node.darwin-x64.node +0 -0
- package/liter-llm-node.linux-arm64-gnu.node +0 -0
- package/liter-llm-node.linux-x64-gnu.node +0 -0
- package/liter-llm-node.win32-arm64-msvc.node +0 -0
- package/liter-llm-node.win32-x64-msvc.node +0 -0
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:f5ae2b84d53ffa717ebbc0fa90e7e6f5e81a5e8c77aabbccf3edcef2946fe3af
|
|
3
3
|
// To regenerate: alef generate
|
|
4
4
|
// To verify freshness: alef verify
|
|
5
5
|
/* eslint-disable */
|
|
@@ -89,12 +89,7 @@ export declare function completionCost(model: string, promptTokens: number, comp
|
|
|
89
89
|
* when `prompt_tokens` is below every tier threshold) use the base rates
|
|
90
90
|
* unchanged, matching the original flat-rate behaviour.
|
|
91
91
|
*/
|
|
92
|
-
export declare function completionCostWithCache(
|
|
93
|
-
model: string,
|
|
94
|
-
promptTokens: number,
|
|
95
|
-
cachedTokens: number,
|
|
96
|
-
completionTokens: number,
|
|
97
|
-
): number | null;
|
|
92
|
+
export declare function completionCostWithCache(model: string, promptTokens: number, cachedTokens: number, completionTokens: number): number | null;
|
|
98
93
|
|
|
99
94
|
/**
|
|
100
95
|
* Return the set of complex provider names.
|
|
@@ -138,13 +133,7 @@ export declare function countTokens(model: string, text: string): number;
|
|
|
138
133
|
* @throws Returns `LiterLlmError` if the underlying HTTP client cannot be
|
|
139
134
|
* constructed, or if the resolved provider configuration is invalid.
|
|
140
135
|
*/
|
|
141
|
-
export declare function createClient(
|
|
142
|
-
apiKey: string,
|
|
143
|
-
baseUrl?: string | undefined | null,
|
|
144
|
-
timeoutSecs?: number | undefined | null,
|
|
145
|
-
maxRetries?: number | undefined | null,
|
|
146
|
-
modelHint?: string | undefined | null,
|
|
147
|
-
): DefaultClient;
|
|
136
|
+
export declare function createClient(apiKey: string, baseUrl?: string | undefined | null, timeoutSecs?: number | undefined | null, maxRetries?: number | undefined | null, modelHint?: string | undefined | null): DefaultClient;
|
|
148
137
|
|
|
149
138
|
/**
|
|
150
139
|
* Create a new LLM client from a JSON string.
|
|
@@ -220,7 +209,9 @@ export declare function installCatalogOverlayFromStr(catalogJson: string): void;
|
|
|
220
209
|
* Providers returning an array of typed parts (e.g. after an image-generation
|
|
221
210
|
* or audio-synthesis request) deserialise into `AssistantContent.Parts(_)`.
|
|
222
211
|
*/
|
|
223
|
-
export type AssistantContent =
|
|
212
|
+
export type AssistantContent =
|
|
213
|
+
| string
|
|
214
|
+
| Array<__AlefWireAssistantPart>
|
|
224
215
|
|
|
225
216
|
/** Assistant's response to a user message. */
|
|
226
217
|
export interface AssistantMessage {
|
|
@@ -229,25 +220,25 @@ export interface AssistantMessage {
|
|
|
229
220
|
*
|
|
230
221
|
* `None` is valid when the model replies with tool calls only.
|
|
231
222
|
*/
|
|
232
|
-
readonly content?: AssistantContent
|
|
223
|
+
readonly content?: AssistantContent
|
|
233
224
|
/** Optional name for the assistant. */
|
|
234
|
-
readonly name?: string
|
|
225
|
+
readonly name?: string
|
|
235
226
|
/** Tool calls the model wants to execute, if any. */
|
|
236
|
-
readonly toolCalls?: Array<ToolCall
|
|
227
|
+
readonly toolCalls?: Array<ToolCall>
|
|
237
228
|
/**
|
|
238
229
|
* Refusal reason, if the model declined to respond per safety policies.
|
|
239
230
|
*
|
|
240
231
|
* OpenAI's response schema requires this key to be present even when null,
|
|
241
232
|
* so it is deliberately not `skip_serializing_if`.
|
|
242
233
|
*/
|
|
243
|
-
readonly refusal?: string
|
|
234
|
+
readonly refusal?: string
|
|
244
235
|
/** Deprecated legacy function_call field; retained for API compatibility. */
|
|
245
|
-
readonly functionCall?: FunctionCall
|
|
236
|
+
readonly functionCall?: FunctionCall
|
|
246
237
|
/**
|
|
247
238
|
* Reasoning/thinking tokens returned by the provider, if any (e.g. DeepSeek R1, Qwen
|
|
248
239
|
* `reasoning_content`, or Anthropic extended thinking).
|
|
249
240
|
*/
|
|
250
|
-
readonly reasoningContent?: string
|
|
241
|
+
readonly reasoningContent?: string
|
|
251
242
|
}
|
|
252
243
|
|
|
253
244
|
/**
|
|
@@ -257,10 +248,10 @@ export interface AssistantMessage {
|
|
|
257
248
|
* parts-spec discriminator (`"type": "text"`, `"type": "output_image"`, …).
|
|
258
249
|
*/
|
|
259
250
|
export type AssistantPart =
|
|
260
|
-
| { type:
|
|
261
|
-
| { type:
|
|
262
|
-
| { type:
|
|
263
|
-
| { type:
|
|
251
|
+
| { type: 'text'; text: string }
|
|
252
|
+
| { type: 'refusal'; refusal: string }
|
|
253
|
+
| { type: 'output_image'; imageUrl: ImageUrl }
|
|
254
|
+
| { type: 'output_audio'; audio: AudioContent }
|
|
264
255
|
|
|
265
256
|
/**
|
|
266
257
|
* Audio content part for speech-capable models.
|
|
@@ -270,24 +261,27 @@ export type AssistantPart =
|
|
|
270
261
|
*/
|
|
271
262
|
export interface AudioContent {
|
|
272
263
|
/** Base64-encoded audio data. */
|
|
273
|
-
readonly data?: string
|
|
264
|
+
readonly data?: string
|
|
274
265
|
/** Audio format (e.g., "wav", "mp3", "ogg"). */
|
|
275
|
-
readonly format?: string
|
|
266
|
+
readonly format?: string
|
|
276
267
|
}
|
|
277
268
|
|
|
278
269
|
/** Auth configuration block. */
|
|
279
270
|
export interface AuthConfig {
|
|
280
271
|
/** Auth scheme classification. */
|
|
281
|
-
readonly authType: AuthType
|
|
272
|
+
readonly authType: AuthType
|
|
282
273
|
/**
|
|
283
274
|
* Name of the environment variable that holds the API key (e.g. `"OPENAI_API_KEY"`).
|
|
284
275
|
* Holds the variable name, never the secret value.
|
|
285
276
|
*/
|
|
286
|
-
readonly envVar?: string
|
|
277
|
+
readonly envVar?: string
|
|
287
278
|
}
|
|
288
279
|
|
|
289
280
|
/** How the API key is sent in the HTTP request. */
|
|
290
|
-
export type AuthHeaderFormat =
|
|
281
|
+
export type AuthHeaderFormat =
|
|
282
|
+
| { type: 'Bearer' }
|
|
283
|
+
| { type: 'ApiKey'; apiKey: string }
|
|
284
|
+
| { type: 'None' }
|
|
291
285
|
|
|
292
286
|
/** Auth scheme used by a provider. */
|
|
293
287
|
export declare enum AuthType {
|
|
@@ -304,65 +298,65 @@ export declare enum AuthType {
|
|
|
304
298
|
/** Query parameters for listing batches. */
|
|
305
299
|
export interface BatchListQuery {
|
|
306
300
|
/** Maximum number of results to return. Defaults to 20. */
|
|
307
|
-
readonly limit?: number
|
|
301
|
+
readonly limit?: number
|
|
308
302
|
/** Pagination cursor: return results after this batch ID. */
|
|
309
|
-
readonly after?: string
|
|
303
|
+
readonly after?: string
|
|
310
304
|
}
|
|
311
305
|
|
|
312
306
|
/** Response from listing batches. */
|
|
313
307
|
export interface BatchListResponse {
|
|
314
308
|
/** Object type (always `"list"`). */
|
|
315
|
-
readonly object?: string
|
|
309
|
+
readonly object?: string
|
|
316
310
|
/** List of batch objects. */
|
|
317
|
-
readonly data?: Array<BatchObject
|
|
311
|
+
readonly data?: Array<BatchObject>
|
|
318
312
|
/** Whether more results are available. */
|
|
319
|
-
readonly hasMore?: boolean
|
|
313
|
+
readonly hasMore?: boolean
|
|
320
314
|
/** First batch ID in the result set (for pagination). */
|
|
321
|
-
readonly firstId?: string
|
|
315
|
+
readonly firstId?: string
|
|
322
316
|
/** Last batch ID in the result set (for pagination). */
|
|
323
|
-
readonly lastId?: string
|
|
317
|
+
readonly lastId?: string
|
|
324
318
|
}
|
|
325
319
|
|
|
326
320
|
/** A batch job object. */
|
|
327
321
|
export interface BatchObject {
|
|
328
322
|
/** Unique batch ID. */
|
|
329
|
-
readonly id?: string
|
|
323
|
+
readonly id?: string
|
|
330
324
|
/** Object type (always `"batch"`). */
|
|
331
|
-
readonly object?: string
|
|
325
|
+
readonly object?: string
|
|
332
326
|
/** API endpoint (e.g., `"/v1/chat/completions"`). */
|
|
333
|
-
readonly endpoint?: string
|
|
327
|
+
readonly endpoint?: string
|
|
334
328
|
/** ID of the input file. */
|
|
335
|
-
readonly inputFileId?: string
|
|
329
|
+
readonly inputFileId?: string
|
|
336
330
|
/** Completion window (e.g., `"24h"`). */
|
|
337
|
-
readonly completionWindow?: string
|
|
331
|
+
readonly completionWindow?: string
|
|
338
332
|
/** Current job status. */
|
|
339
|
-
readonly status?: BatchStatus
|
|
333
|
+
readonly status?: BatchStatus
|
|
340
334
|
/** ID of the output file (present when completed). */
|
|
341
|
-
readonly outputFileId?: string
|
|
335
|
+
readonly outputFileId?: string
|
|
342
336
|
/** ID of the error file (present if some requests failed). */
|
|
343
|
-
readonly errorFileId?: string
|
|
337
|
+
readonly errorFileId?: string
|
|
344
338
|
/** Unix timestamp of batch creation. */
|
|
345
|
-
readonly createdAt?: number
|
|
339
|
+
readonly createdAt?: number
|
|
346
340
|
/** Unix timestamp of completion (if completed). */
|
|
347
|
-
readonly completedAt?: number
|
|
341
|
+
readonly completedAt?: number
|
|
348
342
|
/** Unix timestamp of failure (if failed). */
|
|
349
|
-
readonly failedAt?: number
|
|
343
|
+
readonly failedAt?: number
|
|
350
344
|
/** Unix timestamp of expiration (if expired). */
|
|
351
|
-
readonly expiredAt?: number
|
|
345
|
+
readonly expiredAt?: number
|
|
352
346
|
/** Request processing counts. */
|
|
353
|
-
readonly requestCounts?: BatchRequestCounts
|
|
347
|
+
readonly requestCounts?: BatchRequestCounts
|
|
354
348
|
/** Metadata attached to the batch. */
|
|
355
|
-
readonly metadata?: JsonValue
|
|
349
|
+
readonly metadata?: JsonValue
|
|
356
350
|
}
|
|
357
351
|
|
|
358
352
|
/** Request processing counts for a batch. */
|
|
359
353
|
export interface BatchRequestCounts {
|
|
360
354
|
/** Total requests in the batch. */
|
|
361
|
-
readonly total?: number
|
|
355
|
+
readonly total?: number
|
|
362
356
|
/** Completed requests. */
|
|
363
|
-
readonly completed?: number
|
|
357
|
+
readonly completed?: number
|
|
364
358
|
/** Failed requests. */
|
|
365
|
-
readonly failed?: number
|
|
359
|
+
readonly failed?: number
|
|
366
360
|
}
|
|
367
361
|
|
|
368
362
|
/** Status of a batch job. */
|
|
@@ -403,41 +397,43 @@ export declare enum BatchStatus {
|
|
|
403
397
|
*/
|
|
404
398
|
export interface BedrockConfig {
|
|
405
399
|
/** AWS region (e.g. `"us-east-1"`). */
|
|
406
|
-
readonly region?: string
|
|
400
|
+
readonly region?: string
|
|
407
401
|
/** Cross-region inference profile prefix (e.g. `"us"`). */
|
|
408
|
-
readonly crossRegionPrefix?: string
|
|
402
|
+
readonly crossRegionPrefix?: string
|
|
409
403
|
/** Explicit AWS access key ID. */
|
|
410
|
-
readonly accessKeyId?: string
|
|
404
|
+
readonly accessKeyId?: string
|
|
411
405
|
/** Explicit AWS secret access key. */
|
|
412
|
-
readonly secretAccessKey?: string
|
|
406
|
+
readonly secretAccessKey?: string
|
|
413
407
|
/** Explicit AWS session token (temporary credentials). */
|
|
414
|
-
readonly sessionToken?: string
|
|
408
|
+
readonly sessionToken?: string
|
|
415
409
|
}
|
|
416
410
|
|
|
417
411
|
/** Configuration for budget enforcement. */
|
|
418
412
|
export interface BudgetConfig {
|
|
419
413
|
/** Maximum total spend across all models, in USD. `None` means unlimited. */
|
|
420
|
-
readonly globalLimit?: number
|
|
414
|
+
readonly globalLimit?: number
|
|
421
415
|
/**
|
|
422
416
|
* Per-model spending limits in USD. Models not listed here are only
|
|
423
417
|
* constrained by `global_limit`.
|
|
424
418
|
*/
|
|
425
|
-
readonly modelLimits?: Record<string, number
|
|
419
|
+
readonly modelLimits?: Record<string, number>
|
|
426
420
|
/** Whether to reject requests or merely warn when a limit is exceeded. */
|
|
427
|
-
readonly enforcement?: Enforcement
|
|
421
|
+
readonly enforcement?: Enforcement
|
|
428
422
|
}
|
|
429
423
|
|
|
430
424
|
/** Storage backend for the response cache. */
|
|
431
|
-
export type CacheBackend =
|
|
425
|
+
export type CacheBackend =
|
|
426
|
+
| { type: 'memory' }
|
|
427
|
+
| { type: 'open_dal'; scheme: string; config: Record<string, string> }
|
|
432
428
|
|
|
433
429
|
/** Configuration for the response cache. */
|
|
434
430
|
export interface CacheConfig {
|
|
435
431
|
/** Maximum number of cached entries. */
|
|
436
|
-
readonly maxEntries?: number
|
|
432
|
+
readonly maxEntries?: number
|
|
437
433
|
/** Time-to-live for each cached entry. */
|
|
438
|
-
readonly ttl?: number
|
|
434
|
+
readonly ttl?: number
|
|
439
435
|
/** Storage backend to use. */
|
|
440
|
-
readonly backend?: CacheBackend
|
|
436
|
+
readonly backend?: CacheBackend
|
|
441
437
|
}
|
|
442
438
|
|
|
443
439
|
/**
|
|
@@ -453,53 +449,53 @@ export interface CatalogRefreshConfig {
|
|
|
453
449
|
* `Ok(``RefreshOutcome.Disabled``)` without touching the network,
|
|
454
450
|
* the filesystem, or the overlay registry.
|
|
455
451
|
*/
|
|
456
|
-
readonly enabled?: boolean
|
|
452
|
+
readonly enabled?: boolean
|
|
457
453
|
/**
|
|
458
454
|
* Source URL to fetch `catalog.json` from. Must be `https`. Defaults to
|
|
459
455
|
* `DEFAULT_CATALOG_URL`; configurable so self-hosted mirrors work.
|
|
460
456
|
*/
|
|
461
|
-
readonly sourceUrl?: string
|
|
457
|
+
readonly sourceUrl?: string
|
|
462
458
|
/**
|
|
463
459
|
* How long a cached `catalog.json` remains valid before a network
|
|
464
460
|
* refetch is attempted, in seconds.
|
|
465
461
|
*/
|
|
466
|
-
readonly ttlSeconds?: number
|
|
462
|
+
readonly ttlSeconds?: number
|
|
467
463
|
/**
|
|
468
464
|
* Filesystem path for the on-disk cache. `None` uses a default path
|
|
469
465
|
* under `std.env.temp_dir()`.
|
|
470
466
|
*/
|
|
471
|
-
readonly cachePath?: string
|
|
467
|
+
readonly cachePath?: string
|
|
472
468
|
}
|
|
473
469
|
|
|
474
470
|
/** A streamed chunk of a chat completion response. */
|
|
475
471
|
export interface ChatCompletionChunk {
|
|
476
472
|
/** Unique identifier for this stream. */
|
|
477
|
-
readonly id?: string
|
|
473
|
+
readonly id?: string
|
|
478
474
|
/**
|
|
479
475
|
* Always `"chat.completion.chunk"` from OpenAI-compatible APIs. Stored
|
|
480
476
|
* as a plain `String` so non-standard provider values do not fail parsing.
|
|
481
477
|
*/
|
|
482
|
-
readonly object?: string
|
|
478
|
+
readonly object?: string
|
|
483
479
|
/** Unix timestamp of chunk creation. */
|
|
484
|
-
readonly created?: number
|
|
480
|
+
readonly created?: number
|
|
485
481
|
/** Model used to generate the chunk. */
|
|
486
|
-
readonly model?: string
|
|
482
|
+
readonly model?: string
|
|
487
483
|
/** Streaming choices (delta updates). */
|
|
488
|
-
readonly choices?: Array<StreamChoice
|
|
484
|
+
readonly choices?: Array<StreamChoice>
|
|
489
485
|
/** Token usage (typically only in the final chunk). */
|
|
490
|
-
readonly usage?: Usage
|
|
486
|
+
readonly usage?: Usage
|
|
491
487
|
/** Fingerprint of the system configuration (OpenAI-specific). */
|
|
492
|
-
readonly systemFingerprint?: string
|
|
488
|
+
readonly systemFingerprint?: string
|
|
493
489
|
/** Service tier used (OpenAI-specific). */
|
|
494
|
-
readonly serviceTier?: string
|
|
490
|
+
readonly serviceTier?: string
|
|
495
491
|
}
|
|
496
492
|
|
|
497
493
|
/** Chat completion request (compatible with OpenAI and similar APIs). */
|
|
498
494
|
export interface ChatCompletionRequest {
|
|
499
495
|
/** Model ID (e.g., `"gpt-4o-mini"`, `"claude-3-5-sonnet"`). */
|
|
500
|
-
readonly model?: string
|
|
496
|
+
readonly model?: string
|
|
501
497
|
/** Conversation history from oldest to newest. */
|
|
502
|
-
readonly messages?: Array<Message
|
|
498
|
+
readonly messages?: Array<Message>
|
|
503
499
|
/**
|
|
504
500
|
* Sampling temperature. Higher increases randomness, lower is more deterministic.
|
|
505
501
|
* Defaults to 1.0.
|
|
@@ -513,81 +509,81 @@ export interface ChatCompletionRequest {
|
|
|
513
509
|
* value is forwarded and the provider decides. Consult the target provider's reference
|
|
514
510
|
* rather than assuming `[0.0, 2.0]` is portable.
|
|
515
511
|
*/
|
|
516
|
-
readonly temperature?: number
|
|
512
|
+
readonly temperature?: number
|
|
517
513
|
/**
|
|
518
514
|
* Nucleus sampling parameter. Lower is more focused.
|
|
519
515
|
*
|
|
520
516
|
* Accepted ranges vary by provider (most document `[0.0, 1.0]`, but this is not
|
|
521
517
|
* universal — check the target provider's own documentation for its exact bounds).
|
|
522
518
|
*/
|
|
523
|
-
readonly topP?: number
|
|
519
|
+
readonly topP?: number
|
|
524
520
|
/** Number of chat completions to generate. Defaults to 1. */
|
|
525
|
-
readonly n?: number
|
|
521
|
+
readonly n?: number
|
|
526
522
|
/**
|
|
527
523
|
* Whether to stream the response.
|
|
528
524
|
*
|
|
529
525
|
* Managed by the client layer — do not set directly.
|
|
530
526
|
*/
|
|
531
|
-
readonly stream?: boolean
|
|
527
|
+
readonly stream?: boolean
|
|
532
528
|
/** Stop sequence(s) that halt token generation. */
|
|
533
|
-
readonly stop?: StopSequence
|
|
529
|
+
readonly stop?: StopSequence
|
|
534
530
|
/** Max output tokens. Different from max_completion_tokens in some providers. */
|
|
535
|
-
readonly maxTokens?: number
|
|
531
|
+
readonly maxTokens?: number
|
|
536
532
|
/** Presence penalty in `[-2.0, 2.0]`. Positive discourages repeated topics. */
|
|
537
|
-
readonly presencePenalty?: number
|
|
533
|
+
readonly presencePenalty?: number
|
|
538
534
|
/** Frequency penalty in `[-2.0, 2.0]`. Positive discourages repeated tokens. */
|
|
539
|
-
readonly frequencyPenalty?: number
|
|
535
|
+
readonly frequencyPenalty?: number
|
|
540
536
|
/**
|
|
541
537
|
* Token bias map. Uses `BTreeMap` (sorted keys) for deterministic
|
|
542
538
|
* serialization order — important when hashing or signing requests.
|
|
543
539
|
*/
|
|
544
|
-
readonly logitBias?: Record<string, number
|
|
540
|
+
readonly logitBias?: Record<string, number>
|
|
545
541
|
/** User identifier for request tracking and abuse detection. */
|
|
546
|
-
readonly user?: string
|
|
542
|
+
readonly user?: string
|
|
547
543
|
/** Tools the model can invoke. */
|
|
548
|
-
readonly tools?: Array<ChatCompletionTool
|
|
544
|
+
readonly tools?: Array<ChatCompletionTool>
|
|
549
545
|
/** Tool usage mode (auto, required, none, or specific tool). */
|
|
550
|
-
readonly toolChoice?: ToolChoice
|
|
546
|
+
readonly toolChoice?: ToolChoice
|
|
551
547
|
/** Whether the model can call multiple tools in parallel. Defaults to true. */
|
|
552
|
-
readonly parallelToolCalls?: boolean
|
|
548
|
+
readonly parallelToolCalls?: boolean
|
|
553
549
|
/** Output format constraint (text, JSON, JSON schema). */
|
|
554
|
-
readonly responseFormat?: ResponseFormat
|
|
550
|
+
readonly responseFormat?: ResponseFormat
|
|
555
551
|
/** Streaming options (e.g., include_usage). */
|
|
556
|
-
readonly streamOptions?: StreamOptions
|
|
552
|
+
readonly streamOptions?: StreamOptions
|
|
557
553
|
/** Random seed for reproducible outputs. Provider support varies. */
|
|
558
|
-
readonly seed?: number
|
|
554
|
+
readonly seed?: number
|
|
559
555
|
/** Reasoning effort level (minimal, low, medium, high, max) for extended-thinking models. */
|
|
560
|
-
readonly reasoningEffort?: ReasoningEffort
|
|
556
|
+
readonly reasoningEffort?: ReasoningEffort
|
|
561
557
|
/**
|
|
562
558
|
* Output modalities to request from the model.
|
|
563
559
|
*
|
|
564
560
|
* For OpenAI audio models, pass `["text", "audio"]`. Vertex AI / Gemini
|
|
565
561
|
* translates these to `generationConfig.responseModalities` (uppercase).
|
|
566
562
|
*/
|
|
567
|
-
readonly modalities?: Array<Modality
|
|
563
|
+
readonly modalities?: Array<Modality>
|
|
568
564
|
/** Whether to return log probabilities of the output tokens. */
|
|
569
|
-
readonly logprobs?: boolean
|
|
565
|
+
readonly logprobs?: boolean
|
|
570
566
|
/**
|
|
571
567
|
* Number of most-likely tokens to return log probabilities for, `0..=20`.
|
|
572
568
|
* Requires `logprobs` to be `true`.
|
|
573
569
|
*/
|
|
574
|
-
readonly topLogprobs?: number
|
|
570
|
+
readonly topLogprobs?: number
|
|
575
571
|
/**
|
|
576
572
|
* Upper bound on generated tokens, including reasoning tokens.
|
|
577
573
|
*
|
|
578
574
|
* Supersedes `max_tokens` on OpenAI reasoning models, which reject
|
|
579
575
|
* `max_tokens` outright.
|
|
580
576
|
*/
|
|
581
|
-
readonly maxCompletionTokens?: number
|
|
577
|
+
readonly maxCompletionTokens?: number
|
|
582
578
|
/**
|
|
583
579
|
* Latency tier to process the request under (e.g. `"auto"`, `"default"`,
|
|
584
580
|
* `"flex"`).
|
|
585
581
|
*/
|
|
586
|
-
readonly serviceTier?: string
|
|
582
|
+
readonly serviceTier?: string
|
|
587
583
|
/** Whether to store the completion for later retrieval by the provider. */
|
|
588
|
-
readonly store?: boolean
|
|
584
|
+
readonly store?: boolean
|
|
589
585
|
/** Developer-defined tags attached to the completion. */
|
|
590
|
-
readonly metadata?: Record<string, string
|
|
586
|
+
readonly metadata?: Record<string, string>
|
|
591
587
|
/**
|
|
592
588
|
* Predicted output, for latency reduction when much of the response is
|
|
593
589
|
* known ahead of time.
|
|
@@ -595,61 +591,61 @@ export interface ChatCompletionRequest {
|
|
|
595
591
|
* Untyped: the shape is provider-defined and still evolving, and the
|
|
596
592
|
* value is forwarded verbatim.
|
|
597
593
|
*/
|
|
598
|
-
readonly prediction?: JsonValue
|
|
594
|
+
readonly prediction?: JsonValue
|
|
599
595
|
/**
|
|
600
596
|
* Audio output parameters, required when `modalities` includes `audio`.
|
|
601
597
|
*
|
|
602
598
|
* Untyped for the same reason as `prediction`.
|
|
603
599
|
*/
|
|
604
|
-
readonly audio?: JsonValue
|
|
600
|
+
readonly audio?: JsonValue
|
|
605
601
|
/**
|
|
606
602
|
* Web-search tool configuration for search-enabled models.
|
|
607
603
|
*
|
|
608
604
|
* Untyped for the same reason as `prediction`.
|
|
609
605
|
*/
|
|
610
|
-
readonly webSearchOptions?: JsonValue
|
|
606
|
+
readonly webSearchOptions?: JsonValue
|
|
611
607
|
/**
|
|
612
608
|
* Provider-specific extra parameters merged into the request body.
|
|
613
609
|
* Use for guardrails, safety settings, grounding config, etc.
|
|
614
610
|
*/
|
|
615
|
-
readonly extraBody?: JsonValue
|
|
611
|
+
readonly extraBody?: JsonValue
|
|
616
612
|
}
|
|
617
613
|
|
|
618
614
|
/** Chat completion response from the API. */
|
|
619
615
|
export interface ChatCompletionResponse {
|
|
620
616
|
/** Unique identifier for this response. */
|
|
621
|
-
readonly id?: string
|
|
617
|
+
readonly id?: string
|
|
622
618
|
/**
|
|
623
619
|
* Always `"chat.completion"` from OpenAI-compatible APIs. Stored as a
|
|
624
620
|
* plain `String` so non-standard provider values do not break deserialization.
|
|
625
621
|
*/
|
|
626
|
-
readonly object?: string
|
|
622
|
+
readonly object?: string
|
|
627
623
|
/** Unix timestamp of response creation. */
|
|
628
|
-
readonly created?: number
|
|
624
|
+
readonly created?: number
|
|
629
625
|
/** Model used to generate the response. */
|
|
630
|
-
readonly model?: string
|
|
626
|
+
readonly model?: string
|
|
631
627
|
/** List of completion choices. */
|
|
632
|
-
readonly choices?: Array<Choice
|
|
628
|
+
readonly choices?: Array<Choice>
|
|
633
629
|
/** Token usage statistics. */
|
|
634
|
-
readonly usage?: Usage
|
|
630
|
+
readonly usage?: Usage
|
|
635
631
|
/** Fingerprint of the system configuration (OpenAI-specific). */
|
|
636
|
-
readonly systemFingerprint?: string
|
|
632
|
+
readonly systemFingerprint?: string
|
|
637
633
|
/** Service tier used (OpenAI-specific). */
|
|
638
|
-
readonly serviceTier?: string
|
|
634
|
+
readonly serviceTier?: string
|
|
639
635
|
}
|
|
640
636
|
|
|
641
637
|
/** A tool the model can invoke (currently, all tools are functions). */
|
|
642
638
|
export interface ChatCompletionTool {
|
|
643
639
|
/** Tool type (always "function" in OpenAI spec). */
|
|
644
|
-
readonly toolType: ToolType
|
|
640
|
+
readonly toolType: ToolType
|
|
645
641
|
/** Function definition with name, description, and JSON schema parameters. */
|
|
646
|
-
readonly function: FunctionDefinition
|
|
642
|
+
readonly function: FunctionDefinition
|
|
647
643
|
}
|
|
648
644
|
|
|
649
645
|
/** A single completion choice. */
|
|
650
646
|
export interface Choice {
|
|
651
647
|
/** Index of this choice in the choices array. */
|
|
652
|
-
readonly index?: number
|
|
648
|
+
readonly index?: number
|
|
653
649
|
/**
|
|
654
650
|
* The assistant's message response.
|
|
655
651
|
*
|
|
@@ -658,16 +654,16 @@ export interface Choice {
|
|
|
658
654
|
* keyed on `role`, so a stored field would emit the key twice inside a
|
|
659
655
|
* request. OpenAI's response schema requires it here.
|
|
660
656
|
*/
|
|
661
|
-
readonly message?: AssistantMessage
|
|
657
|
+
readonly message?: AssistantMessage
|
|
662
658
|
/** Why the model stopped generating (stop, length, tool_calls, content_filter, etc.). */
|
|
663
|
-
readonly finishReason?: FinishReason
|
|
659
|
+
readonly finishReason?: FinishReason
|
|
664
660
|
/**
|
|
665
661
|
* Per-token log probabilities, when the request asked for them.
|
|
666
662
|
*
|
|
667
663
|
* Required by OpenAI's response schema as an always-present, nullable key,
|
|
668
664
|
* so this is deliberately not `skip_serializing_if`.
|
|
669
665
|
*/
|
|
670
|
-
readonly logprobs?: JsonValue
|
|
666
|
+
readonly logprobs?: JsonValue
|
|
671
667
|
}
|
|
672
668
|
|
|
673
669
|
/**
|
|
@@ -688,7 +684,7 @@ export interface ChunkMiddleware {
|
|
|
688
684
|
* - `Ok(None)` — drop this chunk silently.
|
|
689
685
|
* - `Err(e)` — propagate as a stream error.
|
|
690
686
|
*/
|
|
691
|
-
process(chunk?: ChatCompletionChunk | undefined | null): ChatCompletionChunk | null
|
|
687
|
+
process(chunk?: ChatCompletionChunk | undefined | null): ChatCompletionChunk | null
|
|
692
688
|
}
|
|
693
689
|
|
|
694
690
|
/** Observable state of a circuit breaker. */
|
|
@@ -703,51 +699,51 @@ export declare enum CircuitState {
|
|
|
703
699
|
|
|
704
700
|
/** A single content part in a user message — text, image, document, or audio. */
|
|
705
701
|
export type ContentPart =
|
|
706
|
-
| { type:
|
|
707
|
-
| { type:
|
|
708
|
-
| { type:
|
|
709
|
-
| { type:
|
|
702
|
+
| { type: 'text'; text: string }
|
|
703
|
+
| { type: 'image_url'; imageUrl: ImageUrl }
|
|
704
|
+
| { type: 'document'; document: DocumentContent }
|
|
705
|
+
| { type: 'input_audio'; inputAudio: AudioContent }
|
|
710
706
|
|
|
711
707
|
/** Request to create a batch job. */
|
|
712
708
|
export interface CreateBatchRequest {
|
|
713
709
|
/** ID of the uploaded input file (JSONL format). */
|
|
714
|
-
readonly inputFileId?: string
|
|
710
|
+
readonly inputFileId?: string
|
|
715
711
|
/** API endpoint (e.g., `"/v1/chat/completions"`). */
|
|
716
|
-
readonly endpoint?: string
|
|
712
|
+
readonly endpoint?: string
|
|
717
713
|
/** Completion window (e.g., `"24h"`). */
|
|
718
|
-
readonly completionWindow?: string
|
|
714
|
+
readonly completionWindow?: string
|
|
719
715
|
/** Optional metadata to attach to the batch. */
|
|
720
|
-
readonly metadata?: JsonValue
|
|
716
|
+
readonly metadata?: JsonValue
|
|
721
717
|
}
|
|
722
718
|
|
|
723
719
|
/** Request to upload a file. */
|
|
724
720
|
export interface CreateFileRequest {
|
|
725
721
|
/** Base64-encoded file data. */
|
|
726
|
-
readonly file?: string
|
|
722
|
+
readonly file?: string
|
|
727
723
|
/** Purpose for the file. */
|
|
728
|
-
readonly purpose?: FilePurpose
|
|
724
|
+
readonly purpose?: FilePurpose
|
|
729
725
|
/** Optional filename to associate with the upload. */
|
|
730
|
-
readonly filename?: string
|
|
726
|
+
readonly filename?: string
|
|
731
727
|
}
|
|
732
728
|
|
|
733
729
|
/** Request to create images from a text prompt. */
|
|
734
730
|
export interface CreateImageRequest {
|
|
735
731
|
/** Text description of the image to generate. */
|
|
736
|
-
readonly prompt?: string
|
|
732
|
+
readonly prompt?: string
|
|
737
733
|
/** Model ID (e.g., `"dall-e-3"`). Optional; API may use default if unset. */
|
|
738
|
-
readonly model?: string
|
|
734
|
+
readonly model?: string
|
|
739
735
|
/** Number of images to generate. Defaults to 1. */
|
|
740
|
-
readonly n?: number
|
|
736
|
+
readonly n?: number
|
|
741
737
|
/** Image size (e.g., `"1024x1024"`, `"1792x1024"`). */
|
|
742
|
-
readonly size?: string
|
|
738
|
+
readonly size?: string
|
|
743
739
|
/** Image quality: `"standard"` or `"hd"`. */
|
|
744
|
-
readonly quality?: string
|
|
740
|
+
readonly quality?: string
|
|
745
741
|
/** Style: `"natural"` or `"vivid"` (DALL-E 3 only). */
|
|
746
|
-
readonly style?: string
|
|
742
|
+
readonly style?: string
|
|
747
743
|
/** Response format: `"url"` or `"b64_json"`. */
|
|
748
|
-
readonly responseFormat?: string
|
|
744
|
+
readonly responseFormat?: string
|
|
749
745
|
/** User identifier for request tracking. */
|
|
750
|
-
readonly user?: string
|
|
746
|
+
readonly user?: string
|
|
751
747
|
}
|
|
752
748
|
|
|
753
749
|
/**
|
|
@@ -779,19 +775,19 @@ export interface CreateResponseRequest {
|
|
|
779
775
|
* stripped and does **not** re-route the request, which stays pinned to the
|
|
780
776
|
* provider the client was constructed with.
|
|
781
777
|
*/
|
|
782
|
-
readonly model?: string
|
|
778
|
+
readonly model?: string
|
|
783
779
|
/** Input data to process (e.g., a document to extract from). */
|
|
784
|
-
readonly input?: JsonValue
|
|
780
|
+
readonly input?: JsonValue
|
|
785
781
|
/** Instructions for processing the input. */
|
|
786
|
-
readonly instructions?: string
|
|
782
|
+
readonly instructions?: string
|
|
787
783
|
/** Available tools the model can use. */
|
|
788
|
-
readonly tools?: Array<ResponseTool
|
|
784
|
+
readonly tools?: Array<ResponseTool>
|
|
789
785
|
/** Sampling temperature in `[0.0, 2.0]`. Defaults to 1.0. */
|
|
790
|
-
readonly temperature?: number
|
|
786
|
+
readonly temperature?: number
|
|
791
787
|
/** Maximum output tokens. */
|
|
792
|
-
readonly maxOutputTokens?: number
|
|
788
|
+
readonly maxOutputTokens?: number
|
|
793
789
|
/** Optional metadata. */
|
|
794
|
-
readonly metadata?: JsonValue
|
|
790
|
+
readonly metadata?: JsonValue
|
|
795
791
|
/**
|
|
796
792
|
* Extra top-level parameters shallow-merged into the request body, OpenAI-Python
|
|
797
793
|
* style (`{**body, **extra_body}`) — keys here override identically named fields
|
|
@@ -806,55 +802,55 @@ export interface CreateResponseRequest {
|
|
|
806
802
|
* A non-object value cannot be merged into the body root and is dropped with a
|
|
807
803
|
* warning rather than sent.
|
|
808
804
|
*/
|
|
809
|
-
readonly extraBody?: JsonValue
|
|
805
|
+
readonly extraBody?: JsonValue
|
|
810
806
|
/**
|
|
811
807
|
* Whether to stream the response.
|
|
812
808
|
*
|
|
813
809
|
* Managed by the client layer — do not set directly.
|
|
814
810
|
*/
|
|
815
|
-
readonly stream?: boolean
|
|
811
|
+
readonly stream?: boolean
|
|
816
812
|
}
|
|
817
813
|
|
|
818
814
|
/** Request to generate speech audio from text. */
|
|
819
815
|
export interface CreateSpeechRequest {
|
|
820
816
|
/** Model ID (e.g., `"tts-1"`, `"tts-1-hd"`). */
|
|
821
|
-
readonly model?: string
|
|
817
|
+
readonly model?: string
|
|
822
818
|
/** Text to synthesize into speech. */
|
|
823
|
-
readonly input?: string
|
|
819
|
+
readonly input?: string
|
|
824
820
|
/** Voice name (e.g., `"alloy"`, `"echo"`, `"fable"`, `"onyx"`, `"nova"`, `"shimmer"`). */
|
|
825
|
-
readonly voice?: string
|
|
821
|
+
readonly voice?: string
|
|
826
822
|
/** Audio format (e.g., `"mp3"`, `"opus"`, `"aac"`, `"flac"`, `"wav"`, `"pcm"`). */
|
|
827
|
-
readonly responseFormat?: string
|
|
823
|
+
readonly responseFormat?: string
|
|
828
824
|
/** Playback speed in `[0.25, 4.0]`. Defaults to 1.0. */
|
|
829
|
-
readonly speed?: number
|
|
825
|
+
readonly speed?: number
|
|
830
826
|
}
|
|
831
827
|
|
|
832
828
|
/** Request to transcribe audio into text. */
|
|
833
829
|
export interface CreateTranscriptionRequest {
|
|
834
830
|
/** Model ID (e.g., `"whisper-1"`). */
|
|
835
|
-
readonly model?: string
|
|
831
|
+
readonly model?: string
|
|
836
832
|
/** Base64-encoded audio file data. */
|
|
837
|
-
readonly file?: string
|
|
833
|
+
readonly file?: string
|
|
838
834
|
/** Language ISO-639-1 code (e.g., `"en"`, `"fr"`, `"de"`). Optional; model auto-detects. */
|
|
839
|
-
readonly language?: string
|
|
835
|
+
readonly language?: string
|
|
840
836
|
/** Optional text to guide the model (improves accuracy for domain-specific terms). */
|
|
841
|
-
readonly prompt?: string
|
|
837
|
+
readonly prompt?: string
|
|
842
838
|
/** Output format (e.g., `"json"`, `"text"`, `"vtt"`, `"srt"`, `"verbose_json"`). */
|
|
843
|
-
readonly responseFormat?: string
|
|
839
|
+
readonly responseFormat?: string
|
|
844
840
|
/** Sampling temperature in `[0.0, 1.0]`. Higher increases variability. Defaults to 0. */
|
|
845
|
-
readonly temperature?: number
|
|
841
|
+
readonly temperature?: number
|
|
846
842
|
}
|
|
847
843
|
|
|
848
844
|
/** Configuration for registering a custom LLM provider at runtime. */
|
|
849
845
|
export interface CustomProviderConfig {
|
|
850
846
|
/** Unique name for this provider (e.g., "my-provider"). */
|
|
851
|
-
readonly name: string
|
|
847
|
+
readonly name: string
|
|
852
848
|
/** Base URL for the provider's API (e.g., `<https://api.my-provider.com/v1>`). */
|
|
853
|
-
readonly baseUrl: string
|
|
849
|
+
readonly baseUrl: string
|
|
854
850
|
/** Authentication header format. */
|
|
855
|
-
readonly authHeader: AuthHeaderFormat
|
|
851
|
+
readonly authHeader: AuthHeaderFormat
|
|
856
852
|
/** Model name prefixes that route to this provider (e.g., `["my-"]`). */
|
|
857
|
-
readonly modelPrefixes: Array<string
|
|
853
|
+
readonly modelPrefixes: Array<string>
|
|
858
854
|
}
|
|
859
855
|
|
|
860
856
|
/**
|
|
@@ -865,9 +861,9 @@ export interface CustomProviderConfig {
|
|
|
865
861
|
*/
|
|
866
862
|
export interface DecodedDataUrl {
|
|
867
863
|
/** MIME type extracted from the URL prefix (verbatim, not normalised). */
|
|
868
|
-
readonly mime?: string
|
|
864
|
+
readonly mime?: string
|
|
869
865
|
/** Decoded base64 payload. */
|
|
870
|
-
readonly data?: Uint8Array
|
|
866
|
+
readonly data?: Uint8Array
|
|
871
867
|
}
|
|
872
868
|
|
|
873
869
|
/**
|
|
@@ -888,29 +884,27 @@ export interface DecodedDataUrl {
|
|
|
888
884
|
* headers are cached at construction to avoid redundant encoding on every request.
|
|
889
885
|
*/
|
|
890
886
|
export declare class DefaultClient {
|
|
891
|
-
chat(req?: ChatCompletionRequest | undefined | null): Promise<ChatCompletionResponse
|
|
892
|
-
chatStream(
|
|
893
|
-
|
|
894
|
-
): Promise<
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
cancelBatch(batchId: string): Promise<BatchObject>;
|
|
913
|
-
fetchBatchForPolling(batchId: string): Promise<BatchObject>;
|
|
887
|
+
chat(req?: ChatCompletionRequest | undefined | null): Promise<ChatCompletionResponse>
|
|
888
|
+
chatStream(req?: ChatCompletionRequest | undefined | null): Promise<AsyncGenerator<ChatCompletionChunk, void, undefined>>
|
|
889
|
+
embed(req?: EmbeddingRequest | undefined | null): Promise<EmbeddingResponse>
|
|
890
|
+
listModels(): Promise<ModelsListResponse>
|
|
891
|
+
imageGenerate(req?: CreateImageRequest | undefined | null): Promise<ImagesResponse>
|
|
892
|
+
speech(req?: CreateSpeechRequest | undefined | null): Promise<Uint8Array>
|
|
893
|
+
transcribe(req?: CreateTranscriptionRequest | undefined | null): Promise<TranscriptionResponse>
|
|
894
|
+
moderate(req?: ModerationRequest | undefined | null): Promise<ModerationResponse>
|
|
895
|
+
rerank(req?: RerankRequest | undefined | null): Promise<RerankResponse>
|
|
896
|
+
search(req?: SearchRequest | undefined | null): Promise<SearchResponse>
|
|
897
|
+
ocr(req?: OcrRequest | undefined | null): Promise<OcrResponse>
|
|
898
|
+
createFile(req?: CreateFileRequest | undefined | null): Promise<FileObject>
|
|
899
|
+
retrieveFile(fileId: string): Promise<FileObject>
|
|
900
|
+
deleteFile(fileId: string): Promise<DeleteResponse>
|
|
901
|
+
listFiles(query?: FileListQuery | undefined | null): Promise<FileListResponse>
|
|
902
|
+
fileContent(fileId: string): Promise<Uint8Array>
|
|
903
|
+
createBatch(req?: CreateBatchRequest | undefined | null): Promise<BatchObject>
|
|
904
|
+
retrieveBatch(batchId: string): Promise<BatchObject>
|
|
905
|
+
listBatches(query?: BatchListQuery | undefined | null): Promise<BatchListResponse>
|
|
906
|
+
cancelBatch(batchId: string): Promise<BatchObject>
|
|
907
|
+
fetchBatchForPolling(batchId: string): Promise<BatchObject>
|
|
914
908
|
/**
|
|
915
909
|
* Poll a batch until it reaches a terminal status (Completed, Failed, Expired, Cancelled).
|
|
916
910
|
*
|
|
@@ -920,43 +914,43 @@ export declare class DefaultClient {
|
|
|
920
914
|
* Returns `BatchWaitError.Timeout` if the configured timeout is exceeded.
|
|
921
915
|
* Returns `BatchWaitError.Client` for underlying client errors.
|
|
922
916
|
*/
|
|
923
|
-
waitForBatch(batchId: string, config?: WaitForBatchConfig | undefined | null): Promise<BatchObject
|
|
924
|
-
createResponse(req?: CreateResponseRequest | undefined | null): Promise<ResponseObject
|
|
925
|
-
retrieveResponse(responseId: string): Promise<ResponseObject
|
|
926
|
-
cancelResponse(responseId: string): Promise<ResponseObject
|
|
917
|
+
waitForBatch(batchId: string, config?: WaitForBatchConfig | undefined | null): Promise<BatchObject>
|
|
918
|
+
createResponse(req?: CreateResponseRequest | undefined | null): Promise<ResponseObject>
|
|
919
|
+
retrieveResponse(responseId: string): Promise<ResponseObject>
|
|
920
|
+
cancelResponse(responseId: string): Promise<ResponseObject>
|
|
927
921
|
}
|
|
928
922
|
|
|
929
923
|
/** Response from a delete operation. */
|
|
930
924
|
export interface DeleteResponse {
|
|
931
925
|
/** ID of the deleted resource. */
|
|
932
|
-
readonly id?: string
|
|
926
|
+
readonly id?: string
|
|
933
927
|
/** Object type. */
|
|
934
|
-
readonly object?: string
|
|
928
|
+
readonly object?: string
|
|
935
929
|
/** Confirmation that the resource was deleted. */
|
|
936
|
-
readonly deleted?: boolean
|
|
930
|
+
readonly deleted?: boolean
|
|
937
931
|
}
|
|
938
932
|
|
|
939
933
|
/** Developer message (system-like message for Claude models). */
|
|
940
934
|
export interface DeveloperMessage {
|
|
941
935
|
/** Developer-specific instructions or context. */
|
|
942
|
-
readonly content?: string
|
|
936
|
+
readonly content?: string
|
|
943
937
|
/** Optional name for the developer message source. */
|
|
944
|
-
readonly name?: string
|
|
938
|
+
readonly name?: string
|
|
945
939
|
}
|
|
946
940
|
|
|
947
941
|
/** PDF/document content part for vision-capable models. */
|
|
948
942
|
export interface DocumentContent {
|
|
949
943
|
/** Base64-encoded document data or URL. */
|
|
950
|
-
readonly data?: string
|
|
944
|
+
readonly data?: string
|
|
951
945
|
/** MIME type (e.g., "application/pdf", "text/csv"). */
|
|
952
|
-
readonly mediaType?: string
|
|
946
|
+
readonly mediaType?: string
|
|
953
947
|
}
|
|
954
948
|
|
|
955
949
|
/** A content part in a multimodal embedding input. */
|
|
956
950
|
export type EmbeddingContentPart =
|
|
957
|
-
| { type:
|
|
958
|
-
| { type:
|
|
959
|
-
| { type:
|
|
951
|
+
| { type: 'text'; text: string }
|
|
952
|
+
| { type: 'image_url'; imageUrl: ImageUrl }
|
|
953
|
+
| { type: 'image_base64'; imageBase64: string }
|
|
960
954
|
|
|
961
955
|
/** The format in which the embedding vectors are returned. */
|
|
962
956
|
export declare enum EmbeddingFormat {
|
|
@@ -967,7 +961,10 @@ export declare enum EmbeddingFormat {
|
|
|
967
961
|
}
|
|
968
962
|
|
|
969
963
|
/** Text, texts, or multimodal content to embed. */
|
|
970
|
-
export type EmbeddingInput =
|
|
964
|
+
export type EmbeddingInput =
|
|
965
|
+
| string
|
|
966
|
+
| Array<string>
|
|
967
|
+
| Array<__AlefWireEmbeddingContentPart>
|
|
971
968
|
|
|
972
969
|
/** A single embedding vector. */
|
|
973
970
|
export interface EmbeddingObject {
|
|
@@ -975,7 +972,7 @@ export interface EmbeddingObject {
|
|
|
975
972
|
* Always `"embedding"` from OpenAI-compatible APIs. Stored as a plain
|
|
976
973
|
* `String` so non-standard provider values do not break deserialization.
|
|
977
974
|
*/
|
|
978
|
-
readonly object: string
|
|
975
|
+
readonly object: string
|
|
979
976
|
/**
|
|
980
977
|
* The embedding vector.
|
|
981
978
|
*
|
|
@@ -984,23 +981,23 @@ export interface EmbeddingObject {
|
|
|
984
981
|
* little-endian `f32` bytes. Base64 responses are decoded on read; this
|
|
985
982
|
* field always serializes back out as a JSON float array.
|
|
986
983
|
*/
|
|
987
|
-
readonly embedding: Array<number
|
|
984
|
+
readonly embedding: Array<number>
|
|
988
985
|
/** Index in the batch (corresponds to input order). */
|
|
989
|
-
readonly index: number
|
|
986
|
+
readonly index: number
|
|
990
987
|
}
|
|
991
988
|
|
|
992
989
|
/** Embedding request. */
|
|
993
990
|
export interface EmbeddingRequest {
|
|
994
991
|
/** Model ID (e.g., `"text-embedding-3-small"`). */
|
|
995
|
-
readonly model?: string
|
|
992
|
+
readonly model?: string
|
|
996
993
|
/** Text, texts, or multimodal content to embed. */
|
|
997
|
-
readonly input?: EmbeddingInput
|
|
994
|
+
readonly input?: EmbeddingInput
|
|
998
995
|
/** Output format: float (native) or base64. */
|
|
999
|
-
readonly encodingFormat?: EmbeddingFormat
|
|
996
|
+
readonly encodingFormat?: EmbeddingFormat
|
|
1000
997
|
/** Requested embedding dimensions (if supported by the model). */
|
|
1001
|
-
readonly dimensions?: number
|
|
998
|
+
readonly dimensions?: number
|
|
1002
999
|
/** User identifier for request tracking. */
|
|
1003
|
-
readonly user?: string
|
|
1000
|
+
readonly user?: string
|
|
1004
1001
|
}
|
|
1005
1002
|
|
|
1006
1003
|
/** Embedding response. */
|
|
@@ -1009,13 +1006,13 @@ export interface EmbeddingResponse {
|
|
|
1009
1006
|
* Always `"list"` from OpenAI-compatible APIs. Stored as a plain
|
|
1010
1007
|
* `String` so non-standard provider values do not break deserialization.
|
|
1011
1008
|
*/
|
|
1012
|
-
readonly object: string
|
|
1009
|
+
readonly object: string
|
|
1013
1010
|
/** List of embeddings. */
|
|
1014
|
-
readonly data: Array<EmbeddingObject
|
|
1011
|
+
readonly data: Array<EmbeddingObject>
|
|
1015
1012
|
/** Model used to generate embeddings. */
|
|
1016
|
-
readonly model: string
|
|
1013
|
+
readonly model: string
|
|
1017
1014
|
/** Token usage (input tokens only; embeddings have zero output tokens). */
|
|
1018
|
-
readonly usage?: Usage
|
|
1015
|
+
readonly usage?: Usage
|
|
1019
1016
|
}
|
|
1020
1017
|
|
|
1021
1018
|
/** How budget limits are enforced. */
|
|
@@ -1035,39 +1032,39 @@ export declare enum Enforcement {
|
|
|
1035
1032
|
/** Query parameters for listing files. */
|
|
1036
1033
|
export interface FileListQuery {
|
|
1037
1034
|
/** Filter by file purpose (e.g., `"batch"`, `"fine-tune"`). */
|
|
1038
|
-
readonly purpose?: string
|
|
1035
|
+
readonly purpose?: string
|
|
1039
1036
|
/** Maximum number of results to return. Defaults to 20. */
|
|
1040
|
-
readonly limit?: number
|
|
1037
|
+
readonly limit?: number
|
|
1041
1038
|
/** Pagination cursor: return results after this file ID. */
|
|
1042
|
-
readonly after?: string
|
|
1039
|
+
readonly after?: string
|
|
1043
1040
|
}
|
|
1044
1041
|
|
|
1045
1042
|
/** Response from listing files. */
|
|
1046
1043
|
export interface FileListResponse {
|
|
1047
1044
|
/** Object type (always `"list"`). */
|
|
1048
|
-
readonly object?: string
|
|
1045
|
+
readonly object?: string
|
|
1049
1046
|
/** List of file objects. */
|
|
1050
|
-
readonly data?: Array<FileObject
|
|
1047
|
+
readonly data?: Array<FileObject>
|
|
1051
1048
|
/** Whether more results are available. */
|
|
1052
|
-
readonly hasMore?: boolean
|
|
1049
|
+
readonly hasMore?: boolean
|
|
1053
1050
|
}
|
|
1054
1051
|
|
|
1055
1052
|
/** An uploaded file object. */
|
|
1056
1053
|
export interface FileObject {
|
|
1057
1054
|
/** Unique file ID. */
|
|
1058
|
-
readonly id?: string
|
|
1055
|
+
readonly id?: string
|
|
1059
1056
|
/** Object type (always `"file"`). */
|
|
1060
|
-
readonly object?: string
|
|
1057
|
+
readonly object?: string
|
|
1061
1058
|
/** File size in bytes. */
|
|
1062
|
-
readonly bytes?: number
|
|
1059
|
+
readonly bytes?: number
|
|
1063
1060
|
/** Unix timestamp of file creation. */
|
|
1064
|
-
readonly createdAt?: number
|
|
1061
|
+
readonly createdAt?: number
|
|
1065
1062
|
/** Filename. */
|
|
1066
|
-
readonly filename?: string
|
|
1063
|
+
readonly filename?: string
|
|
1067
1064
|
/** File purpose. */
|
|
1068
|
-
readonly purpose?: string
|
|
1065
|
+
readonly purpose?: string
|
|
1069
1066
|
/** Processing status (e.g., `"uploaded"`, `"processed"`). */
|
|
1070
|
-
readonly status?: string
|
|
1067
|
+
readonly status?: string
|
|
1071
1068
|
}
|
|
1072
1069
|
|
|
1073
1070
|
/** Purpose of an uploaded file. */
|
|
@@ -1105,27 +1102,27 @@ export declare enum FinishReason {
|
|
|
1105
1102
|
/** Function call details. */
|
|
1106
1103
|
export interface FunctionCall {
|
|
1107
1104
|
/** Function name. */
|
|
1108
|
-
readonly name: string
|
|
1105
|
+
readonly name: string
|
|
1109
1106
|
/** Arguments as a JSON string (parse with serde_json.from_str). */
|
|
1110
|
-
readonly arguments: string
|
|
1107
|
+
readonly arguments: string
|
|
1111
1108
|
}
|
|
1112
1109
|
|
|
1113
1110
|
/** Function definition exposed to the model. */
|
|
1114
1111
|
export interface FunctionDefinition {
|
|
1115
1112
|
/** Name of the function. Required and must be alphanumeric + underscores. */
|
|
1116
|
-
readonly name: string
|
|
1113
|
+
readonly name: string
|
|
1117
1114
|
/** Human-readable description explaining what the function does. */
|
|
1118
|
-
readonly description?: string
|
|
1115
|
+
readonly description?: string
|
|
1119
1116
|
/** JSON Schema defining the function's parameters. */
|
|
1120
|
-
readonly parameters?: JsonValue
|
|
1117
|
+
readonly parameters?: JsonValue
|
|
1121
1118
|
/** If true, enforce strict JSON schema validation for arguments. */
|
|
1122
|
-
readonly strict?: boolean
|
|
1119
|
+
readonly strict?: boolean
|
|
1123
1120
|
}
|
|
1124
1121
|
|
|
1125
1122
|
/** Deprecated legacy function-role message body. */
|
|
1126
1123
|
export interface FunctionMessage {
|
|
1127
|
-
readonly content?: string
|
|
1128
|
-
readonly name?: string
|
|
1124
|
+
readonly content?: string
|
|
1125
|
+
readonly name?: string
|
|
1129
1126
|
}
|
|
1130
1127
|
|
|
1131
1128
|
/**
|
|
@@ -1142,7 +1139,7 @@ export interface HealthChecker {
|
|
|
1142
1139
|
* move it into the returned future without a clone, making the
|
|
1143
1140
|
* `'static + Send` bound on the future trivially satisfiable.
|
|
1144
1141
|
*/
|
|
1145
|
-
check(upstream: string): Promise<HealthStatus
|
|
1142
|
+
check(upstream: string): Promise<HealthStatus>
|
|
1146
1143
|
}
|
|
1147
1144
|
|
|
1148
1145
|
/** The result of a single health probe. */
|
|
@@ -1156,11 +1153,11 @@ export declare enum HealthStatus {
|
|
|
1156
1153
|
/** A single generated image, returned as either a URL or base64 data. */
|
|
1157
1154
|
export interface Image {
|
|
1158
1155
|
/** Image URL (if response_format was "url"). */
|
|
1159
|
-
readonly url?: string
|
|
1156
|
+
readonly url?: string
|
|
1160
1157
|
/** Base64-encoded image data (if response_format was "b64_json"). */
|
|
1161
|
-
readonly b64Json?: string
|
|
1158
|
+
readonly b64Json?: string
|
|
1162
1159
|
/** The final prompt used to generate the image (DALL-E 3). */
|
|
1163
|
-
readonly revisedPrompt?: string
|
|
1160
|
+
readonly revisedPrompt?: string
|
|
1164
1161
|
}
|
|
1165
1162
|
|
|
1166
1163
|
/** Image detail level controlling token cost and processing. */
|
|
@@ -1176,9 +1173,9 @@ export declare enum ImageDetail {
|
|
|
1176
1173
|
/** Response containing generated images. */
|
|
1177
1174
|
export interface ImagesResponse {
|
|
1178
1175
|
/** Unix timestamp of image creation. */
|
|
1179
|
-
readonly created?: number
|
|
1176
|
+
readonly created?: number
|
|
1180
1177
|
/** List of generated images. */
|
|
1181
|
-
readonly data?: Array<Image
|
|
1178
|
+
readonly data?: Array<Image>
|
|
1182
1179
|
}
|
|
1183
1180
|
|
|
1184
1181
|
/**
|
|
@@ -1192,59 +1189,59 @@ export interface ImagesResponse {
|
|
|
1192
1189
|
*/
|
|
1193
1190
|
export interface ImageUrl {
|
|
1194
1191
|
/** URL of the image (data URI or HTTP/HTTPS URL). */
|
|
1195
|
-
readonly url?: string
|
|
1192
|
+
readonly url?: string
|
|
1196
1193
|
/** Detail level: low (512x512), high (2x2 tiles), or auto (model-selected). */
|
|
1197
|
-
readonly detail?: ImageDetail
|
|
1194
|
+
readonly detail?: ImageDetail
|
|
1198
1195
|
}
|
|
1199
1196
|
|
|
1200
1197
|
/** Configuration for the global per-client in-flight request limit. */
|
|
1201
1198
|
export interface InFlightLimitConfig {
|
|
1202
1199
|
/** Maximum simultaneously outstanding provider requests. `None` means unlimited. */
|
|
1203
|
-
readonly maxInFlight?: number
|
|
1200
|
+
readonly maxInFlight?: number
|
|
1204
1201
|
}
|
|
1205
1202
|
|
|
1206
1203
|
/** An intent prototype: `(intent_name, prototype_embedding, target_model_id)`. */
|
|
1207
1204
|
export interface IntentPrototype {
|
|
1208
1205
|
/** Human-readable name for the intent (used in logs/metrics). */
|
|
1209
|
-
readonly name: string
|
|
1206
|
+
readonly name: string
|
|
1210
1207
|
/** Pre-computed embedding vector for this intent. */
|
|
1211
|
-
readonly embedding: Array<number
|
|
1208
|
+
readonly embedding: Array<number>
|
|
1212
1209
|
/** Model to route to when this intent is detected. */
|
|
1213
|
-
readonly model: string
|
|
1210
|
+
readonly model: string
|
|
1214
1211
|
}
|
|
1215
1212
|
|
|
1216
1213
|
/** JSON Schema specification for constrained output. */
|
|
1217
1214
|
export interface JsonSchemaFormat {
|
|
1218
1215
|
/** Name of the schema (must be unique in the request). */
|
|
1219
|
-
readonly name?: string
|
|
1216
|
+
readonly name?: string
|
|
1220
1217
|
/** Description of what the schema represents. */
|
|
1221
|
-
readonly description?: string
|
|
1218
|
+
readonly description?: string
|
|
1222
1219
|
/** JSON Schema object defining the output structure. */
|
|
1223
|
-
readonly schema?: JsonValue
|
|
1220
|
+
readonly schema?: JsonValue
|
|
1224
1221
|
/** If true, enforce strict schema validation. */
|
|
1225
|
-
readonly strict?: boolean
|
|
1222
|
+
readonly strict?: boolean
|
|
1226
1223
|
}
|
|
1227
1224
|
|
|
1228
1225
|
/** Budget enforcement configuration. */
|
|
1229
1226
|
export interface LlmBudgetConfig {
|
|
1230
1227
|
/** Global spend limit in USD. */
|
|
1231
|
-
readonly globalLimit?: number
|
|
1228
|
+
readonly globalLimit?: number
|
|
1232
1229
|
/** Per-model spend limits in USD, keyed by model name. */
|
|
1233
|
-
readonly modelLimits?: Record<string, number
|
|
1230
|
+
readonly modelLimits?: Record<string, number>
|
|
1234
1231
|
/** Enforcement mode: `"hard"` (reject over-budget requests) or `"soft"` (log only). */
|
|
1235
|
-
readonly enforcement?: string
|
|
1232
|
+
readonly enforcement?: string
|
|
1236
1233
|
}
|
|
1237
1234
|
|
|
1238
1235
|
/** Response cache configuration. */
|
|
1239
1236
|
export interface LlmCacheConfig {
|
|
1240
1237
|
/** Maximum number of cached entries. */
|
|
1241
|
-
readonly maxEntries?: number
|
|
1238
|
+
readonly maxEntries?: number
|
|
1242
1239
|
/** Cache entry time-to-live, in seconds. */
|
|
1243
|
-
readonly ttlSeconds?: number
|
|
1240
|
+
readonly ttlSeconds?: number
|
|
1244
1241
|
/** Cache backend name (e.g. `"memory"`, or an `opendal` scheme). */
|
|
1245
|
-
readonly backend?: string
|
|
1242
|
+
readonly backend?: string
|
|
1246
1243
|
/** Backend-specific configuration key/value pairs. */
|
|
1247
|
-
readonly backendConfig?: Record<string, string
|
|
1244
|
+
readonly backendConfig?: Record<string, string>
|
|
1248
1245
|
}
|
|
1249
1246
|
|
|
1250
1247
|
/**
|
|
@@ -1265,77 +1262,77 @@ export interface LlmCacheConfig {
|
|
|
1265
1262
|
*/
|
|
1266
1263
|
export interface LlmConfig {
|
|
1267
1264
|
/** Model identifier (e.g. `"gpt-4o"`, `"bedrock/anthropic.claude-3-sonnet-20240229-v1:0"`). */
|
|
1268
|
-
readonly model?: string
|
|
1265
|
+
readonly model?: string
|
|
1269
1266
|
/** API key for authentication. */
|
|
1270
|
-
readonly apiKey?: string
|
|
1267
|
+
readonly apiKey?: string
|
|
1271
1268
|
/**
|
|
1272
1269
|
* Override base URL. When set, all requests go here and provider
|
|
1273
1270
|
* auto-detection is skipped.
|
|
1274
1271
|
*/
|
|
1275
|
-
readonly baseUrl?: string
|
|
1272
|
+
readonly baseUrl?: string
|
|
1276
1273
|
/** Request timeout, in seconds. */
|
|
1277
|
-
readonly timeoutSecs?: number
|
|
1274
|
+
readonly timeoutSecs?: number
|
|
1278
1275
|
/** Maximum number of retries on 429 / 5xx responses. */
|
|
1279
|
-
readonly maxRetries?: number
|
|
1276
|
+
readonly maxRetries?: number
|
|
1280
1277
|
/** Sampling temperature for requests built from this config. */
|
|
1281
|
-
readonly temperature?: number
|
|
1278
|
+
readonly temperature?: number
|
|
1282
1279
|
/** Maximum number of tokens to generate for requests built from this config. */
|
|
1283
|
-
readonly maxTokens?: number
|
|
1280
|
+
readonly maxTokens?: number
|
|
1284
1281
|
/**
|
|
1285
1282
|
* Automatically load the API key from the provider's environment variable
|
|
1286
1283
|
* when no explicit key is provided (default: `true`).
|
|
1287
1284
|
*/
|
|
1288
|
-
readonly loadEnv?: boolean
|
|
1285
|
+
readonly loadEnv?: boolean
|
|
1289
1286
|
/** Extra headers sent on every request. */
|
|
1290
|
-
readonly headers?: Record<string, string
|
|
1287
|
+
readonly headers?: Record<string, string>
|
|
1291
1288
|
/** Custom provider configurations, in addition to the built-in providers. */
|
|
1292
|
-
readonly providers?: Array<LlmProviderConfig
|
|
1289
|
+
readonly providers?: Array<LlmProviderConfig>
|
|
1293
1290
|
/** Response cache configuration. */
|
|
1294
|
-
readonly cache?: LlmCacheConfig
|
|
1291
|
+
readonly cache?: LlmCacheConfig
|
|
1295
1292
|
/** Budget enforcement configuration. */
|
|
1296
|
-
readonly budget?: LlmBudgetConfig
|
|
1293
|
+
readonly budget?: LlmBudgetConfig
|
|
1297
1294
|
/** Per-model rate limiting configuration. */
|
|
1298
|
-
readonly rateLimit?: LlmRateLimitConfig
|
|
1295
|
+
readonly rateLimit?: LlmRateLimitConfig
|
|
1299
1296
|
/** Global per-client in-flight provider request limit. */
|
|
1300
|
-
readonly inFlightLimit?: LlmInFlightLimitConfig
|
|
1297
|
+
readonly inFlightLimit?: LlmInFlightLimitConfig
|
|
1301
1298
|
/** Enable per-request cost tracking. */
|
|
1302
|
-
readonly costTracking?: boolean
|
|
1299
|
+
readonly costTracking?: boolean
|
|
1303
1300
|
/** Enable OpenTelemetry-compatible tracing spans. */
|
|
1304
|
-
readonly tracing?: boolean
|
|
1301
|
+
readonly tracing?: boolean
|
|
1305
1302
|
/** Cooldown duration after transient errors, in seconds. */
|
|
1306
|
-
readonly cooldownSecs?: number
|
|
1303
|
+
readonly cooldownSecs?: number
|
|
1307
1304
|
/** Background health check interval, in seconds. */
|
|
1308
|
-
readonly healthCheckSecs?: number
|
|
1305
|
+
readonly healthCheckSecs?: number
|
|
1309
1306
|
/** AWS Bedrock configuration (region, credentials, cross-region routing). */
|
|
1310
|
-
readonly bedrock?: BedrockConfig
|
|
1307
|
+
readonly bedrock?: BedrockConfig
|
|
1311
1308
|
}
|
|
1312
1309
|
|
|
1313
1310
|
/** Global per-client in-flight provider request limit. */
|
|
1314
1311
|
export interface LlmInFlightLimitConfig {
|
|
1315
1312
|
/** Maximum simultaneously outstanding provider requests. `None` means unlimited. */
|
|
1316
|
-
readonly maxInFlight?: number
|
|
1313
|
+
readonly maxInFlight?: number
|
|
1317
1314
|
}
|
|
1318
1315
|
|
|
1319
1316
|
/** A custom provider configuration entry. */
|
|
1320
1317
|
export interface LlmProviderConfig {
|
|
1321
1318
|
/** Provider name, used to key model prefix matching. */
|
|
1322
|
-
readonly name?: string
|
|
1319
|
+
readonly name?: string
|
|
1323
1320
|
/** Base URL for the provider's OpenAI-compatible API. */
|
|
1324
|
-
readonly baseUrl?: string
|
|
1321
|
+
readonly baseUrl?: string
|
|
1325
1322
|
/** Header name used to carry the API key (defaults to `Authorization` when unset). */
|
|
1326
|
-
readonly authHeader?: string
|
|
1323
|
+
readonly authHeader?: string
|
|
1327
1324
|
/** Model name prefixes routed to this provider (e.g. `["my-provider/"]`). */
|
|
1328
|
-
readonly modelPrefixes?: Array<string
|
|
1325
|
+
readonly modelPrefixes?: Array<string>
|
|
1329
1326
|
}
|
|
1330
1327
|
|
|
1331
1328
|
/** Per-model rate limiting configuration. */
|
|
1332
1329
|
export interface LlmRateLimitConfig {
|
|
1333
1330
|
/** Requests per minute limit. */
|
|
1334
|
-
readonly rpm?: number
|
|
1331
|
+
readonly rpm?: number
|
|
1335
1332
|
/** Tokens per minute limit. */
|
|
1336
|
-
readonly tpm?: number
|
|
1333
|
+
readonly tpm?: number
|
|
1337
1334
|
/** Rate limit window, in seconds. */
|
|
1338
|
-
readonly windowSeconds?: number
|
|
1335
|
+
readonly windowSeconds?: number
|
|
1339
1336
|
}
|
|
1340
1337
|
|
|
1341
1338
|
/** A chat message in a conversation. */
|
|
@@ -1345,7 +1342,7 @@ export type Message =
|
|
|
1345
1342
|
| ({ role: "assistant" } & AssistantMessage)
|
|
1346
1343
|
| ({ role: "tool" } & ToolMessage)
|
|
1347
1344
|
| ({ role: "developer" } & DeveloperMessage)
|
|
1348
|
-
| ({ role: "function" } & FunctionMessage)
|
|
1345
|
+
| ({ role: "function" } & FunctionMessage)
|
|
1349
1346
|
|
|
1350
1347
|
/**
|
|
1351
1348
|
* Output modality requested from the model.
|
|
@@ -1372,70 +1369,70 @@ export declare enum Modality {
|
|
|
1372
1369
|
*/
|
|
1373
1370
|
export interface ModelInfo {
|
|
1374
1371
|
/** Cost in USD per input (prompt) token. */
|
|
1375
|
-
readonly inputCostPerToken?: number
|
|
1372
|
+
readonly inputCostPerToken?: number
|
|
1376
1373
|
/** Cost in USD per output (completion) token. */
|
|
1377
|
-
readonly outputCostPerToken?: number
|
|
1374
|
+
readonly outputCostPerToken?: number
|
|
1378
1375
|
/** Cost in USD per cached input token (cache hit / read). */
|
|
1379
|
-
readonly cacheReadInputTokenCost?: number
|
|
1376
|
+
readonly cacheReadInputTokenCost?: number
|
|
1380
1377
|
/** Cost in USD per token written to the prompt cache. */
|
|
1381
|
-
readonly cacheCreationInputTokenCost?: number
|
|
1378
|
+
readonly cacheCreationInputTokenCost?: number
|
|
1382
1379
|
/** Cost in USD per input audio token. */
|
|
1383
|
-
readonly inputCostPerAudioToken?: number
|
|
1380
|
+
readonly inputCostPerAudioToken?: number
|
|
1384
1381
|
/** Cost in USD per output audio token. */
|
|
1385
|
-
readonly outputCostPerAudioToken?: number
|
|
1382
|
+
readonly outputCostPerAudioToken?: number
|
|
1386
1383
|
/** Cost in USD per reasoning (extended-thinking) output token. */
|
|
1387
|
-
readonly outputCostPerReasoningToken?: number
|
|
1384
|
+
readonly outputCostPerReasoningToken?: number
|
|
1388
1385
|
/** Total context window size in tokens (input + output). */
|
|
1389
|
-
readonly maxTokens?: number
|
|
1386
|
+
readonly maxTokens?: number
|
|
1390
1387
|
/** Maximum input (prompt) tokens accepted. */
|
|
1391
|
-
readonly maxInputTokens?: number
|
|
1388
|
+
readonly maxInputTokens?: number
|
|
1392
1389
|
/** Maximum output (completion) tokens the model can generate. */
|
|
1393
|
-
readonly maxOutputTokens?: number
|
|
1390
|
+
readonly maxOutputTokens?: number
|
|
1394
1391
|
/** Best-effort operating mode, e.g. `"chat"`, `"embedding"`. */
|
|
1395
|
-
readonly mode?: string
|
|
1392
|
+
readonly mode?: string
|
|
1396
1393
|
/** The model accepts image input. */
|
|
1397
|
-
readonly supportsVision?: boolean
|
|
1394
|
+
readonly supportsVision?: boolean
|
|
1398
1395
|
/** The model supports tool / function calling. */
|
|
1399
|
-
readonly supportsFunctionCalling?: boolean
|
|
1396
|
+
readonly supportsFunctionCalling?: boolean
|
|
1400
1397
|
/** The model supports extended-thinking / reasoning tokens. */
|
|
1401
|
-
readonly supportsReasoning?: boolean
|
|
1398
|
+
readonly supportsReasoning?: boolean
|
|
1402
1399
|
/** The model supports JSON-mode or `response_format` structured output. */
|
|
1403
|
-
readonly supportsStructuredOutput?: boolean
|
|
1400
|
+
readonly supportsStructuredOutput?: boolean
|
|
1404
1401
|
/** The model accepts audio input. */
|
|
1405
|
-
readonly supportsAudioInput?: boolean
|
|
1402
|
+
readonly supportsAudioInput?: boolean
|
|
1406
1403
|
/** The model can generate audio output. */
|
|
1407
|
-
readonly supportsAudioOutput?: boolean
|
|
1404
|
+
readonly supportsAudioOutput?: boolean
|
|
1408
1405
|
/** The model supports prompt caching. */
|
|
1409
|
-
readonly supportsPromptCaching?: boolean
|
|
1406
|
+
readonly supportsPromptCaching?: boolean
|
|
1410
1407
|
/**
|
|
1411
1408
|
* Context-tiered pricing overrides, sorted by ascending
|
|
1412
1409
|
* `min_context_tokens`. Empty when the model has flat pricing.
|
|
1413
1410
|
*/
|
|
1414
|
-
readonly tiers?: Array<ModelTier
|
|
1411
|
+
readonly tiers?: Array<ModelTier>
|
|
1415
1412
|
}
|
|
1416
1413
|
|
|
1417
1414
|
/** A model available from the API. */
|
|
1418
1415
|
export interface ModelObject {
|
|
1419
1416
|
/** Model ID (e.g., `"gpt-4o"`, `"claude-3-5-sonnet"`). */
|
|
1420
|
-
readonly id?: string
|
|
1417
|
+
readonly id?: string
|
|
1421
1418
|
/**
|
|
1422
1419
|
* Always `"model"` from OpenAI-compatible APIs. Stored as a plain
|
|
1423
1420
|
* `String` so non-standard provider values do not break deserialization.
|
|
1424
1421
|
* Defaults to empty when a provider omits the field.
|
|
1425
1422
|
*/
|
|
1426
|
-
readonly object?: string
|
|
1423
|
+
readonly object?: string
|
|
1427
1424
|
/**
|
|
1428
1425
|
* Unix timestamp of model creation (or release date).
|
|
1429
1426
|
*
|
|
1430
1427
|
* Defaults to `0` when a provider omits it — DeepSeek and some other
|
|
1431
1428
|
* OpenAI-compatible providers do not return `created` from `/v1/models`.
|
|
1432
1429
|
*/
|
|
1433
|
-
readonly created?: number
|
|
1430
|
+
readonly created?: number
|
|
1434
1431
|
/**
|
|
1435
1432
|
* Organization or entity that owns the model.
|
|
1436
1433
|
* Defaults to empty when a provider omits the field.
|
|
1437
1434
|
*/
|
|
1438
|
-
readonly ownedBy?: string
|
|
1435
|
+
readonly ownedBy?: string
|
|
1439
1436
|
}
|
|
1440
1437
|
|
|
1441
1438
|
/** Response listing available models. */
|
|
@@ -1445,9 +1442,9 @@ export interface ModelsListResponse {
|
|
|
1445
1442
|
* `String` so non-standard provider values do not break deserialization.
|
|
1446
1443
|
* Defaults to empty when a provider omits the field.
|
|
1447
1444
|
*/
|
|
1448
|
-
readonly object?: string
|
|
1445
|
+
readonly object?: string
|
|
1449
1446
|
/** List of available models. */
|
|
1450
|
-
readonly data?: Array<ModelObject
|
|
1447
|
+
readonly data?: Array<ModelObject>
|
|
1451
1448
|
}
|
|
1452
1449
|
|
|
1453
1450
|
/**
|
|
@@ -1459,157 +1456,161 @@ export interface ModelTier {
|
|
|
1459
1456
|
* The tier applies when the prompt/context token count is at least
|
|
1460
1457
|
* this value.
|
|
1461
1458
|
*/
|
|
1462
|
-
readonly minContextTokens?: number
|
|
1459
|
+
readonly minContextTokens?: number
|
|
1463
1460
|
/** Cost in USD per input (prompt) token within this tier. */
|
|
1464
|
-
readonly inputCostPerToken?: number
|
|
1461
|
+
readonly inputCostPerToken?: number
|
|
1465
1462
|
/** Cost in USD per output (completion) token within this tier. */
|
|
1466
|
-
readonly outputCostPerToken?: number
|
|
1463
|
+
readonly outputCostPerToken?: number
|
|
1467
1464
|
/** Cost in USD per cached input token within this tier. */
|
|
1468
|
-
readonly cacheReadInputTokenCost?: number
|
|
1465
|
+
readonly cacheReadInputTokenCost?: number
|
|
1469
1466
|
/** Cost in USD per cache-write token within this tier. */
|
|
1470
|
-
readonly cacheCreationInputTokenCost?: number
|
|
1467
|
+
readonly cacheCreationInputTokenCost?: number
|
|
1471
1468
|
/** Cost in USD per input audio token within this tier. */
|
|
1472
|
-
readonly inputCostPerAudioToken?: number
|
|
1469
|
+
readonly inputCostPerAudioToken?: number
|
|
1473
1470
|
/** Cost in USD per output audio token within this tier. */
|
|
1474
|
-
readonly outputCostPerAudioToken?: number
|
|
1471
|
+
readonly outputCostPerAudioToken?: number
|
|
1475
1472
|
/** Cost in USD per reasoning output token within this tier. */
|
|
1476
|
-
readonly outputCostPerReasoningToken?: number
|
|
1473
|
+
readonly outputCostPerReasoningToken?: number
|
|
1477
1474
|
}
|
|
1478
1475
|
|
|
1479
1476
|
/** Boolean flags for each moderation category. */
|
|
1480
1477
|
export interface ModerationCategories {
|
|
1481
1478
|
/** Sexual content. */
|
|
1482
|
-
readonly sexual?: boolean
|
|
1479
|
+
readonly sexual?: boolean
|
|
1483
1480
|
/** Hate speech. */
|
|
1484
|
-
readonly hate?: boolean
|
|
1481
|
+
readonly hate?: boolean
|
|
1485
1482
|
/** Harassment. */
|
|
1486
|
-
readonly harassment?: boolean
|
|
1483
|
+
readonly harassment?: boolean
|
|
1487
1484
|
/** Self-harm content. */
|
|
1488
|
-
readonly selfHarm?: boolean
|
|
1485
|
+
readonly selfHarm?: boolean
|
|
1489
1486
|
/** Sexual content involving minors. */
|
|
1490
|
-
readonly sexualMinors?: boolean
|
|
1487
|
+
readonly sexualMinors?: boolean
|
|
1491
1488
|
/** Hate speech that threatens violence. */
|
|
1492
|
-
readonly hateThreatening?: boolean
|
|
1489
|
+
readonly hateThreatening?: boolean
|
|
1493
1490
|
/** Graphic violence. */
|
|
1494
|
-
readonly violenceGraphic?: boolean
|
|
1491
|
+
readonly violenceGraphic?: boolean
|
|
1495
1492
|
/** Intent to self-harm. */
|
|
1496
|
-
readonly selfHarmIntent?: boolean
|
|
1493
|
+
readonly selfHarmIntent?: boolean
|
|
1497
1494
|
/** Instructions for self-harm. */
|
|
1498
|
-
readonly selfHarmInstructions?: boolean
|
|
1495
|
+
readonly selfHarmInstructions?: boolean
|
|
1499
1496
|
/** Harassment that threatens violence. */
|
|
1500
|
-
readonly harassmentThreatening?: boolean
|
|
1497
|
+
readonly harassmentThreatening?: boolean
|
|
1501
1498
|
/** Non-graphic violence. */
|
|
1502
|
-
readonly violence?: boolean
|
|
1499
|
+
readonly violence?: boolean
|
|
1503
1500
|
}
|
|
1504
1501
|
|
|
1505
1502
|
/** Confidence scores for each moderation category. */
|
|
1506
1503
|
export interface ModerationCategoryScores {
|
|
1507
1504
|
/** Sexual content score. */
|
|
1508
|
-
readonly sexual?: number
|
|
1505
|
+
readonly sexual?: number
|
|
1509
1506
|
/** Hate speech score. */
|
|
1510
|
-
readonly hate?: number
|
|
1507
|
+
readonly hate?: number
|
|
1511
1508
|
/** Harassment score. */
|
|
1512
|
-
readonly harassment?: number
|
|
1509
|
+
readonly harassment?: number
|
|
1513
1510
|
/** Self-harm content score. */
|
|
1514
|
-
readonly selfHarm?: number
|
|
1511
|
+
readonly selfHarm?: number
|
|
1515
1512
|
/** Sexual content involving minors score. */
|
|
1516
|
-
readonly sexualMinors?: number
|
|
1513
|
+
readonly sexualMinors?: number
|
|
1517
1514
|
/** Hate speech that threatens violence score. */
|
|
1518
|
-
readonly hateThreatening?: number
|
|
1515
|
+
readonly hateThreatening?: number
|
|
1519
1516
|
/** Graphic violence score. */
|
|
1520
|
-
readonly violenceGraphic?: number
|
|
1517
|
+
readonly violenceGraphic?: number
|
|
1521
1518
|
/** Intent to self-harm score. */
|
|
1522
|
-
readonly selfHarmIntent?: number
|
|
1519
|
+
readonly selfHarmIntent?: number
|
|
1523
1520
|
/** Instructions for self-harm score. */
|
|
1524
|
-
readonly selfHarmInstructions?: number
|
|
1521
|
+
readonly selfHarmInstructions?: number
|
|
1525
1522
|
/** Harassment that threatens violence score. */
|
|
1526
|
-
readonly harassmentThreatening?: number
|
|
1523
|
+
readonly harassmentThreatening?: number
|
|
1527
1524
|
/** Non-graphic violence score. */
|
|
1528
|
-
readonly violence?: number
|
|
1525
|
+
readonly violence?: number
|
|
1529
1526
|
}
|
|
1530
1527
|
|
|
1531
1528
|
/** Input to the moderation endpoint — a single string or multiple strings. */
|
|
1532
|
-
export type ModerationInput =
|
|
1529
|
+
export type ModerationInput =
|
|
1530
|
+
| string
|
|
1531
|
+
| Array<string>
|
|
1533
1532
|
|
|
1534
1533
|
/** Request to classify content for policy violations. */
|
|
1535
1534
|
export interface ModerationRequest {
|
|
1536
1535
|
/** Text or texts to check. */
|
|
1537
|
-
readonly input?: ModerationInput
|
|
1536
|
+
readonly input?: ModerationInput
|
|
1538
1537
|
/** Model ID (e.g., `"text-moderation-latest"`). Optional; API uses default if unset. */
|
|
1539
|
-
readonly model?: string
|
|
1538
|
+
readonly model?: string
|
|
1540
1539
|
}
|
|
1541
1540
|
|
|
1542
1541
|
/** Response from the moderation endpoint. */
|
|
1543
1542
|
export interface ModerationResponse {
|
|
1544
1543
|
/** Unique identifier for this moderation request. */
|
|
1545
|
-
readonly id: string
|
|
1544
|
+
readonly id: string
|
|
1546
1545
|
/** Model used for classification. */
|
|
1547
|
-
readonly model: string
|
|
1546
|
+
readonly model: string
|
|
1548
1547
|
/** Results for each input string. */
|
|
1549
|
-
readonly results: Array<ModerationResult
|
|
1548
|
+
readonly results: Array<ModerationResult>
|
|
1550
1549
|
}
|
|
1551
1550
|
|
|
1552
1551
|
/** A single moderation classification result. */
|
|
1553
1552
|
export interface ModerationResult {
|
|
1554
1553
|
/** True if any category was flagged. */
|
|
1555
|
-
readonly flagged: boolean
|
|
1554
|
+
readonly flagged: boolean
|
|
1556
1555
|
/** Boolean flags for each moderation category. */
|
|
1557
|
-
readonly categories: ModerationCategories
|
|
1556
|
+
readonly categories: ModerationCategories
|
|
1558
1557
|
/** Confidence scores for each category. */
|
|
1559
|
-
readonly categoryScores: ModerationCategoryScores
|
|
1558
|
+
readonly categoryScores: ModerationCategoryScores
|
|
1560
1559
|
}
|
|
1561
1560
|
|
|
1562
1561
|
/** Document input for OCR — either a URL or inline base64 data. */
|
|
1563
|
-
export type OcrDocument =
|
|
1562
|
+
export type OcrDocument =
|
|
1563
|
+
| { type: 'document_url'; url: string }
|
|
1564
|
+
| { type: 'base64'; data: string; mediaType: string }
|
|
1564
1565
|
|
|
1565
1566
|
/** An image extracted from an OCR page. */
|
|
1566
1567
|
export interface OcrImage {
|
|
1567
1568
|
/** Unique image identifier within the document. */
|
|
1568
|
-
readonly id: string
|
|
1569
|
+
readonly id: string
|
|
1569
1570
|
/** Base64-encoded image data (if `include_image_base64` was true). */
|
|
1570
|
-
readonly imageBase64?: string
|
|
1571
|
+
readonly imageBase64?: string
|
|
1571
1572
|
}
|
|
1572
1573
|
|
|
1573
1574
|
/** A single page of OCR output. */
|
|
1574
1575
|
export interface OcrPage {
|
|
1575
1576
|
/** Page index (0-based). */
|
|
1576
|
-
readonly index: number
|
|
1577
|
+
readonly index: number
|
|
1577
1578
|
/** Extracted page content as Markdown. */
|
|
1578
|
-
readonly markdown: string
|
|
1579
|
+
readonly markdown: string
|
|
1579
1580
|
/** Embedded images extracted from the page (if `include_image_base64` was true). */
|
|
1580
|
-
readonly images?: Array<OcrImage
|
|
1581
|
+
readonly images?: Array<OcrImage>
|
|
1581
1582
|
/** Page dimensions in pixels, if available. */
|
|
1582
|
-
readonly dimensions?: PageDimensions
|
|
1583
|
+
readonly dimensions?: PageDimensions
|
|
1583
1584
|
}
|
|
1584
1585
|
|
|
1585
1586
|
/** An OCR request. */
|
|
1586
1587
|
export interface OcrRequest {
|
|
1587
1588
|
/** The model/provider to use (e.g. `"mistral/mistral-ocr-latest"`). */
|
|
1588
|
-
readonly model?: string
|
|
1589
|
+
readonly model?: string
|
|
1589
1590
|
/** The document to process (URL or base64). */
|
|
1590
|
-
readonly document?: OcrDocument
|
|
1591
|
+
readonly document?: OcrDocument
|
|
1591
1592
|
/** Specific pages to process (1-indexed). `None` means all pages. */
|
|
1592
|
-
readonly pages?: Array<number
|
|
1593
|
+
readonly pages?: Array<number>
|
|
1593
1594
|
/** Whether to include base64-encoded images of each processed page. */
|
|
1594
|
-
readonly includeImageBase64?: boolean
|
|
1595
|
+
readonly includeImageBase64?: boolean
|
|
1595
1596
|
}
|
|
1596
1597
|
|
|
1597
1598
|
/** An OCR response. */
|
|
1598
1599
|
export interface OcrResponse {
|
|
1599
1600
|
/** Extracted pages in order. */
|
|
1600
|
-
readonly pages: Array<OcrPage
|
|
1601
|
+
readonly pages: Array<OcrPage>
|
|
1601
1602
|
/** Model/provider used for OCR. */
|
|
1602
|
-
readonly model: string
|
|
1603
|
+
readonly model: string
|
|
1603
1604
|
/** Token usage, if reported by the provider. */
|
|
1604
|
-
readonly usage?: Usage
|
|
1605
|
+
readonly usage?: Usage
|
|
1605
1606
|
}
|
|
1606
1607
|
|
|
1607
1608
|
/** Page dimensions in pixels. */
|
|
1608
1609
|
export interface PageDimensions {
|
|
1609
1610
|
/** Width in pixels. */
|
|
1610
|
-
readonly width: number
|
|
1611
|
+
readonly width: number
|
|
1611
1612
|
/** Height in pixels. */
|
|
1612
|
-
readonly height: number
|
|
1613
|
+
readonly height: number
|
|
1613
1614
|
}
|
|
1614
1615
|
|
|
1615
1616
|
/**
|
|
@@ -1622,9 +1623,9 @@ export interface PageDimensions {
|
|
|
1622
1623
|
*/
|
|
1623
1624
|
export interface PromptTokensDetails {
|
|
1624
1625
|
/** Cached tokens present in the prompt. Defaults to 0 when absent. */
|
|
1625
|
-
readonly cachedTokens?: number
|
|
1626
|
+
readonly cachedTokens?: number
|
|
1626
1627
|
/** Audio input tokens present in the prompt. Defaults to 0 when absent. */
|
|
1627
|
-
readonly audioTokens?: number
|
|
1628
|
+
readonly audioTokens?: number
|
|
1628
1629
|
}
|
|
1629
1630
|
|
|
1630
1631
|
/**
|
|
@@ -1642,19 +1643,19 @@ export interface PromptTokensDetails {
|
|
|
1642
1643
|
*/
|
|
1643
1644
|
export interface ProviderCapabilities {
|
|
1644
1645
|
/** The provider accepts image input in chat messages. */
|
|
1645
|
-
readonly vision?: boolean
|
|
1646
|
+
readonly vision?: boolean
|
|
1646
1647
|
/** The provider supports extended-thinking / reasoning tokens. */
|
|
1647
|
-
readonly reasoning?: boolean
|
|
1648
|
+
readonly reasoning?: boolean
|
|
1648
1649
|
/** The provider supports JSON-mode or `response_format` structured output. */
|
|
1649
|
-
readonly structuredOutput?: boolean
|
|
1650
|
+
readonly structuredOutput?: boolean
|
|
1650
1651
|
/** The provider supports tool / function calling. */
|
|
1651
|
-
readonly functionCalling?: boolean
|
|
1652
|
+
readonly functionCalling?: boolean
|
|
1652
1653
|
/** The provider accepts audio as input. */
|
|
1653
|
-
readonly audioIn?: boolean
|
|
1654
|
+
readonly audioIn?: boolean
|
|
1654
1655
|
/** The provider can generate audio / TTS output. */
|
|
1655
|
-
readonly audioOut?: boolean
|
|
1656
|
+
readonly audioOut?: boolean
|
|
1656
1657
|
/** The provider accepts video as input. */
|
|
1657
|
-
readonly videoIn?: boolean
|
|
1658
|
+
readonly videoIn?: boolean
|
|
1658
1659
|
}
|
|
1659
1660
|
|
|
1660
1661
|
/**
|
|
@@ -1665,17 +1666,17 @@ export interface ProviderCapabilities {
|
|
|
1665
1666
|
*/
|
|
1666
1667
|
export interface ProviderConfig {
|
|
1667
1668
|
/** Provider identifier (matches the entry key in providers.json). */
|
|
1668
|
-
readonly name: string
|
|
1669
|
+
readonly name: string
|
|
1669
1670
|
/** Human-readable provider name shown in UIs. */
|
|
1670
|
-
readonly displayName?: string
|
|
1671
|
+
readonly displayName?: string
|
|
1671
1672
|
/** Base URL used as the default for this provider's HTTP client. */
|
|
1672
|
-
readonly baseUrl?: string
|
|
1673
|
+
readonly baseUrl?: string
|
|
1673
1674
|
/** Authentication scheme metadata (auth type + env var holding the key). */
|
|
1674
|
-
readonly auth?: AuthConfig
|
|
1675
|
+
readonly auth?: AuthConfig
|
|
1675
1676
|
/** Supported endpoint kinds (e.g. `chat`, `embeddings`). */
|
|
1676
|
-
readonly endpoints?: Array<string
|
|
1677
|
+
readonly endpoints?: Array<string>
|
|
1677
1678
|
/** Model-name prefixes claimed by this provider (e.g. `["gpt-", "o1-"]`). */
|
|
1678
|
-
readonly modelPrefixes?: Array<string
|
|
1679
|
+
readonly modelPrefixes?: Array<string>
|
|
1679
1680
|
/**
|
|
1680
1681
|
* Parameter key renaming for this provider.
|
|
1681
1682
|
*
|
|
@@ -1683,17 +1684,17 @@ export interface ProviderConfig {
|
|
|
1683
1684
|
* to the name this provider expects (e.g. `"max_tokens"`). Applied
|
|
1684
1685
|
* automatically by `ConfigDrivenProvider.transform_request`.
|
|
1685
1686
|
*/
|
|
1686
|
-
readonly paramMappings?: Record<string, string
|
|
1687
|
+
readonly paramMappings?: Record<string, string>
|
|
1687
1688
|
}
|
|
1688
1689
|
|
|
1689
1690
|
/** Configuration for per-model rate limits. */
|
|
1690
1691
|
export interface RateLimitConfig {
|
|
1691
1692
|
/** Maximum requests per window. `None` means unlimited. */
|
|
1692
|
-
readonly rpm?: number
|
|
1693
|
+
readonly rpm?: number
|
|
1693
1694
|
/** Maximum tokens per window. `None` means unlimited. */
|
|
1694
|
-
readonly tpm?: number
|
|
1695
|
+
readonly tpm?: number
|
|
1695
1696
|
/** Fixed window duration (defaults to 60 s). */
|
|
1696
|
-
readonly window?: number
|
|
1697
|
+
readonly window?: number
|
|
1697
1698
|
}
|
|
1698
1699
|
|
|
1699
1700
|
/** Controls how much reasoning effort the model should use. */
|
|
@@ -1726,46 +1727,48 @@ export declare enum RefreshOutcome {
|
|
|
1726
1727
|
}
|
|
1727
1728
|
|
|
1728
1729
|
/** A document to be reranked — either a plain string or an object with a text field. */
|
|
1729
|
-
export type RerankDocument =
|
|
1730
|
+
export type RerankDocument =
|
|
1731
|
+
| string
|
|
1732
|
+
| { text: string }
|
|
1730
1733
|
|
|
1731
1734
|
/** Request to rerank documents by relevance to a query. */
|
|
1732
1735
|
export interface RerankRequest {
|
|
1733
1736
|
/** Model ID (e.g., `"cohere/rerank-english-v3.0"`). */
|
|
1734
|
-
readonly model?: string
|
|
1737
|
+
readonly model?: string
|
|
1735
1738
|
/** The search query. */
|
|
1736
|
-
readonly query?: string
|
|
1739
|
+
readonly query?: string
|
|
1737
1740
|
/** Documents to rerank. */
|
|
1738
|
-
readonly documents?: Array<RerankDocument
|
|
1741
|
+
readonly documents?: Array<RerankDocument>
|
|
1739
1742
|
/** Return only the top N results. Optional. */
|
|
1740
|
-
readonly topN?: number
|
|
1743
|
+
readonly topN?: number
|
|
1741
1744
|
/** Include the document content in results. Defaults to false. */
|
|
1742
|
-
readonly returnDocuments?: boolean
|
|
1745
|
+
readonly returnDocuments?: boolean
|
|
1743
1746
|
}
|
|
1744
1747
|
|
|
1745
1748
|
/** Response from the rerank endpoint. */
|
|
1746
1749
|
export interface RerankResponse {
|
|
1747
1750
|
/** Unique identifier for this rerank request. */
|
|
1748
|
-
readonly id?: string
|
|
1751
|
+
readonly id?: string
|
|
1749
1752
|
/** Reranked documents in order of relevance. */
|
|
1750
|
-
readonly results: Array<RerankResult
|
|
1753
|
+
readonly results: Array<RerankResult>
|
|
1751
1754
|
/** Optional metadata about the reranking operation. */
|
|
1752
|
-
readonly meta?: JsonValue
|
|
1755
|
+
readonly meta?: JsonValue
|
|
1753
1756
|
}
|
|
1754
1757
|
|
|
1755
1758
|
/** A single reranked document with its relevance score. */
|
|
1756
1759
|
export interface RerankResult {
|
|
1757
1760
|
/** Original document index in the input list. */
|
|
1758
|
-
readonly index: number
|
|
1761
|
+
readonly index: number
|
|
1759
1762
|
/** Relevance score in `[0, 1]`. Higher indicates more relevant. */
|
|
1760
|
-
readonly relevanceScore: number
|
|
1763
|
+
readonly relevanceScore: number
|
|
1761
1764
|
/** Original document content (if `return_documents` was true). */
|
|
1762
|
-
readonly document?: RerankResultDocument
|
|
1765
|
+
readonly document?: RerankResultDocument
|
|
1763
1766
|
}
|
|
1764
1767
|
|
|
1765
1768
|
/** The text content of a reranked document, returned when `return_documents` is true. */
|
|
1766
1769
|
export interface RerankResultDocument {
|
|
1767
1770
|
/** Document text. */
|
|
1768
|
-
readonly text: string
|
|
1771
|
+
readonly text: string
|
|
1769
1772
|
}
|
|
1770
1773
|
|
|
1771
1774
|
/**
|
|
@@ -1787,88 +1790,88 @@ export interface RerankResultDocument {
|
|
|
1787
1790
|
* returned JSON if the schema is load-bearing.
|
|
1788
1791
|
*/
|
|
1789
1792
|
export type ResponseFormat =
|
|
1790
|
-
| { type:
|
|
1791
|
-
| { type:
|
|
1792
|
-
| { type:
|
|
1793
|
+
| { type: 'text' }
|
|
1794
|
+
| { type: 'json_object' }
|
|
1795
|
+
| { type: 'json_schema'; jsonSchema: JsonSchemaFormat }
|
|
1793
1796
|
|
|
1794
1797
|
/** Response from a structured response request. */
|
|
1795
1798
|
export interface ResponseObject {
|
|
1796
1799
|
/** Unique response ID. */
|
|
1797
|
-
readonly id?: string
|
|
1800
|
+
readonly id?: string
|
|
1798
1801
|
/** Object type (e.g., `"response"`). */
|
|
1799
|
-
readonly object?: string
|
|
1802
|
+
readonly object?: string
|
|
1800
1803
|
/** Unix timestamp of response creation. */
|
|
1801
|
-
readonly createdAt?: number
|
|
1804
|
+
readonly createdAt?: number
|
|
1802
1805
|
/** Model used to generate the response. */
|
|
1803
|
-
readonly model?: string
|
|
1806
|
+
readonly model?: string
|
|
1804
1807
|
/** Status (e.g., `"succeeded"`, `"failed"`). */
|
|
1805
|
-
readonly status?: string
|
|
1808
|
+
readonly status?: string
|
|
1806
1809
|
/** Output items from the response. */
|
|
1807
|
-
readonly output?: Array<ResponseOutputItem
|
|
1810
|
+
readonly output?: Array<ResponseOutputItem>
|
|
1808
1811
|
/** Token usage. */
|
|
1809
|
-
readonly usage?: ResponseUsage
|
|
1812
|
+
readonly usage?: ResponseUsage
|
|
1810
1813
|
/** Error details (if status is "failed"). */
|
|
1811
|
-
readonly error?: JsonValue
|
|
1814
|
+
readonly error?: JsonValue
|
|
1812
1815
|
}
|
|
1813
1816
|
|
|
1814
1817
|
/** A single output item from the response. */
|
|
1815
1818
|
export interface ResponseOutputItem {
|
|
1816
1819
|
/** Output type (e.g., `"text"`, `"object"`, `"error"`). */
|
|
1817
|
-
readonly itemType?: string
|
|
1820
|
+
readonly itemType?: string
|
|
1818
1821
|
/** Output content (flattened into the object). */
|
|
1819
|
-
readonly content?: JsonValue
|
|
1822
|
+
readonly content?: JsonValue
|
|
1820
1823
|
}
|
|
1821
1824
|
|
|
1822
1825
|
/** A tool available for the response request. */
|
|
1823
1826
|
export interface ResponseTool {
|
|
1824
1827
|
/** Tool type (e.g., "extractor", "search"). */
|
|
1825
|
-
readonly toolType?: string
|
|
1828
|
+
readonly toolType?: string
|
|
1826
1829
|
/** Tool configuration (flattened into the object). */
|
|
1827
|
-
readonly config?: JsonValue
|
|
1830
|
+
readonly config?: JsonValue
|
|
1828
1831
|
}
|
|
1829
1832
|
|
|
1830
1833
|
/** Token usage for a response. */
|
|
1831
1834
|
export interface ResponseUsage {
|
|
1832
1835
|
/** Input tokens used. */
|
|
1833
|
-
readonly inputTokens?: number
|
|
1836
|
+
readonly inputTokens?: number
|
|
1834
1837
|
/** Output tokens used. */
|
|
1835
|
-
readonly outputTokens?: number
|
|
1838
|
+
readonly outputTokens?: number
|
|
1836
1839
|
/** Total tokens used. */
|
|
1837
|
-
readonly totalTokens?: number
|
|
1840
|
+
readonly totalTokens?: number
|
|
1838
1841
|
}
|
|
1839
1842
|
|
|
1840
1843
|
/** A search request. */
|
|
1841
1844
|
export interface SearchRequest {
|
|
1842
1845
|
/** The model/provider to use (e.g. `"brave/web-search"`, `"tavily/search"`). */
|
|
1843
|
-
readonly model?: string
|
|
1846
|
+
readonly model?: string
|
|
1844
1847
|
/** The search query string. */
|
|
1845
|
-
readonly query?: string
|
|
1848
|
+
readonly query?: string
|
|
1846
1849
|
/** Maximum number of results to return. */
|
|
1847
|
-
readonly maxResults?: number
|
|
1850
|
+
readonly maxResults?: number
|
|
1848
1851
|
/** Domain filter — restrict results to specific domains. */
|
|
1849
|
-
readonly searchDomainFilter?: Array<string
|
|
1852
|
+
readonly searchDomainFilter?: Array<string>
|
|
1850
1853
|
/** Country code for localized results (ISO 3166-1 alpha-2, e.g., `"US"`, `"FR"`). */
|
|
1851
|
-
readonly country?: string
|
|
1854
|
+
readonly country?: string
|
|
1852
1855
|
}
|
|
1853
1856
|
|
|
1854
1857
|
/** A search response. */
|
|
1855
1858
|
export interface SearchResponse {
|
|
1856
1859
|
/** List of search results. */
|
|
1857
|
-
readonly results: Array<SearchResult
|
|
1860
|
+
readonly results: Array<SearchResult>
|
|
1858
1861
|
/** Model/provider that performed the search. */
|
|
1859
|
-
readonly model: string
|
|
1862
|
+
readonly model: string
|
|
1860
1863
|
}
|
|
1861
1864
|
|
|
1862
1865
|
/** An individual search result. */
|
|
1863
1866
|
export interface SearchResult {
|
|
1864
1867
|
/** Result title. */
|
|
1865
|
-
readonly title: string
|
|
1868
|
+
readonly title: string
|
|
1866
1869
|
/** Result URL. */
|
|
1867
|
-
readonly url: string
|
|
1870
|
+
readonly url: string
|
|
1868
1871
|
/** Text snippet or excerpt from the page. */
|
|
1869
|
-
readonly snippet: string
|
|
1872
|
+
readonly snippet: string
|
|
1870
1873
|
/** Publication or last-updated date, if available. */
|
|
1871
|
-
readonly date?: string
|
|
1874
|
+
readonly date?: string
|
|
1872
1875
|
}
|
|
1873
1876
|
|
|
1874
1877
|
/**
|
|
@@ -1877,49 +1880,52 @@ export interface SearchResult {
|
|
|
1877
1880
|
* The error value is shared so every follower receives the same upstream
|
|
1878
1881
|
* failure without cloning the underlying error.
|
|
1879
1882
|
*/
|
|
1880
|
-
export declare class SingleflightResult {
|
|
1883
|
+
export declare class SingleflightResult {
|
|
1884
|
+
}
|
|
1881
1885
|
|
|
1882
1886
|
/** Name of the specific function to invoke. */
|
|
1883
1887
|
export interface SpecificFunction {
|
|
1884
1888
|
/** Function name. */
|
|
1885
|
-
readonly name?: string
|
|
1889
|
+
readonly name?: string
|
|
1886
1890
|
}
|
|
1887
1891
|
|
|
1888
1892
|
/** Directive to call a specific tool. */
|
|
1889
1893
|
export interface SpecificToolChoice {
|
|
1890
1894
|
/** Tool type (always "function"). */
|
|
1891
|
-
readonly choiceType?: ToolType
|
|
1895
|
+
readonly choiceType?: ToolType
|
|
1892
1896
|
/** The specific function to invoke. */
|
|
1893
|
-
readonly function?: SpecificFunction
|
|
1897
|
+
readonly function?: SpecificFunction
|
|
1894
1898
|
}
|
|
1895
1899
|
|
|
1896
1900
|
/** Stop sequence(s) that cause the model to stop generating. */
|
|
1897
|
-
export type StopSequence =
|
|
1901
|
+
export type StopSequence =
|
|
1902
|
+
| string
|
|
1903
|
+
| Array<string>
|
|
1898
1904
|
|
|
1899
1905
|
/** A streaming choice with incremental delta. */
|
|
1900
1906
|
export interface StreamChoice {
|
|
1901
1907
|
/** Index of this choice in the choices array. */
|
|
1902
|
-
readonly index?: number
|
|
1908
|
+
readonly index?: number
|
|
1903
1909
|
/** Incremental update to the message (content, tool calls, etc.). */
|
|
1904
|
-
readonly delta?: StreamDelta
|
|
1910
|
+
readonly delta?: StreamDelta
|
|
1905
1911
|
/** Why the stream ended (present only in final chunk). */
|
|
1906
|
-
readonly finishReason?: FinishReason
|
|
1912
|
+
readonly finishReason?: FinishReason
|
|
1907
1913
|
}
|
|
1908
1914
|
|
|
1909
1915
|
/** Incremental delta in a stream chunk. */
|
|
1910
1916
|
export interface StreamDelta {
|
|
1911
1917
|
/** Role (typically present only in the first chunk). */
|
|
1912
|
-
readonly role?: string
|
|
1918
|
+
readonly role?: string
|
|
1913
1919
|
/** Partial content chunk (e.g., a few words of the response). */
|
|
1914
|
-
readonly content?: string
|
|
1920
|
+
readonly content?: string
|
|
1915
1921
|
/** Partial tool calls being streamed. */
|
|
1916
|
-
readonly toolCalls?: Array<StreamToolCall
|
|
1922
|
+
readonly toolCalls?: Array<StreamToolCall>
|
|
1917
1923
|
/** Deprecated legacy function_call delta; retained for API compatibility. */
|
|
1918
|
-
readonly functionCall?: StreamFunctionCall
|
|
1924
|
+
readonly functionCall?: StreamFunctionCall
|
|
1919
1925
|
/** Partial refusal message. */
|
|
1920
|
-
readonly refusal?: string
|
|
1926
|
+
readonly refusal?: string
|
|
1921
1927
|
/** Partial reasoning/thinking tokens (OpenAI-compatible extension used by DeepSeek R1, Qwen, etc.). */
|
|
1922
|
-
readonly reasoningContent?: string
|
|
1928
|
+
readonly reasoningContent?: string
|
|
1923
1929
|
}
|
|
1924
1930
|
|
|
1925
1931
|
/**
|
|
@@ -1940,27 +1946,27 @@ export declare enum StreamFormat {
|
|
|
1940
1946
|
/** Partial function call details in a stream. */
|
|
1941
1947
|
export interface StreamFunctionCall {
|
|
1942
1948
|
/** Function name (typically in the first chunk). */
|
|
1943
|
-
readonly name?: string
|
|
1949
|
+
readonly name?: string
|
|
1944
1950
|
/** Partial JSON arguments chunk. */
|
|
1945
|
-
readonly arguments?: string
|
|
1951
|
+
readonly arguments?: string
|
|
1946
1952
|
}
|
|
1947
1953
|
|
|
1948
1954
|
/** Options for streaming responses. */
|
|
1949
1955
|
export interface StreamOptions {
|
|
1950
1956
|
/** If true, include token usage in the final stream chunk. */
|
|
1951
|
-
readonly includeUsage?: boolean
|
|
1957
|
+
readonly includeUsage?: boolean
|
|
1952
1958
|
}
|
|
1953
1959
|
|
|
1954
1960
|
/** A streaming tool call being built incrementally. */
|
|
1955
1961
|
export interface StreamToolCall {
|
|
1956
1962
|
/** Index of this tool call in the tool_calls array. */
|
|
1957
|
-
readonly index?: number
|
|
1963
|
+
readonly index?: number
|
|
1958
1964
|
/** Tool call ID (typically in the first chunk for this call). */
|
|
1959
|
-
readonly id?: string
|
|
1965
|
+
readonly id?: string
|
|
1960
1966
|
/** Tool type (typically "function"). */
|
|
1961
|
-
readonly callType?: ToolType
|
|
1967
|
+
readonly callType?: ToolType
|
|
1962
1968
|
/** Partial function name and arguments. */
|
|
1963
|
-
readonly function?: StreamFunctionCall
|
|
1969
|
+
readonly function?: StreamFunctionCall
|
|
1964
1970
|
}
|
|
1965
1971
|
|
|
1966
1972
|
/** System message guiding model behavior for the entire conversation. */
|
|
@@ -1971,23 +1977,25 @@ export interface SystemMessage {
|
|
|
1971
1977
|
* Accepts either a plain text string or an array of content parts,
|
|
1972
1978
|
* mirroring `UserContent` so that `Message.system_with_parts` works.
|
|
1973
1979
|
*/
|
|
1974
|
-
readonly content?: UserContent
|
|
1980
|
+
readonly content?: UserContent
|
|
1975
1981
|
/** Optional name for the system message source. */
|
|
1976
|
-
readonly name?: string
|
|
1982
|
+
readonly name?: string
|
|
1977
1983
|
}
|
|
1978
1984
|
|
|
1979
1985
|
/** A tool call the model wants to execute. */
|
|
1980
1986
|
export interface ToolCall {
|
|
1981
1987
|
/** Unique ID for this call, used to reference in tool result messages. */
|
|
1982
|
-
readonly id: string
|
|
1988
|
+
readonly id: string
|
|
1983
1989
|
/** Tool type (always "function"). */
|
|
1984
|
-
readonly callType: ToolType
|
|
1990
|
+
readonly callType: ToolType
|
|
1985
1991
|
/** Function name and arguments. */
|
|
1986
|
-
readonly function: FunctionCall
|
|
1992
|
+
readonly function: FunctionCall
|
|
1987
1993
|
}
|
|
1988
1994
|
|
|
1989
1995
|
/** Tool usage mode or a specific tool to call. */
|
|
1990
|
-
export type ToolChoice =
|
|
1996
|
+
export type ToolChoice =
|
|
1997
|
+
| __AlefWireToolChoiceMode
|
|
1998
|
+
| __AlefWireSpecificToolChoice
|
|
1991
1999
|
|
|
1992
2000
|
/** Tool choice mode. */
|
|
1993
2001
|
export declare enum ToolChoiceMode {
|
|
@@ -2009,11 +2017,11 @@ export interface ToolMessage {
|
|
|
2009
2017
|
* deserialises into `Text`, so tool results persisted before this field
|
|
2010
2018
|
* carried structured content continue to round-trip.
|
|
2011
2019
|
*/
|
|
2012
|
-
readonly content?: UserContent
|
|
2020
|
+
readonly content?: UserContent
|
|
2013
2021
|
/** ID of the tool call this result responds to. */
|
|
2014
|
-
readonly toolCallId?: string
|
|
2022
|
+
readonly toolCallId?: string
|
|
2015
2023
|
/** Optional tool/function name. */
|
|
2016
|
-
readonly name?: string
|
|
2024
|
+
readonly name?: string
|
|
2017
2025
|
}
|
|
2018
2026
|
|
|
2019
2027
|
/**
|
|
@@ -2030,52 +2038,54 @@ export declare enum ToolType {
|
|
|
2030
2038
|
/** Response from a transcription request. */
|
|
2031
2039
|
export interface TranscriptionResponse {
|
|
2032
2040
|
/** The transcribed text. */
|
|
2033
|
-
readonly text?: string
|
|
2041
|
+
readonly text?: string
|
|
2034
2042
|
/** Detected language (ISO-639-1 code). */
|
|
2035
|
-
readonly language?: string
|
|
2043
|
+
readonly language?: string
|
|
2036
2044
|
/** Total audio duration in seconds. */
|
|
2037
|
-
readonly duration?: number
|
|
2045
|
+
readonly duration?: number
|
|
2038
2046
|
/** Detailed segment-level transcription (if response_format is "verbose_json"). */
|
|
2039
|
-
readonly segments?: Array<TranscriptionSegment
|
|
2047
|
+
readonly segments?: Array<TranscriptionSegment>
|
|
2040
2048
|
}
|
|
2041
2049
|
|
|
2042
2050
|
/** A segment of transcribed audio with timing information. */
|
|
2043
2051
|
export interface TranscriptionSegment {
|
|
2044
2052
|
/** Segment index (0-based). */
|
|
2045
|
-
readonly id?: number
|
|
2053
|
+
readonly id?: number
|
|
2046
2054
|
/** Start time in seconds. */
|
|
2047
|
-
readonly start?: number
|
|
2055
|
+
readonly start?: number
|
|
2048
2056
|
/** End time in seconds. */
|
|
2049
|
-
readonly end?: number
|
|
2057
|
+
readonly end?: number
|
|
2050
2058
|
/** Transcribed text for this segment. */
|
|
2051
|
-
readonly text?: string
|
|
2059
|
+
readonly text?: string
|
|
2052
2060
|
}
|
|
2053
2061
|
|
|
2054
2062
|
/** Token-usage accounting returned by the provider on each completion / embedding call. */
|
|
2055
2063
|
export interface Usage {
|
|
2056
2064
|
/** Prompt tokens used. Defaults to 0 when absent (some providers omit this). */
|
|
2057
|
-
readonly promptTokens?: number
|
|
2065
|
+
readonly promptTokens?: number
|
|
2058
2066
|
/** Completion tokens used. Defaults to 0 when absent (e.g. embedding responses). */
|
|
2059
|
-
readonly completionTokens?: number
|
|
2067
|
+
readonly completionTokens?: number
|
|
2060
2068
|
/** Total tokens used. Defaults to 0 when absent (some providers omit this). */
|
|
2061
|
-
readonly totalTokens?: number
|
|
2069
|
+
readonly totalTokens?: number
|
|
2062
2070
|
/**
|
|
2063
2071
|
* Breakdown of tokens used in the prompt, including cached tokens served
|
|
2064
2072
|
* at the provider's discounted cache-read rate. Absent when the provider
|
|
2065
2073
|
* does not return prompt-token details.
|
|
2066
2074
|
*/
|
|
2067
|
-
readonly promptTokensDetails?: PromptTokensDetails
|
|
2075
|
+
readonly promptTokensDetails?: PromptTokensDetails
|
|
2068
2076
|
}
|
|
2069
2077
|
|
|
2070
2078
|
/** User message content as either plain text or a list of multimodal parts. */
|
|
2071
|
-
export type UserContent =
|
|
2079
|
+
export type UserContent =
|
|
2080
|
+
| string
|
|
2081
|
+
| Array<__AlefWireContentPart>
|
|
2072
2082
|
|
|
2073
2083
|
/** User message in the conversation. */
|
|
2074
2084
|
export interface UserMessage {
|
|
2075
2085
|
/** Message content as plain text or array of content parts (text, images, documents, audio). */
|
|
2076
|
-
readonly content?: UserContent
|
|
2086
|
+
readonly content?: UserContent
|
|
2077
2087
|
/** Optional name for the user. */
|
|
2078
|
-
readonly name?: string
|
|
2088
|
+
readonly name?: string
|
|
2079
2089
|
}
|
|
2080
2090
|
|
|
2081
2091
|
/**
|
|
@@ -2086,13 +2096,13 @@ export interface UserMessage {
|
|
|
2086
2096
|
*/
|
|
2087
2097
|
export interface WaitForBatchConfig {
|
|
2088
2098
|
/** Initial interval between polls, in seconds. */
|
|
2089
|
-
readonly initialIntervalSecs?: number
|
|
2099
|
+
readonly initialIntervalSecs?: number
|
|
2090
2100
|
/** Maximum interval between polls (backoff plateau), in seconds. */
|
|
2091
|
-
readonly maxIntervalSecs?: number
|
|
2101
|
+
readonly maxIntervalSecs?: number
|
|
2092
2102
|
/** Exponential backoff multiplier (e.g., 1.5 increases delay by 50% each poll). */
|
|
2093
|
-
readonly backoffMultiplier?: number
|
|
2103
|
+
readonly backoffMultiplier?: number
|
|
2094
2104
|
/** Optional timeout in seconds — polling fails if this duration is exceeded. */
|
|
2095
|
-
readonly timeoutSecs?: number
|
|
2105
|
+
readonly timeoutSecs?: number
|
|
2096
2106
|
}
|
|
2097
2107
|
|
|
2098
2108
|
/**
|
|
@@ -2161,32 +2171,21 @@ export declare function registerCustomProvider(config: CustomProviderConfig): vo
|
|
|
2161
2171
|
* @throws Returns an error if the custom-provider registry cannot be updated.
|
|
2162
2172
|
*/
|
|
2163
2173
|
export declare function unregisterCustomProvider(name: string): boolean;
|
|
2164
|
-
export type __AlefWireAssistantPart =
|
|
2165
|
-
|
|
2166
|
-
| ({ type: "refusal" } & { refusal: string })
|
|
2167
|
-
| ({ type: "output_image" } & { image_url: ImageUrl })
|
|
2168
|
-
| ({ type: "output_audio" } & { audio: AudioContent });
|
|
2169
|
-
export type __AlefWireEmbeddingContentPart =
|
|
2170
|
-
| ({ type: "text" } & { text: string })
|
|
2171
|
-
| ({ type: "image_url" } & { image_url: ImageUrl })
|
|
2172
|
-
| ({ type: "image_base64" } & { image_base64: string });
|
|
2174
|
+
export type __AlefWireAssistantPart = ({ type: "text" } & { text: string }) | ({ type: "refusal" } & { refusal: string }) | ({ type: "output_image" } & { image_url: ImageUrl }) | ({ type: "output_audio" } & { audio: AudioContent });
|
|
2175
|
+
export type __AlefWireEmbeddingContentPart = ({ type: "text" } & { text: string }) | ({ type: "image_url" } & { image_url: ImageUrl }) | ({ type: "image_base64" } & { image_base64: string });
|
|
2173
2176
|
export type __AlefWireToolChoiceMode = "auto" | "required" | "none";
|
|
2174
2177
|
export type __AlefWireToolType = "function";
|
|
2175
|
-
export type __AlefWireSpecificToolChoice = { type: __AlefWireToolType; function: SpecificFunction };
|
|
2176
|
-
export type __AlefWireContentPart =
|
|
2177
|
-
| ({ type: "text" } & { text: string })
|
|
2178
|
-
| ({ type: "image_url" } & { image_url: ImageUrl })
|
|
2179
|
-
| ({ type: "document" } & { document: DocumentContent })
|
|
2180
|
-
| ({ type: "input_audio" } & { input_audio: AudioContent });
|
|
2178
|
+
export type __AlefWireSpecificToolChoice = { type: __AlefWireToolType; "function": SpecificFunction };
|
|
2179
|
+
export type __AlefWireContentPart = ({ type: "text" } & { text: string }) | ({ type: "image_url" } & { image_url: ImageUrl }) | ({ type: "document" } & { document: DocumentContent }) | ({ type: "input_audio" } & { input_audio: AudioContent });
|
|
2181
2180
|
|
|
2182
2181
|
export declare class ChatStreamIterator {
|
|
2183
|
-
next(value?: undefined): Promise<IteratorResult<ChatCompletionChunk, void
|
|
2184
|
-
[Symbol.asyncIterator](): AsyncGenerator<ChatCompletionChunk, void, undefined
|
|
2182
|
+
next(value?: undefined): Promise<IteratorResult<ChatCompletionChunk, void>>
|
|
2183
|
+
[Symbol.asyncIterator](): AsyncGenerator<ChatCompletionChunk, void, undefined>
|
|
2185
2184
|
}
|
|
2186
2185
|
|
|
2187
2186
|
export declare class LiterLlmErrorInfo {
|
|
2188
|
-
code(): number
|
|
2189
|
-
statusCode(): number
|
|
2190
|
-
isTransient(): boolean
|
|
2191
|
-
errorType(): string
|
|
2187
|
+
code(): number
|
|
2188
|
+
statusCode(): number
|
|
2189
|
+
isTransient(): boolean
|
|
2190
|
+
errorType(): string
|
|
2192
2191
|
}
|