@cloudflare/workers-types 4.20260317.1 → 4.20260331.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2021-11-03/index.d.ts +1018 -180
- package/2021-11-03/index.ts +1020 -180
- package/2022-01-31/index.d.ts +1018 -180
- package/2022-01-31/index.ts +1020 -180
- package/2022-03-21/index.d.ts +1018 -180
- package/2022-03-21/index.ts +1020 -180
- package/2022-08-04/index.d.ts +1018 -180
- package/2022-08-04/index.ts +1020 -180
- package/2022-10-31/index.d.ts +1018 -180
- package/2022-10-31/index.ts +1020 -180
- package/2022-11-30/index.d.ts +1018 -180
- package/2022-11-30/index.ts +1020 -180
- package/2023-03-01/index.d.ts +1018 -180
- package/2023-03-01/index.ts +1020 -180
- package/2023-07-01/index.d.ts +1018 -180
- package/2023-07-01/index.ts +1020 -180
- package/experimental/index.d.ts +1089 -181
- package/experimental/index.ts +1091 -181
- package/index.d.ts +1018 -180
- package/index.ts +1020 -180
- package/latest/index.d.ts +1018 -180
- package/latest/index.ts +1020 -180
- package/oldest/index.d.ts +1018 -180
- package/oldest/index.ts +1020 -180
- package/package.json +1 -1
package/experimental/index.ts
CHANGED
|
@@ -513,6 +513,11 @@ export type ExportedHandlerFetchHandler<
|
|
|
513
513
|
env: Env,
|
|
514
514
|
ctx: ExecutionContext<Props>,
|
|
515
515
|
) => Response | Promise<Response>;
|
|
516
|
+
export type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
|
|
517
|
+
socket: Socket,
|
|
518
|
+
env: Env,
|
|
519
|
+
ctx: ExecutionContext<Props>,
|
|
520
|
+
) => void | Promise<void>;
|
|
516
521
|
export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
|
|
517
522
|
events: TraceItem[],
|
|
518
523
|
env: Env,
|
|
@@ -554,6 +559,7 @@ export interface ExportedHandler<
|
|
|
554
559
|
Props = unknown,
|
|
555
560
|
> {
|
|
556
561
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
|
|
562
|
+
connect?: ExportedHandlerConnectHandler<Env, Props>;
|
|
557
563
|
tail?: ExportedHandlerTailHandler<Env, Props>;
|
|
558
564
|
trace?: ExportedHandlerTraceHandler<Env, Props>;
|
|
559
565
|
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
|
|
@@ -576,6 +582,7 @@ export declare abstract class Navigator {
|
|
|
576
582
|
export interface AlarmInvocationInfo {
|
|
577
583
|
readonly isRetry: boolean;
|
|
578
584
|
readonly retryCount: number;
|
|
585
|
+
readonly scheduledTime: number;
|
|
579
586
|
}
|
|
580
587
|
export interface Cloudflare {
|
|
581
588
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
@@ -585,6 +592,7 @@ export declare abstract class ColoLocalActorNamespace {
|
|
|
585
592
|
}
|
|
586
593
|
export interface DurableObject {
|
|
587
594
|
fetch(request: Request): Response | Promise<Response>;
|
|
595
|
+
connect?(socket: Socket): void | Promise<void>;
|
|
588
596
|
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
589
597
|
webSocketMessage?(
|
|
590
598
|
ws: WebSocket,
|
|
@@ -602,7 +610,7 @@ export type DurableObjectStub<
|
|
|
602
610
|
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
603
611
|
> = Fetcher<
|
|
604
612
|
T,
|
|
605
|
-
"alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
|
|
613
|
+
"alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
|
|
606
614
|
> & {
|
|
607
615
|
readonly id: DurableObjectId;
|
|
608
616
|
readonly name?: string;
|
|
@@ -2209,6 +2217,7 @@ export type Fetcher<
|
|
|
2209
2217
|
queue(
|
|
2210
2218
|
queueName: string,
|
|
2211
2219
|
messages: ServiceBindingQueueMessage[],
|
|
2220
|
+
metadata?: MessageBatchMetadata,
|
|
2212
2221
|
): Promise<FetcherQueueResult>;
|
|
2213
2222
|
scheduled(options?: FetcherScheduledOptions): Promise<FetcherScheduledResult>;
|
|
2214
2223
|
};
|
|
@@ -2393,11 +2402,34 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
2393
2402
|
}
|
|
2394
2403
|
export type QueueContentType = "text" | "bytes" | "json" | "v8";
|
|
2395
2404
|
export interface Queue<Body = unknown> {
|
|
2396
|
-
send(message: Body, options?: QueueSendOptions): Promise<
|
|
2405
|
+
send(message: Body, options?: QueueSendOptions): Promise<QueueSendResponse>;
|
|
2397
2406
|
sendBatch(
|
|
2398
2407
|
messages: Iterable<MessageSendRequest<Body>>,
|
|
2399
2408
|
options?: QueueSendBatchOptions,
|
|
2400
|
-
): Promise<
|
|
2409
|
+
): Promise<QueueSendBatchResponse>;
|
|
2410
|
+
metrics(): Promise<QueueMetrics>;
|
|
2411
|
+
}
|
|
2412
|
+
export interface QueueSendMetrics {
|
|
2413
|
+
backlogCount: number;
|
|
2414
|
+
backlogBytes: number;
|
|
2415
|
+
oldestMessageTimestamp: number;
|
|
2416
|
+
}
|
|
2417
|
+
export interface QueueSendMetadata {
|
|
2418
|
+
metrics: QueueSendMetrics;
|
|
2419
|
+
}
|
|
2420
|
+
export interface QueueSendResponse {
|
|
2421
|
+
metadata: QueueSendMetadata;
|
|
2422
|
+
}
|
|
2423
|
+
export interface QueueSendBatchMetrics {
|
|
2424
|
+
backlogCount: number;
|
|
2425
|
+
backlogBytes: number;
|
|
2426
|
+
oldestMessageTimestamp: number;
|
|
2427
|
+
}
|
|
2428
|
+
export interface QueueSendBatchMetadata {
|
|
2429
|
+
metrics: QueueSendBatchMetrics;
|
|
2430
|
+
}
|
|
2431
|
+
export interface QueueSendBatchResponse {
|
|
2432
|
+
metadata: QueueSendBatchMetadata;
|
|
2401
2433
|
}
|
|
2402
2434
|
export interface QueueSendOptions {
|
|
2403
2435
|
contentType?: QueueContentType;
|
|
@@ -2411,6 +2443,19 @@ export interface MessageSendRequest<Body = unknown> {
|
|
|
2411
2443
|
contentType?: QueueContentType;
|
|
2412
2444
|
delaySeconds?: number;
|
|
2413
2445
|
}
|
|
2446
|
+
export interface QueueMetrics {
|
|
2447
|
+
backlogCount: number;
|
|
2448
|
+
backlogBytes: number;
|
|
2449
|
+
oldestMessageTimestamp: number;
|
|
2450
|
+
}
|
|
2451
|
+
export interface MessageBatchMetrics {
|
|
2452
|
+
backlogCount: number;
|
|
2453
|
+
backlogBytes: number;
|
|
2454
|
+
oldestMessageTimestamp: number;
|
|
2455
|
+
}
|
|
2456
|
+
export interface MessageBatchMetadata {
|
|
2457
|
+
metrics: MessageBatchMetrics;
|
|
2458
|
+
}
|
|
2414
2459
|
export interface QueueRetryBatch {
|
|
2415
2460
|
retry: boolean;
|
|
2416
2461
|
delaySeconds?: number;
|
|
@@ -2433,12 +2478,14 @@ export interface Message<Body = unknown> {
|
|
|
2433
2478
|
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
2434
2479
|
readonly messages: readonly Message<Body>[];
|
|
2435
2480
|
readonly queue: string;
|
|
2481
|
+
readonly metadata: MessageBatchMetadata;
|
|
2436
2482
|
retryAll(options?: QueueRetryOptions): void;
|
|
2437
2483
|
ackAll(): void;
|
|
2438
2484
|
}
|
|
2439
2485
|
export interface MessageBatch<Body = unknown> {
|
|
2440
2486
|
readonly messages: readonly Message<Body>[];
|
|
2441
2487
|
readonly queue: string;
|
|
2488
|
+
readonly metadata: MessageBatchMetadata;
|
|
2442
2489
|
retryAll(options?: QueueRetryOptions): void;
|
|
2443
2490
|
ackAll(): void;
|
|
2444
2491
|
}
|
|
@@ -3225,6 +3272,11 @@ export interface QueuingStrategyInit {
|
|
|
3225
3272
|
*/
|
|
3226
3273
|
highWaterMark: number;
|
|
3227
3274
|
}
|
|
3275
|
+
export interface TracePreviewInfo {
|
|
3276
|
+
id: string;
|
|
3277
|
+
slug: string;
|
|
3278
|
+
name: string;
|
|
3279
|
+
}
|
|
3228
3280
|
export interface ScriptVersion {
|
|
3229
3281
|
id?: string;
|
|
3230
3282
|
tag?: string;
|
|
@@ -3239,6 +3291,7 @@ export interface TraceItem {
|
|
|
3239
3291
|
| (
|
|
3240
3292
|
| TraceItemFetchEventInfo
|
|
3241
3293
|
| TraceItemJsRpcEventInfo
|
|
3294
|
+
| TraceItemConnectEventInfo
|
|
3242
3295
|
| TraceItemScheduledEventInfo
|
|
3243
3296
|
| TraceItemAlarmEventInfo
|
|
3244
3297
|
| TraceItemQueueEventInfo
|
|
@@ -3257,6 +3310,8 @@ export interface TraceItem {
|
|
|
3257
3310
|
readonly scriptVersion?: ScriptVersion;
|
|
3258
3311
|
readonly dispatchNamespace?: string;
|
|
3259
3312
|
readonly scriptTags?: string[];
|
|
3313
|
+
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3314
|
+
readonly preview?: TracePreviewInfo;
|
|
3260
3315
|
readonly durableObjectId?: string;
|
|
3261
3316
|
readonly outcome: string;
|
|
3262
3317
|
readonly executionModel: string;
|
|
@@ -3267,6 +3322,7 @@ export interface TraceItem {
|
|
|
3267
3322
|
export interface TraceItemAlarmEventInfo {
|
|
3268
3323
|
readonly scheduledTime: Date;
|
|
3269
3324
|
}
|
|
3325
|
+
export interface TraceItemConnectEventInfo {}
|
|
3270
3326
|
export interface TraceItemCustomEventInfo {}
|
|
3271
3327
|
export interface TraceItemScheduledEventInfo {
|
|
3272
3328
|
readonly scheduledTime: number;
|
|
@@ -3893,12 +3949,44 @@ export interface Container {
|
|
|
3893
3949
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3894
3950
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3895
3951
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3952
|
+
interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
|
|
3953
|
+
snapshotDirectory(
|
|
3954
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3955
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3956
|
+
snapshotContainer(
|
|
3957
|
+
options: ContainerSnapshotOptions,
|
|
3958
|
+
): Promise<ContainerSnapshot>;
|
|
3959
|
+
}
|
|
3960
|
+
export interface ContainerDirectorySnapshot {
|
|
3961
|
+
id: string;
|
|
3962
|
+
size: number;
|
|
3963
|
+
dir: string;
|
|
3964
|
+
name?: string;
|
|
3965
|
+
}
|
|
3966
|
+
export interface ContainerDirectorySnapshotOptions {
|
|
3967
|
+
dir: string;
|
|
3968
|
+
name?: string;
|
|
3969
|
+
}
|
|
3970
|
+
export interface ContainerDirectorySnapshotRestoreParams {
|
|
3971
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3972
|
+
mountPoint?: string;
|
|
3973
|
+
}
|
|
3974
|
+
export interface ContainerSnapshot {
|
|
3975
|
+
id: string;
|
|
3976
|
+
size: number;
|
|
3977
|
+
name?: string;
|
|
3978
|
+
}
|
|
3979
|
+
export interface ContainerSnapshotOptions {
|
|
3980
|
+
name?: string;
|
|
3896
3981
|
}
|
|
3897
3982
|
export interface ContainerStartupOptions {
|
|
3898
3983
|
entrypoint?: string[];
|
|
3899
3984
|
enableInternet: boolean;
|
|
3900
3985
|
env?: Record<string, string>;
|
|
3901
3986
|
hardTimeout?: number | bigint;
|
|
3987
|
+
labels?: Record<string, string>;
|
|
3988
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3989
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3902
3990
|
}
|
|
3903
3991
|
/**
|
|
3904
3992
|
* The **`FileSystemHandle`** interface of the File System API is an object which represents a file or directory entry.
|
|
@@ -4577,11 +4665,10 @@ export interface EventCounts {
|
|
|
4577
4665
|
): void;
|
|
4578
4666
|
[Symbol.iterator](): IterableIterator<string[]>;
|
|
4579
4667
|
}
|
|
4580
|
-
// AI Search
|
|
4668
|
+
// ============ AI Search Error Interfaces ============
|
|
4581
4669
|
export interface AiSearchInternalError extends Error {}
|
|
4582
4670
|
export interface AiSearchNotFoundError extends Error {}
|
|
4583
|
-
|
|
4584
|
-
// AI Search V2 Request Types
|
|
4671
|
+
// ============ AI Search Request Types ============
|
|
4585
4672
|
export type AiSearchSearchRequest = {
|
|
4586
4673
|
messages: Array<{
|
|
4587
4674
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -4606,9 +4693,8 @@ export type AiSearchSearchRequest = {
|
|
|
4606
4693
|
[key: string]: unknown;
|
|
4607
4694
|
};
|
|
4608
4695
|
reranking?: {
|
|
4609
|
-
/** Enable reranking (default false) */
|
|
4610
4696
|
enabled?: boolean;
|
|
4611
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4697
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
4612
4698
|
/** Match threshold (0-1, default 0.4) */
|
|
4613
4699
|
match_threshold?: number;
|
|
4614
4700
|
[key: string]: unknown;
|
|
@@ -4620,6 +4706,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
4620
4706
|
messages: Array<{
|
|
4621
4707
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4622
4708
|
content: string | null;
|
|
4709
|
+
[key: string]: unknown;
|
|
4623
4710
|
}>;
|
|
4624
4711
|
model?: string;
|
|
4625
4712
|
stream?: boolean;
|
|
@@ -4640,7 +4727,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
4640
4727
|
};
|
|
4641
4728
|
reranking?: {
|
|
4642
4729
|
enabled?: boolean;
|
|
4643
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4730
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
4644
4731
|
match_threshold?: number;
|
|
4645
4732
|
[key: string]: unknown;
|
|
4646
4733
|
};
|
|
@@ -4648,7 +4735,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
4648
4735
|
};
|
|
4649
4736
|
[key: string]: unknown;
|
|
4650
4737
|
};
|
|
4651
|
-
// AI Search
|
|
4738
|
+
// ============ AI Search Response Types ============
|
|
4652
4739
|
export type AiSearchSearchResponse = {
|
|
4653
4740
|
search_query: string;
|
|
4654
4741
|
chunks: Array<{
|
|
@@ -4667,26 +4754,65 @@ export type AiSearchSearchResponse = {
|
|
|
4667
4754
|
keyword_score?: number;
|
|
4668
4755
|
/** Vector similarity score (0-1) */
|
|
4669
4756
|
vector_score?: number;
|
|
4757
|
+
[key: string]: unknown;
|
|
4758
|
+
};
|
|
4759
|
+
}>;
|
|
4760
|
+
};
|
|
4761
|
+
export type AiSearchChatCompletionsResponse = {
|
|
4762
|
+
id?: string;
|
|
4763
|
+
object?: string;
|
|
4764
|
+
model?: string;
|
|
4765
|
+
choices: Array<{
|
|
4766
|
+
index?: number;
|
|
4767
|
+
message: {
|
|
4768
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4769
|
+
content: string | null;
|
|
4770
|
+
[key: string]: unknown;
|
|
4670
4771
|
};
|
|
4772
|
+
[key: string]: unknown;
|
|
4671
4773
|
}>;
|
|
4774
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4775
|
+
[key: string]: unknown;
|
|
4672
4776
|
};
|
|
4673
|
-
export type
|
|
4777
|
+
export type AiSearchStatsResponse = {
|
|
4778
|
+
queued?: number;
|
|
4779
|
+
running?: number;
|
|
4780
|
+
completed?: number;
|
|
4781
|
+
error?: number;
|
|
4782
|
+
skipped?: number;
|
|
4783
|
+
outdated?: number;
|
|
4784
|
+
last_activity?: string;
|
|
4785
|
+
};
|
|
4786
|
+
// ============ AI Search Instance Info Types ============
|
|
4787
|
+
export type AiSearchInstanceInfo = {
|
|
4674
4788
|
id: string;
|
|
4675
|
-
|
|
4676
|
-
account_id?: string;
|
|
4677
|
-
account_tag?: string;
|
|
4678
|
-
/** Whether the instance is enabled (default true) */
|
|
4679
|
-
enable?: boolean;
|
|
4680
|
-
type?: "r2" | "web-crawler";
|
|
4789
|
+
type?: "r2" | "web-crawler" | string;
|
|
4681
4790
|
source?: string;
|
|
4791
|
+
paused?: boolean;
|
|
4792
|
+
status?: string;
|
|
4793
|
+
namespace?: string;
|
|
4794
|
+
created_at?: string;
|
|
4795
|
+
modified_at?: string;
|
|
4682
4796
|
[key: string]: unknown;
|
|
4683
|
-
}
|
|
4797
|
+
};
|
|
4798
|
+
export type AiSearchListResponse = {
|
|
4799
|
+
result: AiSearchInstanceInfo[];
|
|
4800
|
+
result_info?: {
|
|
4801
|
+
count: number;
|
|
4802
|
+
page: number;
|
|
4803
|
+
per_page: number;
|
|
4804
|
+
total_count: number;
|
|
4805
|
+
};
|
|
4806
|
+
};
|
|
4807
|
+
// ============ AI Search Config Types ============
|
|
4684
4808
|
export type AiSearchConfig = {
|
|
4685
4809
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4686
4810
|
id: string;
|
|
4687
|
-
type
|
|
4688
|
-
|
|
4689
|
-
|
|
4811
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4812
|
+
type?: "r2" | "web-crawler" | string;
|
|
4813
|
+
/** Source URL (required for web-crawler type). */
|
|
4814
|
+
source?: string;
|
|
4815
|
+
source_params?: unknown;
|
|
4690
4816
|
/** Token ID (UUID format) */
|
|
4691
4817
|
token_id?: string;
|
|
4692
4818
|
ai_gateway_id?: string;
|
|
@@ -4696,54 +4822,307 @@ export type AiSearchConfig = {
|
|
|
4696
4822
|
reranking?: boolean;
|
|
4697
4823
|
embedding_model?: string;
|
|
4698
4824
|
ai_search_model?: string;
|
|
4825
|
+
[key: string]: unknown;
|
|
4699
4826
|
};
|
|
4700
|
-
|
|
4827
|
+
// ============ AI Search Item Types ============
|
|
4828
|
+
export type AiSearchItemInfo = {
|
|
4701
4829
|
id: string;
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4830
|
+
key: string;
|
|
4831
|
+
status:
|
|
4832
|
+
| "completed"
|
|
4833
|
+
| "error"
|
|
4834
|
+
| "skipped"
|
|
4835
|
+
| "queued"
|
|
4836
|
+
| "processing"
|
|
4837
|
+
| "outdated";
|
|
4838
|
+
metadata?: Record<string, unknown>;
|
|
4705
4839
|
[key: string]: unknown;
|
|
4706
4840
|
};
|
|
4707
|
-
|
|
4708
|
-
|
|
4841
|
+
export type AiSearchItemContentResult = {
|
|
4842
|
+
body: ReadableStream;
|
|
4843
|
+
contentType: string;
|
|
4844
|
+
filename: string;
|
|
4845
|
+
size: number;
|
|
4846
|
+
};
|
|
4847
|
+
export type AiSearchUploadItemOptions = {
|
|
4848
|
+
metadata?: Record<string, unknown>;
|
|
4849
|
+
};
|
|
4850
|
+
export type AiSearchListItemsParams = {
|
|
4851
|
+
page?: number;
|
|
4852
|
+
per_page?: number;
|
|
4853
|
+
};
|
|
4854
|
+
export type AiSearchListItemsResponse = {
|
|
4855
|
+
result: AiSearchItemInfo[];
|
|
4856
|
+
result_info?: {
|
|
4857
|
+
count: number;
|
|
4858
|
+
page: number;
|
|
4859
|
+
per_page: number;
|
|
4860
|
+
total_count: number;
|
|
4861
|
+
};
|
|
4862
|
+
};
|
|
4863
|
+
// ============ AI Search Job Types ============
|
|
4864
|
+
export type AiSearchJobInfo = {
|
|
4865
|
+
id: string;
|
|
4866
|
+
source: "user" | "schedule";
|
|
4867
|
+
description?: string;
|
|
4868
|
+
last_seen_at?: string;
|
|
4869
|
+
started_at?: string;
|
|
4870
|
+
ended_at?: string;
|
|
4871
|
+
end_reason?: string;
|
|
4872
|
+
};
|
|
4873
|
+
export type AiSearchJobLog = {
|
|
4874
|
+
id: number;
|
|
4875
|
+
message: string;
|
|
4876
|
+
message_type: number;
|
|
4877
|
+
created_at: number;
|
|
4878
|
+
};
|
|
4879
|
+
export type AiSearchCreateJobParams = {
|
|
4880
|
+
description?: string;
|
|
4881
|
+
};
|
|
4882
|
+
export type AiSearchListJobsParams = {
|
|
4883
|
+
page?: number;
|
|
4884
|
+
per_page?: number;
|
|
4885
|
+
};
|
|
4886
|
+
export type AiSearchListJobsResponse = {
|
|
4887
|
+
result: AiSearchJobInfo[];
|
|
4888
|
+
result_info?: {
|
|
4889
|
+
count: number;
|
|
4890
|
+
page: number;
|
|
4891
|
+
per_page: number;
|
|
4892
|
+
total_count: number;
|
|
4893
|
+
};
|
|
4894
|
+
};
|
|
4895
|
+
export type AiSearchJobLogsParams = {
|
|
4896
|
+
page?: number;
|
|
4897
|
+
per_page?: number;
|
|
4898
|
+
};
|
|
4899
|
+
export type AiSearchJobLogsResponse = {
|
|
4900
|
+
result: AiSearchJobLog[];
|
|
4901
|
+
result_info?: {
|
|
4902
|
+
count: number;
|
|
4903
|
+
page: number;
|
|
4904
|
+
per_page: number;
|
|
4905
|
+
total_count: number;
|
|
4906
|
+
};
|
|
4907
|
+
};
|
|
4908
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4909
|
+
/**
|
|
4910
|
+
* Single item service for an AI Search instance.
|
|
4911
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4912
|
+
*/
|
|
4913
|
+
export declare abstract class AiSearchItem {
|
|
4914
|
+
/** Get metadata about this item. */
|
|
4915
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4916
|
+
/**
|
|
4917
|
+
* Download the item's content.
|
|
4918
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4919
|
+
*/
|
|
4920
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4921
|
+
}
|
|
4922
|
+
/**
|
|
4923
|
+
* Items collection service for an AI Search instance.
|
|
4924
|
+
* Provides list, upload, and access to individual items.
|
|
4925
|
+
*/
|
|
4926
|
+
export declare abstract class AiSearchItems {
|
|
4927
|
+
/** List items in this instance. */
|
|
4928
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4929
|
+
/**
|
|
4930
|
+
* Upload a file as an item.
|
|
4931
|
+
* @param name Filename for the uploaded item.
|
|
4932
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4933
|
+
* @param options Optional metadata to attach to the item.
|
|
4934
|
+
* @returns The created item info.
|
|
4935
|
+
*/
|
|
4936
|
+
upload(
|
|
4937
|
+
name: string,
|
|
4938
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4939
|
+
options?: AiSearchUploadItemOptions,
|
|
4940
|
+
): Promise<AiSearchItemInfo>;
|
|
4941
|
+
/**
|
|
4942
|
+
* Upload a file and poll until processing completes.
|
|
4943
|
+
* @param name Filename for the uploaded item.
|
|
4944
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4945
|
+
* @param options Optional metadata to attach to the item.
|
|
4946
|
+
* @returns The item info after processing completes (or timeout).
|
|
4947
|
+
*/
|
|
4948
|
+
uploadAndPoll(
|
|
4949
|
+
name: string,
|
|
4950
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4951
|
+
options?: AiSearchUploadItemOptions,
|
|
4952
|
+
): Promise<AiSearchItemInfo>;
|
|
4953
|
+
/**
|
|
4954
|
+
* Get an item by ID.
|
|
4955
|
+
* @param itemId The item identifier.
|
|
4956
|
+
* @returns Item service for info, delete, and download operations.
|
|
4957
|
+
*/
|
|
4958
|
+
get(itemId: string): AiSearchItem;
|
|
4959
|
+
/** Delete this item from the instance.
|
|
4960
|
+
* @param itemId The item identifier.
|
|
4961
|
+
*/
|
|
4962
|
+
delete(itemId: string): Promise<void>;
|
|
4963
|
+
}
|
|
4964
|
+
/**
|
|
4965
|
+
* Single job service for an AI Search instance.
|
|
4966
|
+
* Provides info and logs for a specific job.
|
|
4967
|
+
*/
|
|
4968
|
+
export declare abstract class AiSearchJob {
|
|
4969
|
+
/** Get metadata about this job. */
|
|
4970
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4971
|
+
/** Get logs for this job. */
|
|
4972
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4973
|
+
}
|
|
4974
|
+
/**
|
|
4975
|
+
* Jobs collection service for an AI Search instance.
|
|
4976
|
+
* Provides list, create, and access to individual jobs.
|
|
4977
|
+
*/
|
|
4978
|
+
export declare abstract class AiSearchJobs {
|
|
4979
|
+
/** List jobs for this instance. */
|
|
4980
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4981
|
+
/**
|
|
4982
|
+
* Create a new indexing job.
|
|
4983
|
+
* @param params Optional job parameters.
|
|
4984
|
+
* @returns The created job info.
|
|
4985
|
+
*/
|
|
4986
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4987
|
+
/**
|
|
4988
|
+
* Get a job by ID.
|
|
4989
|
+
* @param jobId The job identifier.
|
|
4990
|
+
* @returns Job service for info and logs operations.
|
|
4991
|
+
*/
|
|
4992
|
+
get(jobId: string): AiSearchJob;
|
|
4993
|
+
}
|
|
4994
|
+
// ============ AI Search Binding Classes ============
|
|
4995
|
+
/**
|
|
4996
|
+
* Instance-level AI Search service.
|
|
4997
|
+
*
|
|
4998
|
+
* Used as:
|
|
4999
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
5000
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
5001
|
+
*
|
|
5002
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
5003
|
+
*
|
|
5004
|
+
* @example
|
|
5005
|
+
* ```ts
|
|
5006
|
+
* // Via namespace binding
|
|
5007
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
5008
|
+
* const results = await instance.search({
|
|
5009
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5010
|
+
* });
|
|
5011
|
+
*
|
|
5012
|
+
* // Via single instance binding
|
|
5013
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
5014
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5015
|
+
* });
|
|
5016
|
+
* ```
|
|
5017
|
+
*/
|
|
5018
|
+
export declare abstract class AiSearchInstance {
|
|
4709
5019
|
/**
|
|
4710
5020
|
* Search the AI Search instance for relevant chunks.
|
|
4711
|
-
* @param params Search request with messages and AI search options
|
|
4712
|
-
* @returns Search response with matching chunks
|
|
5021
|
+
* @param params Search request with messages and optional AI search options.
|
|
5022
|
+
* @returns Search response with matching chunks and search query.
|
|
4713
5023
|
*/
|
|
4714
5024
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
5025
|
+
/**
|
|
5026
|
+
* Generate chat completions with AI Search context (streaming).
|
|
5027
|
+
* @param params Chat completions request with stream: true.
|
|
5028
|
+
* @returns ReadableStream of server-sent events.
|
|
5029
|
+
*/
|
|
5030
|
+
chatCompletions(
|
|
5031
|
+
params: AiSearchChatCompletionsRequest & {
|
|
5032
|
+
stream: true;
|
|
5033
|
+
},
|
|
5034
|
+
): Promise<ReadableStream>;
|
|
4715
5035
|
/**
|
|
4716
5036
|
* Generate chat completions with AI Search context.
|
|
4717
|
-
* @param params Chat completions request
|
|
4718
|
-
* @returns
|
|
5037
|
+
* @param params Chat completions request.
|
|
5038
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4719
5039
|
*/
|
|
4720
5040
|
chatCompletions(
|
|
4721
5041
|
params: AiSearchChatCompletionsRequest,
|
|
4722
|
-
): Promise<
|
|
5042
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4723
5043
|
/**
|
|
4724
|
-
*
|
|
5044
|
+
* Update the instance configuration.
|
|
5045
|
+
* @param config Partial configuration to update.
|
|
5046
|
+
* @returns Updated instance info.
|
|
4725
5047
|
*/
|
|
4726
|
-
|
|
5048
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
5049
|
+
/** Get metadata about this instance. */
|
|
5050
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
5051
|
+
/**
|
|
5052
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
5053
|
+
* @returns Statistics with counts per status and last activity time.
|
|
5054
|
+
*/
|
|
5055
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
5056
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
5057
|
+
get items(): AiSearchItems;
|
|
5058
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
5059
|
+
get jobs(): AiSearchJobs;
|
|
4727
5060
|
}
|
|
4728
|
-
|
|
4729
|
-
|
|
5061
|
+
/**
|
|
5062
|
+
* Namespace-level AI Search service.
|
|
5063
|
+
*
|
|
5064
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
5065
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
5066
|
+
*
|
|
5067
|
+
* @example
|
|
5068
|
+
* ```ts
|
|
5069
|
+
* // Access an instance within the namespace
|
|
5070
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
5071
|
+
* const results = await blog.search({
|
|
5072
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // List all instances in the namespace
|
|
5076
|
+
* const instances = await env.AI_SEARCH.list();
|
|
5077
|
+
*
|
|
5078
|
+
* // Create a new instance with built-in storage
|
|
5079
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
5080
|
+
* id: "tenant-123",
|
|
5081
|
+
* });
|
|
5082
|
+
*
|
|
5083
|
+
* // Upload items into the instance
|
|
5084
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
5085
|
+
*
|
|
5086
|
+
* // Delete an instance
|
|
5087
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
5088
|
+
* ```
|
|
5089
|
+
*/
|
|
5090
|
+
export declare abstract class AiSearchNamespace {
|
|
5091
|
+
/**
|
|
5092
|
+
* Get an instance by name within the bound namespace.
|
|
5093
|
+
* @param name Instance name.
|
|
5094
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
5095
|
+
*/
|
|
5096
|
+
get(name: string): AiSearchInstance;
|
|
4730
5097
|
/**
|
|
4731
|
-
* List all
|
|
4732
|
-
* @returns Array of
|
|
5098
|
+
* List all instances in the bound namespace.
|
|
5099
|
+
* @returns Array of instance metadata.
|
|
4733
5100
|
*/
|
|
4734
5101
|
list(): Promise<AiSearchListResponse>;
|
|
4735
5102
|
/**
|
|
4736
|
-
*
|
|
4737
|
-
* @param
|
|
4738
|
-
* @returns Instance service for
|
|
5103
|
+
* Create a new instance within the bound namespace.
|
|
5104
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
5105
|
+
* @returns Instance service for the newly created instance.
|
|
5106
|
+
*
|
|
5107
|
+
* @example
|
|
5108
|
+
* ```ts
|
|
5109
|
+
* // Create with built-in storage (upload items manually)
|
|
5110
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
5111
|
+
*
|
|
5112
|
+
* // Create with web crawler source
|
|
5113
|
+
* const instance = await env.AI_SEARCH.create({
|
|
5114
|
+
* id: "docs-search",
|
|
5115
|
+
* type: "web-crawler",
|
|
5116
|
+
* source: "https://developers.cloudflare.com",
|
|
5117
|
+
* });
|
|
5118
|
+
* ```
|
|
4739
5119
|
*/
|
|
4740
|
-
|
|
5120
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4741
5121
|
/**
|
|
4742
|
-
*
|
|
4743
|
-
* @param
|
|
4744
|
-
* @returns Instance service for performing operations
|
|
5122
|
+
* Delete an instance from the bound namespace.
|
|
5123
|
+
* @param name Instance name to delete.
|
|
4745
5124
|
*/
|
|
4746
|
-
|
|
5125
|
+
delete(name: string): Promise<void>;
|
|
4747
5126
|
}
|
|
4748
5127
|
export type AiImageClassificationInput = {
|
|
4749
5128
|
image: number[];
|
|
@@ -5019,6 +5398,402 @@ export declare abstract class BaseAiTranslation {
|
|
|
5019
5398
|
inputs: AiTranslationInput;
|
|
5020
5399
|
postProcessedOutputs: AiTranslationOutput;
|
|
5021
5400
|
}
|
|
5401
|
+
/**
|
|
5402
|
+
* Workers AI support for OpenAI's Chat Completions API
|
|
5403
|
+
*/
|
|
5404
|
+
export type ChatCompletionContentPartText = {
|
|
5405
|
+
type: "text";
|
|
5406
|
+
text: string;
|
|
5407
|
+
};
|
|
5408
|
+
export type ChatCompletionContentPartImage = {
|
|
5409
|
+
type: "image_url";
|
|
5410
|
+
image_url: {
|
|
5411
|
+
url: string;
|
|
5412
|
+
detail?: "auto" | "low" | "high";
|
|
5413
|
+
};
|
|
5414
|
+
};
|
|
5415
|
+
export type ChatCompletionContentPartInputAudio = {
|
|
5416
|
+
type: "input_audio";
|
|
5417
|
+
input_audio: {
|
|
5418
|
+
/** Base64 encoded audio data. */
|
|
5419
|
+
data: string;
|
|
5420
|
+
format: "wav" | "mp3";
|
|
5421
|
+
};
|
|
5422
|
+
};
|
|
5423
|
+
export type ChatCompletionContentPartFile = {
|
|
5424
|
+
type: "file";
|
|
5425
|
+
file: {
|
|
5426
|
+
/** Base64 encoded file data. */
|
|
5427
|
+
file_data?: string;
|
|
5428
|
+
/** The ID of an uploaded file. */
|
|
5429
|
+
file_id?: string;
|
|
5430
|
+
filename?: string;
|
|
5431
|
+
};
|
|
5432
|
+
};
|
|
5433
|
+
export type ChatCompletionContentPartRefusal = {
|
|
5434
|
+
type: "refusal";
|
|
5435
|
+
refusal: string;
|
|
5436
|
+
};
|
|
5437
|
+
export type ChatCompletionContentPart =
|
|
5438
|
+
| ChatCompletionContentPartText
|
|
5439
|
+
| ChatCompletionContentPartImage
|
|
5440
|
+
| ChatCompletionContentPartInputAudio
|
|
5441
|
+
| ChatCompletionContentPartFile;
|
|
5442
|
+
export type FunctionDefinition = {
|
|
5443
|
+
name: string;
|
|
5444
|
+
description?: string;
|
|
5445
|
+
parameters?: Record<string, unknown>;
|
|
5446
|
+
strict?: boolean | null;
|
|
5447
|
+
};
|
|
5448
|
+
export type ChatCompletionFunctionTool = {
|
|
5449
|
+
type: "function";
|
|
5450
|
+
function: FunctionDefinition;
|
|
5451
|
+
};
|
|
5452
|
+
export type ChatCompletionCustomToolGrammarFormat = {
|
|
5453
|
+
type: "grammar";
|
|
5454
|
+
grammar: {
|
|
5455
|
+
definition: string;
|
|
5456
|
+
syntax: "lark" | "regex";
|
|
5457
|
+
};
|
|
5458
|
+
};
|
|
5459
|
+
export type ChatCompletionCustomToolTextFormat = {
|
|
5460
|
+
type: "text";
|
|
5461
|
+
};
|
|
5462
|
+
export type ChatCompletionCustomToolFormat =
|
|
5463
|
+
| ChatCompletionCustomToolTextFormat
|
|
5464
|
+
| ChatCompletionCustomToolGrammarFormat;
|
|
5465
|
+
export type ChatCompletionCustomTool = {
|
|
5466
|
+
type: "custom";
|
|
5467
|
+
custom: {
|
|
5468
|
+
name: string;
|
|
5469
|
+
description?: string;
|
|
5470
|
+
format?: ChatCompletionCustomToolFormat;
|
|
5471
|
+
};
|
|
5472
|
+
};
|
|
5473
|
+
export type ChatCompletionTool =
|
|
5474
|
+
| ChatCompletionFunctionTool
|
|
5475
|
+
| ChatCompletionCustomTool;
|
|
5476
|
+
export type ChatCompletionMessageFunctionToolCall = {
|
|
5477
|
+
id: string;
|
|
5478
|
+
type: "function";
|
|
5479
|
+
function: {
|
|
5480
|
+
name: string;
|
|
5481
|
+
/** JSON-encoded arguments string. */
|
|
5482
|
+
arguments: string;
|
|
5483
|
+
};
|
|
5484
|
+
};
|
|
5485
|
+
export type ChatCompletionMessageCustomToolCall = {
|
|
5486
|
+
id: string;
|
|
5487
|
+
type: "custom";
|
|
5488
|
+
custom: {
|
|
5489
|
+
name: string;
|
|
5490
|
+
input: string;
|
|
5491
|
+
};
|
|
5492
|
+
};
|
|
5493
|
+
export type ChatCompletionMessageToolCall =
|
|
5494
|
+
| ChatCompletionMessageFunctionToolCall
|
|
5495
|
+
| ChatCompletionMessageCustomToolCall;
|
|
5496
|
+
export type ChatCompletionToolChoiceFunction = {
|
|
5497
|
+
type: "function";
|
|
5498
|
+
function: {
|
|
5499
|
+
name: string;
|
|
5500
|
+
};
|
|
5501
|
+
};
|
|
5502
|
+
export type ChatCompletionToolChoiceCustom = {
|
|
5503
|
+
type: "custom";
|
|
5504
|
+
custom: {
|
|
5505
|
+
name: string;
|
|
5506
|
+
};
|
|
5507
|
+
};
|
|
5508
|
+
export type ChatCompletionToolChoiceAllowedTools = {
|
|
5509
|
+
type: "allowed_tools";
|
|
5510
|
+
allowed_tools: {
|
|
5511
|
+
mode: "auto" | "required";
|
|
5512
|
+
tools: Array<Record<string, unknown>>;
|
|
5513
|
+
};
|
|
5514
|
+
};
|
|
5515
|
+
export type ChatCompletionToolChoiceOption =
|
|
5516
|
+
| "none"
|
|
5517
|
+
| "auto"
|
|
5518
|
+
| "required"
|
|
5519
|
+
| ChatCompletionToolChoiceFunction
|
|
5520
|
+
| ChatCompletionToolChoiceCustom
|
|
5521
|
+
| ChatCompletionToolChoiceAllowedTools;
|
|
5522
|
+
export type DeveloperMessage = {
|
|
5523
|
+
role: "developer";
|
|
5524
|
+
content:
|
|
5525
|
+
| string
|
|
5526
|
+
| Array<{
|
|
5527
|
+
type: "text";
|
|
5528
|
+
text: string;
|
|
5529
|
+
}>;
|
|
5530
|
+
name?: string;
|
|
5531
|
+
};
|
|
5532
|
+
export type SystemMessage = {
|
|
5533
|
+
role: "system";
|
|
5534
|
+
content:
|
|
5535
|
+
| string
|
|
5536
|
+
| Array<{
|
|
5537
|
+
type: "text";
|
|
5538
|
+
text: string;
|
|
5539
|
+
}>;
|
|
5540
|
+
name?: string;
|
|
5541
|
+
};
|
|
5542
|
+
/**
|
|
5543
|
+
* Permissive merged content part used inside UserMessage arrays.
|
|
5544
|
+
*
|
|
5545
|
+
* Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
|
|
5546
|
+
* inside nested array items does not correctly match different branches for
|
|
5547
|
+
* different array elements, so the schema uses a single merged object.
|
|
5548
|
+
*/
|
|
5549
|
+
export type UserMessageContentPart = {
|
|
5550
|
+
type: "text" | "image_url" | "input_audio" | "file";
|
|
5551
|
+
text?: string;
|
|
5552
|
+
image_url?: {
|
|
5553
|
+
url?: string;
|
|
5554
|
+
detail?: "auto" | "low" | "high";
|
|
5555
|
+
};
|
|
5556
|
+
input_audio?: {
|
|
5557
|
+
data?: string;
|
|
5558
|
+
format?: "wav" | "mp3";
|
|
5559
|
+
};
|
|
5560
|
+
file?: {
|
|
5561
|
+
file_data?: string;
|
|
5562
|
+
file_id?: string;
|
|
5563
|
+
filename?: string;
|
|
5564
|
+
};
|
|
5565
|
+
};
|
|
5566
|
+
export type UserMessage = {
|
|
5567
|
+
role: "user";
|
|
5568
|
+
content: string | Array<UserMessageContentPart>;
|
|
5569
|
+
name?: string;
|
|
5570
|
+
};
|
|
5571
|
+
export type AssistantMessageContentPart = {
|
|
5572
|
+
type: "text" | "refusal";
|
|
5573
|
+
text?: string;
|
|
5574
|
+
refusal?: string;
|
|
5575
|
+
};
|
|
5576
|
+
export type AssistantMessage = {
|
|
5577
|
+
role: "assistant";
|
|
5578
|
+
content?: string | null | Array<AssistantMessageContentPart>;
|
|
5579
|
+
refusal?: string | null;
|
|
5580
|
+
name?: string;
|
|
5581
|
+
audio?: {
|
|
5582
|
+
id: string;
|
|
5583
|
+
};
|
|
5584
|
+
tool_calls?: Array<ChatCompletionMessageToolCall>;
|
|
5585
|
+
function_call?: {
|
|
5586
|
+
name: string;
|
|
5587
|
+
arguments: string;
|
|
5588
|
+
};
|
|
5589
|
+
};
|
|
5590
|
+
export type ToolMessage = {
|
|
5591
|
+
role: "tool";
|
|
5592
|
+
content:
|
|
5593
|
+
| string
|
|
5594
|
+
| Array<{
|
|
5595
|
+
type: "text";
|
|
5596
|
+
text: string;
|
|
5597
|
+
}>;
|
|
5598
|
+
tool_call_id: string;
|
|
5599
|
+
};
|
|
5600
|
+
export type FunctionMessage = {
|
|
5601
|
+
role: "function";
|
|
5602
|
+
content: string;
|
|
5603
|
+
name: string;
|
|
5604
|
+
};
|
|
5605
|
+
export type ChatCompletionMessageParam =
|
|
5606
|
+
| DeveloperMessage
|
|
5607
|
+
| SystemMessage
|
|
5608
|
+
| UserMessage
|
|
5609
|
+
| AssistantMessage
|
|
5610
|
+
| ToolMessage
|
|
5611
|
+
| FunctionMessage;
|
|
5612
|
+
export type ChatCompletionsResponseFormatText = {
|
|
5613
|
+
type: "text";
|
|
5614
|
+
};
|
|
5615
|
+
export type ChatCompletionsResponseFormatJSONObject = {
|
|
5616
|
+
type: "json_object";
|
|
5617
|
+
};
|
|
5618
|
+
export type ResponseFormatJSONSchema = {
|
|
5619
|
+
type: "json_schema";
|
|
5620
|
+
json_schema: {
|
|
5621
|
+
name: string;
|
|
5622
|
+
description?: string;
|
|
5623
|
+
schema?: Record<string, unknown>;
|
|
5624
|
+
strict?: boolean | null;
|
|
5625
|
+
};
|
|
5626
|
+
};
|
|
5627
|
+
export type ResponseFormat =
|
|
5628
|
+
| ChatCompletionsResponseFormatText
|
|
5629
|
+
| ChatCompletionsResponseFormatJSONObject
|
|
5630
|
+
| ResponseFormatJSONSchema;
|
|
5631
|
+
export type ChatCompletionsStreamOptions = {
|
|
5632
|
+
include_usage?: boolean;
|
|
5633
|
+
include_obfuscation?: boolean;
|
|
5634
|
+
};
|
|
5635
|
+
export type PredictionContent = {
|
|
5636
|
+
type: "content";
|
|
5637
|
+
content:
|
|
5638
|
+
| string
|
|
5639
|
+
| Array<{
|
|
5640
|
+
type: "text";
|
|
5641
|
+
text: string;
|
|
5642
|
+
}>;
|
|
5643
|
+
};
|
|
5644
|
+
export type AudioParams = {
|
|
5645
|
+
voice:
|
|
5646
|
+
| string
|
|
5647
|
+
| {
|
|
5648
|
+
id: string;
|
|
5649
|
+
};
|
|
5650
|
+
format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
|
|
5651
|
+
};
|
|
5652
|
+
export type WebSearchUserLocation = {
|
|
5653
|
+
type: "approximate";
|
|
5654
|
+
approximate: {
|
|
5655
|
+
city?: string;
|
|
5656
|
+
country?: string;
|
|
5657
|
+
region?: string;
|
|
5658
|
+
timezone?: string;
|
|
5659
|
+
};
|
|
5660
|
+
};
|
|
5661
|
+
export type WebSearchOptions = {
|
|
5662
|
+
search_context_size?: "low" | "medium" | "high";
|
|
5663
|
+
user_location?: WebSearchUserLocation;
|
|
5664
|
+
};
|
|
5665
|
+
export type ChatTemplateKwargs = {
|
|
5666
|
+
/** Whether to enable reasoning, enabled by default. */
|
|
5667
|
+
enable_thinking?: boolean;
|
|
5668
|
+
/** If false, preserves reasoning context between turns. */
|
|
5669
|
+
clear_thinking?: boolean;
|
|
5670
|
+
};
|
|
5671
|
+
/** Shared optional properties used by both Prompt and Messages input branches. */
|
|
5672
|
+
export type ChatCompletionsCommonOptions = {
|
|
5673
|
+
model?: string;
|
|
5674
|
+
audio?: AudioParams;
|
|
5675
|
+
frequency_penalty?: number | null;
|
|
5676
|
+
logit_bias?: Record<string, unknown> | null;
|
|
5677
|
+
logprobs?: boolean | null;
|
|
5678
|
+
top_logprobs?: number | null;
|
|
5679
|
+
max_tokens?: number | null;
|
|
5680
|
+
max_completion_tokens?: number | null;
|
|
5681
|
+
metadata?: Record<string, unknown> | null;
|
|
5682
|
+
modalities?: Array<"text" | "audio"> | null;
|
|
5683
|
+
n?: number | null;
|
|
5684
|
+
parallel_tool_calls?: boolean;
|
|
5685
|
+
prediction?: PredictionContent;
|
|
5686
|
+
presence_penalty?: number | null;
|
|
5687
|
+
reasoning_effort?: "low" | "medium" | "high" | null;
|
|
5688
|
+
chat_template_kwargs?: ChatTemplateKwargs;
|
|
5689
|
+
response_format?: ResponseFormat;
|
|
5690
|
+
seed?: number | null;
|
|
5691
|
+
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
|
|
5692
|
+
stop?: string | Array<string> | null;
|
|
5693
|
+
store?: boolean | null;
|
|
5694
|
+
stream?: boolean | null;
|
|
5695
|
+
stream_options?: ChatCompletionsStreamOptions;
|
|
5696
|
+
temperature?: number | null;
|
|
5697
|
+
tool_choice?: ChatCompletionToolChoiceOption;
|
|
5698
|
+
tools?: Array<ChatCompletionTool>;
|
|
5699
|
+
top_p?: number | null;
|
|
5700
|
+
user?: string;
|
|
5701
|
+
web_search_options?: WebSearchOptions;
|
|
5702
|
+
function_call?:
|
|
5703
|
+
| "none"
|
|
5704
|
+
| "auto"
|
|
5705
|
+
| {
|
|
5706
|
+
name: string;
|
|
5707
|
+
};
|
|
5708
|
+
functions?: Array<FunctionDefinition>;
|
|
5709
|
+
};
|
|
5710
|
+
export type PromptTokensDetails = {
|
|
5711
|
+
cached_tokens?: number;
|
|
5712
|
+
audio_tokens?: number;
|
|
5713
|
+
};
|
|
5714
|
+
export type CompletionTokensDetails = {
|
|
5715
|
+
reasoning_tokens?: number;
|
|
5716
|
+
audio_tokens?: number;
|
|
5717
|
+
accepted_prediction_tokens?: number;
|
|
5718
|
+
rejected_prediction_tokens?: number;
|
|
5719
|
+
};
|
|
5720
|
+
export type CompletionUsage = {
|
|
5721
|
+
prompt_tokens: number;
|
|
5722
|
+
completion_tokens: number;
|
|
5723
|
+
total_tokens: number;
|
|
5724
|
+
prompt_tokens_details?: PromptTokensDetails;
|
|
5725
|
+
completion_tokens_details?: CompletionTokensDetails;
|
|
5726
|
+
};
|
|
5727
|
+
export type ChatCompletionTopLogprob = {
|
|
5728
|
+
token: string;
|
|
5729
|
+
logprob: number;
|
|
5730
|
+
bytes: Array<number> | null;
|
|
5731
|
+
};
|
|
5732
|
+
export type ChatCompletionTokenLogprob = {
|
|
5733
|
+
token: string;
|
|
5734
|
+
logprob: number;
|
|
5735
|
+
bytes: Array<number> | null;
|
|
5736
|
+
top_logprobs: Array<ChatCompletionTopLogprob>;
|
|
5737
|
+
};
|
|
5738
|
+
export type ChatCompletionAudio = {
|
|
5739
|
+
id: string;
|
|
5740
|
+
/** Base64 encoded audio bytes. */
|
|
5741
|
+
data: string;
|
|
5742
|
+
expires_at: number;
|
|
5743
|
+
transcript: string;
|
|
5744
|
+
};
|
|
5745
|
+
export type ChatCompletionUrlCitation = {
|
|
5746
|
+
type: "url_citation";
|
|
5747
|
+
url_citation: {
|
|
5748
|
+
url: string;
|
|
5749
|
+
title: string;
|
|
5750
|
+
start_index: number;
|
|
5751
|
+
end_index: number;
|
|
5752
|
+
};
|
|
5753
|
+
};
|
|
5754
|
+
export type ChatCompletionResponseMessage = {
|
|
5755
|
+
role: "assistant";
|
|
5756
|
+
content: string | null;
|
|
5757
|
+
refusal: string | null;
|
|
5758
|
+
annotations?: Array<ChatCompletionUrlCitation>;
|
|
5759
|
+
audio?: ChatCompletionAudio;
|
|
5760
|
+
tool_calls?: Array<ChatCompletionMessageToolCall>;
|
|
5761
|
+
function_call?: {
|
|
5762
|
+
name: string;
|
|
5763
|
+
arguments: string;
|
|
5764
|
+
} | null;
|
|
5765
|
+
};
|
|
5766
|
+
export type ChatCompletionLogprobs = {
|
|
5767
|
+
content: Array<ChatCompletionTokenLogprob> | null;
|
|
5768
|
+
refusal?: Array<ChatCompletionTokenLogprob> | null;
|
|
5769
|
+
};
|
|
5770
|
+
export type ChatCompletionChoice = {
|
|
5771
|
+
index: number;
|
|
5772
|
+
message: ChatCompletionResponseMessage;
|
|
5773
|
+
finish_reason:
|
|
5774
|
+
| "stop"
|
|
5775
|
+
| "length"
|
|
5776
|
+
| "tool_calls"
|
|
5777
|
+
| "content_filter"
|
|
5778
|
+
| "function_call";
|
|
5779
|
+
logprobs: ChatCompletionLogprobs | null;
|
|
5780
|
+
};
|
|
5781
|
+
export type ChatCompletionsPromptInput = {
|
|
5782
|
+
prompt: string;
|
|
5783
|
+
} & ChatCompletionsCommonOptions;
|
|
5784
|
+
export type ChatCompletionsMessagesInput = {
|
|
5785
|
+
messages: Array<ChatCompletionMessageParam>;
|
|
5786
|
+
} & ChatCompletionsCommonOptions;
|
|
5787
|
+
export type ChatCompletionsOutput = {
|
|
5788
|
+
id: string;
|
|
5789
|
+
object: string;
|
|
5790
|
+
created: number;
|
|
5791
|
+
model: string;
|
|
5792
|
+
choices: Array<ChatCompletionChoice>;
|
|
5793
|
+
usage?: CompletionUsage;
|
|
5794
|
+
system_fingerprint?: string | null;
|
|
5795
|
+
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
|
|
5796
|
+
};
|
|
5022
5797
|
/**
|
|
5023
5798
|
* Workers AI support for OpenAI's Responses API
|
|
5024
5799
|
* Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
|
|
@@ -5441,6 +6216,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
|
|
|
5441
6216
|
export type StreamOptions = {
|
|
5442
6217
|
include_obfuscation?: boolean;
|
|
5443
6218
|
};
|
|
6219
|
+
/** Marks keys from T that aren't in U as optional never */
|
|
6220
|
+
export type Without<T, U> = {
|
|
6221
|
+
[P in Exclude<keyof T, keyof U>]?: never;
|
|
6222
|
+
};
|
|
6223
|
+
/** Either T or U, but not both (mutually exclusive) */
|
|
6224
|
+
export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
|
|
5444
6225
|
export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
|
|
5445
6226
|
| {
|
|
5446
6227
|
text: string | string[];
|
|
@@ -5733,10 +6514,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
|
|
|
5733
6514
|
postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
|
|
5734
6515
|
}
|
|
5735
6516
|
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
6517
|
+
audio:
|
|
6518
|
+
| string
|
|
6519
|
+
| {
|
|
6520
|
+
body?: object;
|
|
6521
|
+
contentType?: string;
|
|
6522
|
+
};
|
|
5740
6523
|
/**
|
|
5741
6524
|
* Supported tasks are 'translate' or 'transcribe'.
|
|
5742
6525
|
*/
|
|
@@ -5754,9 +6537,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
|
5754
6537
|
*/
|
|
5755
6538
|
initial_prompt?: string;
|
|
5756
6539
|
/**
|
|
5757
|
-
* The prefix
|
|
6540
|
+
* The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
|
|
5758
6541
|
*/
|
|
5759
6542
|
prefix?: string;
|
|
6543
|
+
/**
|
|
6544
|
+
* The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
|
|
6545
|
+
*/
|
|
6546
|
+
beam_size?: number;
|
|
6547
|
+
/**
|
|
6548
|
+
* Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
|
|
6549
|
+
*/
|
|
6550
|
+
condition_on_previous_text?: boolean;
|
|
6551
|
+
/**
|
|
6552
|
+
* Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
|
|
6553
|
+
*/
|
|
6554
|
+
no_speech_threshold?: number;
|
|
6555
|
+
/**
|
|
6556
|
+
* Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
|
|
6557
|
+
*/
|
|
6558
|
+
compression_ratio_threshold?: number;
|
|
6559
|
+
/**
|
|
6560
|
+
* Threshold for filtering out segments with low average log probability, indicating low confidence.
|
|
6561
|
+
*/
|
|
6562
|
+
log_prob_threshold?: number;
|
|
6563
|
+
/**
|
|
6564
|
+
* Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
|
|
6565
|
+
*/
|
|
6566
|
+
hallucination_silence_threshold?: number;
|
|
5760
6567
|
}
|
|
5761
6568
|
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
|
|
5762
6569
|
transcription_info?: {
|
|
@@ -5903,11 +6710,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
|
|
|
5903
6710
|
truncate_inputs?: boolean;
|
|
5904
6711
|
}
|
|
5905
6712
|
export type Ai_Cf_Baai_Bge_M3_Output =
|
|
5906
|
-
|
|
|
6713
|
+
| Ai_Cf_Baai_Bge_M3_Output_Query
|
|
5907
6714
|
| Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
|
|
5908
|
-
|
|
|
6715
|
+
| Ai_Cf_Baai_Bge_M3_Output_Embedding
|
|
5909
6716
|
| Ai_Cf_Baai_Bge_M3_AsyncResponse;
|
|
5910
|
-
export interface
|
|
6717
|
+
export interface Ai_Cf_Baai_Bge_M3_Output_Query {
|
|
5911
6718
|
response?: {
|
|
5912
6719
|
/**
|
|
5913
6720
|
* Index of the context in the request
|
|
@@ -5927,7 +6734,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
|
|
|
5927
6734
|
*/
|
|
5928
6735
|
pooling?: "mean" | "cls";
|
|
5929
6736
|
}
|
|
5930
|
-
export interface
|
|
6737
|
+
export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
|
|
5931
6738
|
shape?: number[];
|
|
5932
6739
|
/**
|
|
5933
6740
|
* Embeddings of the requested text values
|
|
@@ -6032,7 +6839,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
|
|
|
6032
6839
|
*/
|
|
6033
6840
|
role?: string;
|
|
6034
6841
|
/**
|
|
6035
|
-
* The tool call id.
|
|
6842
|
+
* The tool call id. If you don't know what to put here you can fall back to 000000001
|
|
6036
6843
|
*/
|
|
6037
6844
|
tool_call_id?: string;
|
|
6038
6845
|
content?:
|
|
@@ -6287,10 +7094,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
|
|
|
6287
7094
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
6288
7095
|
*/
|
|
6289
7096
|
role: string;
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
7097
|
+
content:
|
|
7098
|
+
| string
|
|
7099
|
+
| {
|
|
7100
|
+
/**
|
|
7101
|
+
* Type of the content (text)
|
|
7102
|
+
*/
|
|
7103
|
+
type?: string;
|
|
7104
|
+
/**
|
|
7105
|
+
* Text content
|
|
7106
|
+
*/
|
|
7107
|
+
text?: string;
|
|
7108
|
+
}[];
|
|
6294
7109
|
}[];
|
|
6295
7110
|
functions?: {
|
|
6296
7111
|
name: string;
|
|
@@ -6946,7 +7761,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
|
|
|
6946
7761
|
*/
|
|
6947
7762
|
role?: string;
|
|
6948
7763
|
/**
|
|
6949
|
-
* The tool call id.
|
|
7764
|
+
* The tool call id. If you don't know what to put here you can fall back to 000000001
|
|
6950
7765
|
*/
|
|
6951
7766
|
tool_call_id?: string;
|
|
6952
7767
|
content?:
|
|
@@ -7073,7 +7888,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
|
|
|
7073
7888
|
}
|
|
7074
7889
|
)[];
|
|
7075
7890
|
/**
|
|
7076
|
-
* JSON schema that should be
|
|
7891
|
+
* JSON schema that should be fufilled for the response.
|
|
7077
7892
|
*/
|
|
7078
7893
|
guided_json?: object;
|
|
7079
7894
|
/**
|
|
@@ -7347,7 +8162,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
|
|
|
7347
8162
|
}
|
|
7348
8163
|
)[];
|
|
7349
8164
|
/**
|
|
7350
|
-
* JSON schema that should be
|
|
8165
|
+
* JSON schema that should be fufilled for the response.
|
|
7351
8166
|
*/
|
|
7352
8167
|
guided_json?: object;
|
|
7353
8168
|
/**
|
|
@@ -7440,7 +8255,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
|
|
|
7440
8255
|
*/
|
|
7441
8256
|
prompt: string;
|
|
7442
8257
|
/**
|
|
7443
|
-
* JSON schema that should be
|
|
8258
|
+
* JSON schema that should be fufilled for the response.
|
|
7444
8259
|
*/
|
|
7445
8260
|
guided_json?: object;
|
|
7446
8261
|
/**
|
|
@@ -7604,7 +8419,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
|
|
|
7604
8419
|
}
|
|
7605
8420
|
)[];
|
|
7606
8421
|
/**
|
|
7607
|
-
* JSON schema that should be
|
|
8422
|
+
* JSON schema that should be fufilled for the response.
|
|
7608
8423
|
*/
|
|
7609
8424
|
guided_json?: object;
|
|
7610
8425
|
/**
|
|
@@ -7885,7 +8700,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
|
|
|
7885
8700
|
)[];
|
|
7886
8701
|
response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
|
|
7887
8702
|
/**
|
|
7888
|
-
* JSON schema that should be
|
|
8703
|
+
* JSON schema that should be fufilled for the response.
|
|
7889
8704
|
*/
|
|
7890
8705
|
guided_json?: object;
|
|
7891
8706
|
/**
|
|
@@ -8124,7 +8939,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
|
|
|
8124
8939
|
)[];
|
|
8125
8940
|
response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
|
|
8126
8941
|
/**
|
|
8127
|
-
* JSON schema that should be
|
|
8942
|
+
* JSON schema that should be fufilled for the response.
|
|
8128
8943
|
*/
|
|
8129
8944
|
guided_json?: object;
|
|
8130
8945
|
/**
|
|
@@ -8289,10 +9104,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
|
|
|
8289
9104
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
8290
9105
|
*/
|
|
8291
9106
|
role: string;
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
9107
|
+
content:
|
|
9108
|
+
| string
|
|
9109
|
+
| {
|
|
9110
|
+
/**
|
|
9111
|
+
* Type of the content (text)
|
|
9112
|
+
*/
|
|
9113
|
+
type?: string;
|
|
9114
|
+
/**
|
|
9115
|
+
* Text content
|
|
9116
|
+
*/
|
|
9117
|
+
text?: string;
|
|
9118
|
+
}[];
|
|
8296
9119
|
}[];
|
|
8297
9120
|
functions?: {
|
|
8298
9121
|
name: string;
|
|
@@ -8504,10 +9327,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
|
|
|
8504
9327
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
8505
9328
|
*/
|
|
8506
9329
|
role: string;
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
9330
|
+
content:
|
|
9331
|
+
| string
|
|
9332
|
+
| {
|
|
9333
|
+
/**
|
|
9334
|
+
* Type of the content (text)
|
|
9335
|
+
*/
|
|
9336
|
+
type?: string;
|
|
9337
|
+
/**
|
|
9338
|
+
* Text content
|
|
9339
|
+
*/
|
|
9340
|
+
text?: string;
|
|
9341
|
+
}[];
|
|
8511
9342
|
}[];
|
|
8512
9343
|
functions?: {
|
|
8513
9344
|
name: string;
|
|
@@ -9075,12 +9906,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
|
|
|
9075
9906
|
postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
|
|
9076
9907
|
}
|
|
9077
9908
|
export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
|
|
9078
|
-
inputs: ResponsesInput
|
|
9079
|
-
postProcessedOutputs: ResponsesOutput
|
|
9909
|
+
inputs: XOR<ResponsesInput, ChatCompletionsInput>;
|
|
9910
|
+
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
|
9080
9911
|
}
|
|
9081
9912
|
export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
|
|
9082
|
-
inputs: ResponsesInput
|
|
9083
|
-
postProcessedOutputs: ResponsesOutput
|
|
9913
|
+
inputs: XOR<ResponsesInput, ChatCompletionsInput>;
|
|
9914
|
+
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
|
9084
9915
|
}
|
|
9085
9916
|
export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
|
|
9086
9917
|
/**
|
|
@@ -9212,7 +10043,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
|
|
|
9212
10043
|
*/
|
|
9213
10044
|
text: string | string[];
|
|
9214
10045
|
/**
|
|
9215
|
-
* Target
|
|
10046
|
+
* Target langauge to translate to
|
|
9216
10047
|
*/
|
|
9217
10048
|
target_language:
|
|
9218
10049
|
| "asm_Beng"
|
|
@@ -9328,10 +10159,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
|
|
|
9328
10159
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
9329
10160
|
*/
|
|
9330
10161
|
role: string;
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
10162
|
+
content:
|
|
10163
|
+
| string
|
|
10164
|
+
| {
|
|
10165
|
+
/**
|
|
10166
|
+
* Type of the content (text)
|
|
10167
|
+
*/
|
|
10168
|
+
type?: string;
|
|
10169
|
+
/**
|
|
10170
|
+
* Text content
|
|
10171
|
+
*/
|
|
10172
|
+
text?: string;
|
|
10173
|
+
}[];
|
|
9335
10174
|
}[];
|
|
9336
10175
|
functions?: {
|
|
9337
10176
|
name: string;
|
|
@@ -9543,10 +10382,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
|
|
|
9543
10382
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
9544
10383
|
*/
|
|
9545
10384
|
role: string;
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
10385
|
+
content:
|
|
10386
|
+
| string
|
|
10387
|
+
| {
|
|
10388
|
+
/**
|
|
10389
|
+
* Type of the content (text)
|
|
10390
|
+
*/
|
|
10391
|
+
type?: string;
|
|
10392
|
+
/**
|
|
10393
|
+
* Text content
|
|
10394
|
+
*/
|
|
10395
|
+
text?: string;
|
|
10396
|
+
}[];
|
|
9550
10397
|
}[];
|
|
9551
10398
|
functions?: {
|
|
9552
10399
|
name: string;
|
|
@@ -10101,6 +10948,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
|
|
|
10101
10948
|
inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
|
|
10102
10949
|
postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
|
|
10103
10950
|
}
|
|
10951
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
|
|
10952
|
+
multipart: {
|
|
10953
|
+
body?: object;
|
|
10954
|
+
contentType?: string;
|
|
10955
|
+
};
|
|
10956
|
+
}
|
|
10957
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
|
|
10958
|
+
/**
|
|
10959
|
+
* Generated image as Base64 string.
|
|
10960
|
+
*/
|
|
10961
|
+
image?: string;
|
|
10962
|
+
}
|
|
10963
|
+
export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
|
|
10964
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
|
|
10965
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
|
|
10966
|
+
}
|
|
10967
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
|
|
10968
|
+
multipart: {
|
|
10969
|
+
body?: object;
|
|
10970
|
+
contentType?: string;
|
|
10971
|
+
};
|
|
10972
|
+
}
|
|
10973
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
|
|
10974
|
+
/**
|
|
10975
|
+
* Generated image as Base64 string.
|
|
10976
|
+
*/
|
|
10977
|
+
image?: string;
|
|
10978
|
+
}
|
|
10979
|
+
export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
|
|
10980
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
|
|
10981
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
|
|
10982
|
+
}
|
|
10983
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
|
|
10984
|
+
multipart: {
|
|
10985
|
+
body?: object;
|
|
10986
|
+
contentType?: string;
|
|
10987
|
+
};
|
|
10988
|
+
}
|
|
10989
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
|
|
10990
|
+
/**
|
|
10991
|
+
* Generated image as Base64 string.
|
|
10992
|
+
*/
|
|
10993
|
+
image?: string;
|
|
10994
|
+
}
|
|
10995
|
+
export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
|
|
10996
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
|
|
10997
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
|
|
10998
|
+
}
|
|
10999
|
+
export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
|
|
11000
|
+
inputs: ChatCompletionsInput;
|
|
11001
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11002
|
+
}
|
|
11003
|
+
export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
11004
|
+
inputs: ChatCompletionsInput;
|
|
11005
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11006
|
+
}
|
|
11007
|
+
export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
11008
|
+
inputs: ChatCompletionsInput;
|
|
11009
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11010
|
+
}
|
|
10104
11011
|
export interface AiModels {
|
|
10105
11012
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10106
11013
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10119,7 +11026,6 @@ export interface AiModels {
|
|
|
10119
11026
|
"@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
|
|
10120
11027
|
"@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
|
|
10121
11028
|
"@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
|
|
10122
|
-
"@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
|
|
10123
11029
|
"@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
|
|
10124
11030
|
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
|
|
10125
11031
|
"@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
|
|
@@ -10186,6 +11092,12 @@ export interface AiModels {
|
|
|
10186
11092
|
"@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
|
|
10187
11093
|
"@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
|
|
10188
11094
|
"@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
|
|
11095
|
+
"@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
|
|
11096
|
+
"@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
|
|
11097
|
+
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
11098
|
+
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
11099
|
+
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
11100
|
+
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10189
11101
|
}
|
|
10190
11102
|
export type AiOptions = {
|
|
10191
11103
|
/**
|
|
@@ -10211,6 +11123,7 @@ export type AiOptions = {
|
|
|
10211
11123
|
returnRawResponse?: boolean;
|
|
10212
11124
|
prefix?: string;
|
|
10213
11125
|
extraHeaders?: object;
|
|
11126
|
+
signal?: AbortSignal;
|
|
10214
11127
|
};
|
|
10215
11128
|
export type AiModelsSearchParams = {
|
|
10216
11129
|
author?: string;
|
|
@@ -10237,6 +11150,16 @@ export type AiModelsSearchObject = {
|
|
|
10237
11150
|
value: string;
|
|
10238
11151
|
}[];
|
|
10239
11152
|
};
|
|
11153
|
+
export type ChatCompletionsBase = XOR<
|
|
11154
|
+
ChatCompletionsPromptInput,
|
|
11155
|
+
ChatCompletionsMessagesInput
|
|
11156
|
+
>;
|
|
11157
|
+
export type ChatCompletionsInput = XOR<
|
|
11158
|
+
ChatCompletionsBase,
|
|
11159
|
+
{
|
|
11160
|
+
requests: ChatCompletionsBase[];
|
|
11161
|
+
}
|
|
11162
|
+
>;
|
|
10240
11163
|
export interface InferenceUpstreamError extends Error {}
|
|
10241
11164
|
export interface AiInternalError extends Error {}
|
|
10242
11165
|
export type AiModelListType = Record<string, any>;
|
|
@@ -10246,46 +11169,16 @@ export declare abstract class Ai<
|
|
|
10246
11169
|
aiGatewayLogId: string | null;
|
|
10247
11170
|
gateway(gatewayId: string): AiGateway;
|
|
10248
11171
|
/**
|
|
10249
|
-
*
|
|
10250
|
-
*
|
|
10251
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10252
|
-
* - Account-level operations: `list()`, `create()`
|
|
10253
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10254
|
-
*
|
|
10255
|
-
* @example
|
|
10256
|
-
* ```typescript
|
|
10257
|
-
* // List all AI Search instances
|
|
10258
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10259
|
-
*
|
|
10260
|
-
* // Search an instance
|
|
10261
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10262
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10263
|
-
* ai_search_options: {
|
|
10264
|
-
* retrieval: { max_num_results: 10 }
|
|
10265
|
-
* }
|
|
10266
|
-
* });
|
|
10267
|
-
*
|
|
10268
|
-
* // Generate chat completions with AI Search context
|
|
10269
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10270
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10271
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10272
|
-
* });
|
|
10273
|
-
* ```
|
|
11172
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
11173
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10274
11174
|
*/
|
|
10275
|
-
aiSearch():
|
|
11175
|
+
aiSearch(): AiSearchNamespace;
|
|
10276
11176
|
/**
|
|
10277
11177
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10278
|
-
* Use `
|
|
10279
|
-
*
|
|
10280
|
-
* Migration guide:
|
|
10281
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10282
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10283
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10284
|
-
*
|
|
10285
|
-
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
11178
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
11179
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10286
11180
|
*
|
|
10287
|
-
* @
|
|
10288
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
11181
|
+
* @param autoragId Instance ID
|
|
10289
11182
|
*/
|
|
10290
11183
|
autorag(autoragId: string): AutoRAG;
|
|
10291
11184
|
run<
|
|
@@ -10444,22 +11337,23 @@ export declare abstract class AiGateway {
|
|
|
10444
11337
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10445
11338
|
}
|
|
10446
11339
|
/**
|
|
10447
|
-
* @deprecated
|
|
10448
|
-
*
|
|
11340
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11341
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10449
11342
|
*/
|
|
10450
11343
|
export interface AutoRAGInternalError extends Error {}
|
|
10451
11344
|
/**
|
|
10452
|
-
* @deprecated
|
|
10453
|
-
*
|
|
11345
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11346
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10454
11347
|
*/
|
|
10455
11348
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10456
11349
|
/**
|
|
10457
|
-
* @deprecated
|
|
11350
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11351
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10458
11352
|
*/
|
|
10459
11353
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10460
11354
|
/**
|
|
10461
|
-
* @deprecated
|
|
10462
|
-
*
|
|
11355
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11356
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10463
11357
|
*/
|
|
10464
11358
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10465
11359
|
export type ComparisonFilter = {
|
|
@@ -10472,9 +11366,8 @@ export type CompoundFilter = {
|
|
|
10472
11366
|
filters: ComparisonFilter[];
|
|
10473
11367
|
};
|
|
10474
11368
|
/**
|
|
10475
|
-
* @deprecated
|
|
10476
|
-
*
|
|
10477
|
-
* @see AiSearchSearchRequest
|
|
11369
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11370
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10478
11371
|
*/
|
|
10479
11372
|
export type AutoRagSearchRequest = {
|
|
10480
11373
|
query: string;
|
|
@@ -10491,18 +11384,16 @@ export type AutoRagSearchRequest = {
|
|
|
10491
11384
|
rewrite_query?: boolean;
|
|
10492
11385
|
};
|
|
10493
11386
|
/**
|
|
10494
|
-
* @deprecated
|
|
10495
|
-
*
|
|
10496
|
-
* @see AiSearchChatCompletionsRequest
|
|
11387
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11388
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10497
11389
|
*/
|
|
10498
11390
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10499
11391
|
stream?: boolean;
|
|
10500
11392
|
system_prompt?: string;
|
|
10501
11393
|
};
|
|
10502
11394
|
/**
|
|
10503
|
-
* @deprecated
|
|
10504
|
-
*
|
|
10505
|
-
* @see AiSearchChatCompletionsRequest
|
|
11395
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11396
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10506
11397
|
*/
|
|
10507
11398
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10508
11399
|
AutoRagAiSearchRequest,
|
|
@@ -10511,9 +11402,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10511
11402
|
stream: true;
|
|
10512
11403
|
};
|
|
10513
11404
|
/**
|
|
10514
|
-
* @deprecated
|
|
10515
|
-
*
|
|
10516
|
-
* @see AiSearchSearchResponse
|
|
11405
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11406
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10517
11407
|
*/
|
|
10518
11408
|
export type AutoRagSearchResponse = {
|
|
10519
11409
|
object: "vector_store.search_results.page";
|
|
@@ -10532,9 +11422,8 @@ export type AutoRagSearchResponse = {
|
|
|
10532
11422
|
next_page: string | null;
|
|
10533
11423
|
};
|
|
10534
11424
|
/**
|
|
10535
|
-
* @deprecated
|
|
10536
|
-
*
|
|
10537
|
-
* @see AiSearchListResponse
|
|
11425
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11426
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10538
11427
|
*/
|
|
10539
11428
|
export type AutoRagListResponse = {
|
|
10540
11429
|
id: string;
|
|
@@ -10546,49 +11435,40 @@ export type AutoRagListResponse = {
|
|
|
10546
11435
|
status: string;
|
|
10547
11436
|
}[];
|
|
10548
11437
|
/**
|
|
10549
|
-
* @deprecated
|
|
10550
|
-
*
|
|
11438
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11439
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10551
11440
|
*/
|
|
10552
11441
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10553
11442
|
response: string;
|
|
10554
11443
|
};
|
|
10555
11444
|
/**
|
|
10556
|
-
* @deprecated
|
|
10557
|
-
*
|
|
10558
|
-
*
|
|
10559
|
-
* Migration guide:
|
|
10560
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10561
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10562
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10563
|
-
*
|
|
10564
|
-
* @see AiSearchAccountService
|
|
10565
|
-
* @see AiSearchInstanceService
|
|
11445
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11446
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10566
11447
|
*/
|
|
10567
11448
|
export declare abstract class AutoRAG {
|
|
10568
11449
|
/**
|
|
10569
|
-
* @deprecated Use
|
|
10570
|
-
*
|
|
11450
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11451
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10571
11452
|
*/
|
|
10572
11453
|
list(): Promise<AutoRagListResponse>;
|
|
10573
11454
|
/**
|
|
10574
|
-
* @deprecated Use
|
|
10575
|
-
*
|
|
10576
|
-
* @see AiSearchInstanceService.search
|
|
11455
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11456
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10577
11457
|
*/
|
|
10578
11458
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10579
11459
|
/**
|
|
10580
|
-
* @deprecated Use
|
|
10581
|
-
*
|
|
11460
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11461
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10582
11462
|
*/
|
|
10583
11463
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10584
11464
|
/**
|
|
10585
|
-
* @deprecated Use
|
|
10586
|
-
*
|
|
11465
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11466
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10587
11467
|
*/
|
|
10588
11468
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10589
11469
|
/**
|
|
10590
|
-
* @deprecated Use
|
|
10591
|
-
*
|
|
11470
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11471
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10592
11472
|
*/
|
|
10593
11473
|
aiSearch(
|
|
10594
11474
|
params: AutoRagAiSearchRequest,
|
|
@@ -10713,6 +11593,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
|
10713
11593
|
* (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
|
|
10714
11594
|
*/
|
|
10715
11595
|
cacheTtlByStatus?: Record<string, number>;
|
|
11596
|
+
/**
|
|
11597
|
+
* Explicit Cache-Control header value to set on the response stored in cache.
|
|
11598
|
+
* This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
|
|
11599
|
+
*
|
|
11600
|
+
* Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
|
|
11601
|
+
* as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
|
|
11602
|
+
*
|
|
11603
|
+
* Can be used together with `cacheTtlByStatus`.
|
|
11604
|
+
*/
|
|
11605
|
+
cacheControl?: string;
|
|
11606
|
+
/**
|
|
11607
|
+
* Whether the response should be eligible for Cache Reserve storage.
|
|
11608
|
+
*/
|
|
11609
|
+
cacheReserveEligible?: boolean;
|
|
11610
|
+
/**
|
|
11611
|
+
* Whether to respect strong ETags (as opposed to weak ETags) from the origin.
|
|
11612
|
+
*/
|
|
11613
|
+
respectStrongEtag?: boolean;
|
|
11614
|
+
/**
|
|
11615
|
+
* Whether to strip ETag headers from the origin response before caching.
|
|
11616
|
+
*/
|
|
11617
|
+
stripEtags?: boolean;
|
|
11618
|
+
/**
|
|
11619
|
+
* Whether to strip Last-Modified headers from the origin response before caching.
|
|
11620
|
+
*/
|
|
11621
|
+
stripLastModified?: boolean;
|
|
11622
|
+
/**
|
|
11623
|
+
* Whether to enable Cache Deception Armor, which protects against web cache
|
|
11624
|
+
* deception attacks by verifying the Content-Type matches the URL extension.
|
|
11625
|
+
*/
|
|
11626
|
+
cacheDeceptionArmor?: boolean;
|
|
11627
|
+
/**
|
|
11628
|
+
* Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
|
|
11629
|
+
*/
|
|
11630
|
+
cacheReserveMinimumFileSize?: number;
|
|
10716
11631
|
scrapeShield?: boolean;
|
|
10717
11632
|
apps?: boolean;
|
|
10718
11633
|
image?: RequestInitCfPropertiesImage;
|
|
@@ -12581,6 +13496,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12581
13496
|
constructor(ctx: ExecutionContext, env: Env);
|
|
12582
13497
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12583
13498
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13499
|
+
connect?(socket: Socket): void | Promise<void>;
|
|
12584
13500
|
queue?(batch: MessageBatch<unknown>): void | Promise<void>;
|
|
12585
13501
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12586
13502
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
@@ -12601,6 +13517,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12601
13517
|
constructor(ctx: DurableObjectState, env: Env);
|
|
12602
13518
|
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
12603
13519
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13520
|
+
connect?(socket: Socket): void | Promise<void>;
|
|
12604
13521
|
webSocketMessage?(
|
|
12605
13522
|
ws: WebSocket,
|
|
12606
13523
|
message: string | ArrayBuffer,
|
|
@@ -12741,17 +13658,6 @@ export interface StreamBinding {
|
|
|
12741
13658
|
* @returns A handle for per-video operations.
|
|
12742
13659
|
*/
|
|
12743
13660
|
video(id: string): StreamVideoHandle;
|
|
12744
|
-
/**
|
|
12745
|
-
* Uploads a new video from a File.
|
|
12746
|
-
* @param file The video file to upload.
|
|
12747
|
-
* @returns The uploaded video details.
|
|
12748
|
-
* @throws {BadRequestError} if the upload parameter is invalid
|
|
12749
|
-
* @throws {QuotaReachedError} if the account storage capacity is exceeded
|
|
12750
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12751
|
-
* @throws {RateLimitedError} if the server received too many requests
|
|
12752
|
-
* @throws {InternalError} if an unexpected error occurs
|
|
12753
|
-
*/
|
|
12754
|
-
upload(file: File): Promise<StreamVideo>;
|
|
12755
13661
|
/**
|
|
12756
13662
|
* Uploads a new video from a provided URL.
|
|
12757
13663
|
* @param url The URL to upload from.
|
|
@@ -13601,6 +14507,9 @@ export declare namespace TailStream {
|
|
|
13601
14507
|
readonly type: "fetch";
|
|
13602
14508
|
readonly statusCode: number;
|
|
13603
14509
|
}
|
|
14510
|
+
interface ConnectEventInfo {
|
|
14511
|
+
readonly type: "connect";
|
|
14512
|
+
}
|
|
13604
14513
|
type EventOutcome =
|
|
13605
14514
|
| "ok"
|
|
13606
14515
|
| "canceled"
|
|
@@ -13631,6 +14540,7 @@ export declare namespace TailStream {
|
|
|
13631
14540
|
readonly scriptVersion?: ScriptVersion;
|
|
13632
14541
|
readonly info:
|
|
13633
14542
|
| FetchEventInfo
|
|
14543
|
+
| ConnectEventInfo
|
|
13634
14544
|
| JsRpcEventInfo
|
|
13635
14545
|
| ScheduledEventInfo
|
|
13636
14546
|
| AlarmEventInfo
|