@cloudflare/workers-types 4.20260410.1 → 4.20260411.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 +70 -22
- package/2021-11-03/index.ts +70 -22
- package/2022-01-31/index.d.ts +70 -22
- package/2022-01-31/index.ts +70 -22
- package/2022-03-21/index.d.ts +70 -22
- package/2022-03-21/index.ts +70 -22
- package/2022-08-04/index.d.ts +70 -22
- package/2022-08-04/index.ts +70 -22
- package/2022-10-31/index.d.ts +70 -22
- package/2022-10-31/index.ts +70 -22
- package/2022-11-30/index.d.ts +70 -22
- package/2022-11-30/index.ts +70 -22
- package/2023-03-01/index.d.ts +70 -22
- package/2023-03-01/index.ts +70 -22
- package/2023-07-01/index.d.ts +70 -22
- package/2023-07-01/index.ts +70 -22
- package/experimental/index.d.ts +70 -22
- package/experimental/index.ts +70 -22
- package/index.d.ts +70 -22
- package/index.ts +70 -22
- package/latest/index.d.ts +70 -22
- package/latest/index.ts +70 -22
- package/oldest/index.d.ts +70 -22
- package/oldest/index.ts +70 -22
- package/package.json +1 -1
package/2022-11-30/index.d.ts
CHANGED
|
@@ -476,6 +476,7 @@ interface ExecutionContext<Props = unknown> {
|
|
|
476
476
|
waitUntil(promise: Promise<any>): void;
|
|
477
477
|
passThroughOnException(): void;
|
|
478
478
|
readonly props: Props;
|
|
479
|
+
cache?: CacheContext;
|
|
479
480
|
}
|
|
480
481
|
type ExportedHandlerFetchHandler<
|
|
481
482
|
Env = unknown,
|
|
@@ -557,6 +558,23 @@ interface AlarmInvocationInfo {
|
|
|
557
558
|
interface Cloudflare {
|
|
558
559
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
559
560
|
}
|
|
561
|
+
interface CachePurgeError {
|
|
562
|
+
code: number;
|
|
563
|
+
message: string;
|
|
564
|
+
}
|
|
565
|
+
interface CachePurgeResult {
|
|
566
|
+
success: boolean;
|
|
567
|
+
zoneTag: string;
|
|
568
|
+
errors: CachePurgeError[];
|
|
569
|
+
}
|
|
570
|
+
interface CachePurgeOptions {
|
|
571
|
+
tags?: string[];
|
|
572
|
+
pathPrefixes?: string[];
|
|
573
|
+
purgeEverything?: boolean;
|
|
574
|
+
}
|
|
575
|
+
interface CacheContext {
|
|
576
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
577
|
+
}
|
|
560
578
|
declare abstract class ColoLocalActorNamespace {
|
|
561
579
|
get(actorId: string): Fetcher;
|
|
562
580
|
}
|
|
@@ -10292,6 +10310,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10292
10310
|
inputs: ChatCompletionsInput;
|
|
10293
10311
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10294
10312
|
}
|
|
10313
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10314
|
+
inputs: ChatCompletionsInput;
|
|
10315
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10316
|
+
}
|
|
10295
10317
|
interface AiModels {
|
|
10296
10318
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10297
10319
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10447,6 +10469,9 @@ type ChatCompletionsInput = XOR<
|
|
|
10447
10469
|
interface InferenceUpstreamError extends Error {}
|
|
10448
10470
|
interface AiInternalError extends Error {}
|
|
10449
10471
|
type AiModelListType = Record<string, any>;
|
|
10472
|
+
type AiAsyncBatchResponse = {
|
|
10473
|
+
request_id: string;
|
|
10474
|
+
};
|
|
10450
10475
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
10451
10476
|
aiGatewayLogId: string | null;
|
|
10452
10477
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -10463,29 +10488,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10463
10488
|
* @param autoragId Instance ID
|
|
10464
10489
|
*/
|
|
10465
10490
|
autorag(autoragId: string): AutoRAG;
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
Options extends AiOptions,
|
|
10469
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10470
|
-
>(
|
|
10491
|
+
// Batch request
|
|
10492
|
+
run<Name extends keyof AiModelList>(
|
|
10471
10493
|
model: Name,
|
|
10472
|
-
inputs:
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10494
|
+
inputs: {
|
|
10495
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10496
|
+
},
|
|
10497
|
+
options: AiOptions & {
|
|
10498
|
+
queueRequest: true;
|
|
10499
|
+
},
|
|
10500
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10501
|
+
// Raw response
|
|
10502
|
+
run<Name extends keyof AiModelList>(
|
|
10503
|
+
model: Name,
|
|
10504
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10505
|
+
options: AiOptions & {
|
|
10506
|
+
returnRawResponse: true;
|
|
10507
|
+
},
|
|
10508
|
+
): Promise<Response>;
|
|
10509
|
+
// WebSocket
|
|
10510
|
+
run<Name extends keyof AiModelList>(
|
|
10511
|
+
model: Name,
|
|
10512
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10513
|
+
options: AiOptions & {
|
|
10514
|
+
websocket: true;
|
|
10515
|
+
},
|
|
10516
|
+
): Promise<Response>;
|
|
10517
|
+
// Streaming
|
|
10518
|
+
run<Name extends keyof AiModelList>(
|
|
10519
|
+
model: Name,
|
|
10520
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10521
|
+
stream: true;
|
|
10522
|
+
},
|
|
10523
|
+
options?: AiOptions,
|
|
10524
|
+
): Promise<ReadableStream>;
|
|
10525
|
+
// Normal (default) - known model
|
|
10526
|
+
run<Name extends keyof AiModelList>(
|
|
10527
|
+
model: Name,
|
|
10528
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10529
|
+
options?: AiOptions,
|
|
10530
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10531
|
+
// Unknown model (gateway fallback)
|
|
10532
|
+
run(
|
|
10533
|
+
model: string & {},
|
|
10534
|
+
inputs: Record<string, unknown>,
|
|
10535
|
+
options?: AiOptions,
|
|
10536
|
+
): Promise<Record<string, unknown>>;
|
|
10489
10537
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10490
10538
|
toMarkdown(): ToMarkdownService;
|
|
10491
10539
|
toMarkdown(
|
package/2022-11-30/index.ts
CHANGED
|
@@ -478,6 +478,7 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
478
478
|
waitUntil(promise: Promise<any>): void;
|
|
479
479
|
passThroughOnException(): void;
|
|
480
480
|
readonly props: Props;
|
|
481
|
+
cache?: CacheContext;
|
|
481
482
|
}
|
|
482
483
|
export type ExportedHandlerFetchHandler<
|
|
483
484
|
Env = unknown,
|
|
@@ -559,6 +560,23 @@ export interface AlarmInvocationInfo {
|
|
|
559
560
|
export interface Cloudflare {
|
|
560
561
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
561
562
|
}
|
|
563
|
+
export interface CachePurgeError {
|
|
564
|
+
code: number;
|
|
565
|
+
message: string;
|
|
566
|
+
}
|
|
567
|
+
export interface CachePurgeResult {
|
|
568
|
+
success: boolean;
|
|
569
|
+
zoneTag: string;
|
|
570
|
+
errors: CachePurgeError[];
|
|
571
|
+
}
|
|
572
|
+
export interface CachePurgeOptions {
|
|
573
|
+
tags?: string[];
|
|
574
|
+
pathPrefixes?: string[];
|
|
575
|
+
purgeEverything?: boolean;
|
|
576
|
+
}
|
|
577
|
+
export interface CacheContext {
|
|
578
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
579
|
+
}
|
|
562
580
|
export declare abstract class ColoLocalActorNamespace {
|
|
563
581
|
get(actorId: string): Fetcher;
|
|
564
582
|
}
|
|
@@ -10301,6 +10319,10 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10301
10319
|
inputs: ChatCompletionsInput;
|
|
10302
10320
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10303
10321
|
}
|
|
10322
|
+
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10323
|
+
inputs: ChatCompletionsInput;
|
|
10324
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10325
|
+
}
|
|
10304
10326
|
export interface AiModels {
|
|
10305
10327
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10306
10328
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10456,6 +10478,9 @@ export type ChatCompletionsInput = XOR<
|
|
|
10456
10478
|
export interface InferenceUpstreamError extends Error {}
|
|
10457
10479
|
export interface AiInternalError extends Error {}
|
|
10458
10480
|
export type AiModelListType = Record<string, any>;
|
|
10481
|
+
export type AiAsyncBatchResponse = {
|
|
10482
|
+
request_id: string;
|
|
10483
|
+
};
|
|
10459
10484
|
export declare abstract class Ai<
|
|
10460
10485
|
AiModelList extends AiModelListType = AiModels,
|
|
10461
10486
|
> {
|
|
@@ -10474,29 +10499,52 @@ export declare abstract class Ai<
|
|
|
10474
10499
|
* @param autoragId Instance ID
|
|
10475
10500
|
*/
|
|
10476
10501
|
autorag(autoragId: string): AutoRAG;
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
Options extends AiOptions,
|
|
10480
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10481
|
-
>(
|
|
10502
|
+
// Batch request
|
|
10503
|
+
run<Name extends keyof AiModelList>(
|
|
10482
10504
|
model: Name,
|
|
10483
|
-
inputs:
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10505
|
+
inputs: {
|
|
10506
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10507
|
+
},
|
|
10508
|
+
options: AiOptions & {
|
|
10509
|
+
queueRequest: true;
|
|
10510
|
+
},
|
|
10511
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10512
|
+
// Raw response
|
|
10513
|
+
run<Name extends keyof AiModelList>(
|
|
10514
|
+
model: Name,
|
|
10515
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10516
|
+
options: AiOptions & {
|
|
10517
|
+
returnRawResponse: true;
|
|
10518
|
+
},
|
|
10519
|
+
): Promise<Response>;
|
|
10520
|
+
// WebSocket
|
|
10521
|
+
run<Name extends keyof AiModelList>(
|
|
10522
|
+
model: Name,
|
|
10523
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10524
|
+
options: AiOptions & {
|
|
10525
|
+
websocket: true;
|
|
10526
|
+
},
|
|
10527
|
+
): Promise<Response>;
|
|
10528
|
+
// Streaming
|
|
10529
|
+
run<Name extends keyof AiModelList>(
|
|
10530
|
+
model: Name,
|
|
10531
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10532
|
+
stream: true;
|
|
10533
|
+
},
|
|
10534
|
+
options?: AiOptions,
|
|
10535
|
+
): Promise<ReadableStream>;
|
|
10536
|
+
// Normal (default) - known model
|
|
10537
|
+
run<Name extends keyof AiModelList>(
|
|
10538
|
+
model: Name,
|
|
10539
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10540
|
+
options?: AiOptions,
|
|
10541
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10542
|
+
// Unknown model (gateway fallback)
|
|
10543
|
+
run(
|
|
10544
|
+
model: string & {},
|
|
10545
|
+
inputs: Record<string, unknown>,
|
|
10546
|
+
options?: AiOptions,
|
|
10547
|
+
): Promise<Record<string, unknown>>;
|
|
10500
10548
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10501
10549
|
toMarkdown(): ToMarkdownService;
|
|
10502
10550
|
toMarkdown(
|
package/2023-03-01/index.d.ts
CHANGED
|
@@ -476,6 +476,7 @@ interface ExecutionContext<Props = unknown> {
|
|
|
476
476
|
waitUntil(promise: Promise<any>): void;
|
|
477
477
|
passThroughOnException(): void;
|
|
478
478
|
readonly props: Props;
|
|
479
|
+
cache?: CacheContext;
|
|
479
480
|
}
|
|
480
481
|
type ExportedHandlerFetchHandler<
|
|
481
482
|
Env = unknown,
|
|
@@ -557,6 +558,23 @@ interface AlarmInvocationInfo {
|
|
|
557
558
|
interface Cloudflare {
|
|
558
559
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
559
560
|
}
|
|
561
|
+
interface CachePurgeError {
|
|
562
|
+
code: number;
|
|
563
|
+
message: string;
|
|
564
|
+
}
|
|
565
|
+
interface CachePurgeResult {
|
|
566
|
+
success: boolean;
|
|
567
|
+
zoneTag: string;
|
|
568
|
+
errors: CachePurgeError[];
|
|
569
|
+
}
|
|
570
|
+
interface CachePurgeOptions {
|
|
571
|
+
tags?: string[];
|
|
572
|
+
pathPrefixes?: string[];
|
|
573
|
+
purgeEverything?: boolean;
|
|
574
|
+
}
|
|
575
|
+
interface CacheContext {
|
|
576
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
577
|
+
}
|
|
560
578
|
declare abstract class ColoLocalActorNamespace {
|
|
561
579
|
get(actorId: string): Fetcher;
|
|
562
580
|
}
|
|
@@ -10298,6 +10316,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10298
10316
|
inputs: ChatCompletionsInput;
|
|
10299
10317
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10300
10318
|
}
|
|
10319
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10320
|
+
inputs: ChatCompletionsInput;
|
|
10321
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10322
|
+
}
|
|
10301
10323
|
interface AiModels {
|
|
10302
10324
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10303
10325
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10453,6 +10475,9 @@ type ChatCompletionsInput = XOR<
|
|
|
10453
10475
|
interface InferenceUpstreamError extends Error {}
|
|
10454
10476
|
interface AiInternalError extends Error {}
|
|
10455
10477
|
type AiModelListType = Record<string, any>;
|
|
10478
|
+
type AiAsyncBatchResponse = {
|
|
10479
|
+
request_id: string;
|
|
10480
|
+
};
|
|
10456
10481
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
10457
10482
|
aiGatewayLogId: string | null;
|
|
10458
10483
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -10469,29 +10494,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10469
10494
|
* @param autoragId Instance ID
|
|
10470
10495
|
*/
|
|
10471
10496
|
autorag(autoragId: string): AutoRAG;
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
Options extends AiOptions,
|
|
10475
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10476
|
-
>(
|
|
10497
|
+
// Batch request
|
|
10498
|
+
run<Name extends keyof AiModelList>(
|
|
10477
10499
|
model: Name,
|
|
10478
|
-
inputs:
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10500
|
+
inputs: {
|
|
10501
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10502
|
+
},
|
|
10503
|
+
options: AiOptions & {
|
|
10504
|
+
queueRequest: true;
|
|
10505
|
+
},
|
|
10506
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10507
|
+
// Raw response
|
|
10508
|
+
run<Name extends keyof AiModelList>(
|
|
10509
|
+
model: Name,
|
|
10510
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10511
|
+
options: AiOptions & {
|
|
10512
|
+
returnRawResponse: true;
|
|
10513
|
+
},
|
|
10514
|
+
): Promise<Response>;
|
|
10515
|
+
// WebSocket
|
|
10516
|
+
run<Name extends keyof AiModelList>(
|
|
10517
|
+
model: Name,
|
|
10518
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10519
|
+
options: AiOptions & {
|
|
10520
|
+
websocket: true;
|
|
10521
|
+
},
|
|
10522
|
+
): Promise<Response>;
|
|
10523
|
+
// Streaming
|
|
10524
|
+
run<Name extends keyof AiModelList>(
|
|
10525
|
+
model: Name,
|
|
10526
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10527
|
+
stream: true;
|
|
10528
|
+
},
|
|
10529
|
+
options?: AiOptions,
|
|
10530
|
+
): Promise<ReadableStream>;
|
|
10531
|
+
// Normal (default) - known model
|
|
10532
|
+
run<Name extends keyof AiModelList>(
|
|
10533
|
+
model: Name,
|
|
10534
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10535
|
+
options?: AiOptions,
|
|
10536
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10537
|
+
// Unknown model (gateway fallback)
|
|
10538
|
+
run(
|
|
10539
|
+
model: string & {},
|
|
10540
|
+
inputs: Record<string, unknown>,
|
|
10541
|
+
options?: AiOptions,
|
|
10542
|
+
): Promise<Record<string, unknown>>;
|
|
10495
10543
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10496
10544
|
toMarkdown(): ToMarkdownService;
|
|
10497
10545
|
toMarkdown(
|
package/2023-03-01/index.ts
CHANGED
|
@@ -478,6 +478,7 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
478
478
|
waitUntil(promise: Promise<any>): void;
|
|
479
479
|
passThroughOnException(): void;
|
|
480
480
|
readonly props: Props;
|
|
481
|
+
cache?: CacheContext;
|
|
481
482
|
}
|
|
482
483
|
export type ExportedHandlerFetchHandler<
|
|
483
484
|
Env = unknown,
|
|
@@ -559,6 +560,23 @@ export interface AlarmInvocationInfo {
|
|
|
559
560
|
export interface Cloudflare {
|
|
560
561
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
561
562
|
}
|
|
563
|
+
export interface CachePurgeError {
|
|
564
|
+
code: number;
|
|
565
|
+
message: string;
|
|
566
|
+
}
|
|
567
|
+
export interface CachePurgeResult {
|
|
568
|
+
success: boolean;
|
|
569
|
+
zoneTag: string;
|
|
570
|
+
errors: CachePurgeError[];
|
|
571
|
+
}
|
|
572
|
+
export interface CachePurgeOptions {
|
|
573
|
+
tags?: string[];
|
|
574
|
+
pathPrefixes?: string[];
|
|
575
|
+
purgeEverything?: boolean;
|
|
576
|
+
}
|
|
577
|
+
export interface CacheContext {
|
|
578
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
579
|
+
}
|
|
562
580
|
export declare abstract class ColoLocalActorNamespace {
|
|
563
581
|
get(actorId: string): Fetcher;
|
|
564
582
|
}
|
|
@@ -10307,6 +10325,10 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10307
10325
|
inputs: ChatCompletionsInput;
|
|
10308
10326
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10309
10327
|
}
|
|
10328
|
+
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10329
|
+
inputs: ChatCompletionsInput;
|
|
10330
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10331
|
+
}
|
|
10310
10332
|
export interface AiModels {
|
|
10311
10333
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10312
10334
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10462,6 +10484,9 @@ export type ChatCompletionsInput = XOR<
|
|
|
10462
10484
|
export interface InferenceUpstreamError extends Error {}
|
|
10463
10485
|
export interface AiInternalError extends Error {}
|
|
10464
10486
|
export type AiModelListType = Record<string, any>;
|
|
10487
|
+
export type AiAsyncBatchResponse = {
|
|
10488
|
+
request_id: string;
|
|
10489
|
+
};
|
|
10465
10490
|
export declare abstract class Ai<
|
|
10466
10491
|
AiModelList extends AiModelListType = AiModels,
|
|
10467
10492
|
> {
|
|
@@ -10480,29 +10505,52 @@ export declare abstract class Ai<
|
|
|
10480
10505
|
* @param autoragId Instance ID
|
|
10481
10506
|
*/
|
|
10482
10507
|
autorag(autoragId: string): AutoRAG;
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
Options extends AiOptions,
|
|
10486
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10487
|
-
>(
|
|
10508
|
+
// Batch request
|
|
10509
|
+
run<Name extends keyof AiModelList>(
|
|
10488
10510
|
model: Name,
|
|
10489
|
-
inputs:
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10511
|
+
inputs: {
|
|
10512
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10513
|
+
},
|
|
10514
|
+
options: AiOptions & {
|
|
10515
|
+
queueRequest: true;
|
|
10516
|
+
},
|
|
10517
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10518
|
+
// Raw response
|
|
10519
|
+
run<Name extends keyof AiModelList>(
|
|
10520
|
+
model: Name,
|
|
10521
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10522
|
+
options: AiOptions & {
|
|
10523
|
+
returnRawResponse: true;
|
|
10524
|
+
},
|
|
10525
|
+
): Promise<Response>;
|
|
10526
|
+
// WebSocket
|
|
10527
|
+
run<Name extends keyof AiModelList>(
|
|
10528
|
+
model: Name,
|
|
10529
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10530
|
+
options: AiOptions & {
|
|
10531
|
+
websocket: true;
|
|
10532
|
+
},
|
|
10533
|
+
): Promise<Response>;
|
|
10534
|
+
// Streaming
|
|
10535
|
+
run<Name extends keyof AiModelList>(
|
|
10536
|
+
model: Name,
|
|
10537
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10538
|
+
stream: true;
|
|
10539
|
+
},
|
|
10540
|
+
options?: AiOptions,
|
|
10541
|
+
): Promise<ReadableStream>;
|
|
10542
|
+
// Normal (default) - known model
|
|
10543
|
+
run<Name extends keyof AiModelList>(
|
|
10544
|
+
model: Name,
|
|
10545
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10546
|
+
options?: AiOptions,
|
|
10547
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10548
|
+
// Unknown model (gateway fallback)
|
|
10549
|
+
run(
|
|
10550
|
+
model: string & {},
|
|
10551
|
+
inputs: Record<string, unknown>,
|
|
10552
|
+
options?: AiOptions,
|
|
10553
|
+
): Promise<Record<string, unknown>>;
|
|
10506
10554
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10507
10555
|
toMarkdown(): ToMarkdownService;
|
|
10508
10556
|
toMarkdown(
|
package/2023-07-01/index.d.ts
CHANGED
|
@@ -476,6 +476,7 @@ interface ExecutionContext<Props = unknown> {
|
|
|
476
476
|
waitUntil(promise: Promise<any>): void;
|
|
477
477
|
passThroughOnException(): void;
|
|
478
478
|
readonly props: Props;
|
|
479
|
+
cache?: CacheContext;
|
|
479
480
|
}
|
|
480
481
|
type ExportedHandlerFetchHandler<
|
|
481
482
|
Env = unknown,
|
|
@@ -557,6 +558,23 @@ interface AlarmInvocationInfo {
|
|
|
557
558
|
interface Cloudflare {
|
|
558
559
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
559
560
|
}
|
|
561
|
+
interface CachePurgeError {
|
|
562
|
+
code: number;
|
|
563
|
+
message: string;
|
|
564
|
+
}
|
|
565
|
+
interface CachePurgeResult {
|
|
566
|
+
success: boolean;
|
|
567
|
+
zoneTag: string;
|
|
568
|
+
errors: CachePurgeError[];
|
|
569
|
+
}
|
|
570
|
+
interface CachePurgeOptions {
|
|
571
|
+
tags?: string[];
|
|
572
|
+
pathPrefixes?: string[];
|
|
573
|
+
purgeEverything?: boolean;
|
|
574
|
+
}
|
|
575
|
+
interface CacheContext {
|
|
576
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
577
|
+
}
|
|
560
578
|
declare abstract class ColoLocalActorNamespace {
|
|
561
579
|
get(actorId: string): Fetcher;
|
|
562
580
|
}
|
|
@@ -10298,6 +10316,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10298
10316
|
inputs: ChatCompletionsInput;
|
|
10299
10317
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10300
10318
|
}
|
|
10319
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10320
|
+
inputs: ChatCompletionsInput;
|
|
10321
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10322
|
+
}
|
|
10301
10323
|
interface AiModels {
|
|
10302
10324
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10303
10325
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10453,6 +10475,9 @@ type ChatCompletionsInput = XOR<
|
|
|
10453
10475
|
interface InferenceUpstreamError extends Error {}
|
|
10454
10476
|
interface AiInternalError extends Error {}
|
|
10455
10477
|
type AiModelListType = Record<string, any>;
|
|
10478
|
+
type AiAsyncBatchResponse = {
|
|
10479
|
+
request_id: string;
|
|
10480
|
+
};
|
|
10456
10481
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
10457
10482
|
aiGatewayLogId: string | null;
|
|
10458
10483
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -10469,29 +10494,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10469
10494
|
* @param autoragId Instance ID
|
|
10470
10495
|
*/
|
|
10471
10496
|
autorag(autoragId: string): AutoRAG;
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
Options extends AiOptions,
|
|
10475
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10476
|
-
>(
|
|
10497
|
+
// Batch request
|
|
10498
|
+
run<Name extends keyof AiModelList>(
|
|
10477
10499
|
model: Name,
|
|
10478
|
-
inputs:
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10500
|
+
inputs: {
|
|
10501
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10502
|
+
},
|
|
10503
|
+
options: AiOptions & {
|
|
10504
|
+
queueRequest: true;
|
|
10505
|
+
},
|
|
10506
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10507
|
+
// Raw response
|
|
10508
|
+
run<Name extends keyof AiModelList>(
|
|
10509
|
+
model: Name,
|
|
10510
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10511
|
+
options: AiOptions & {
|
|
10512
|
+
returnRawResponse: true;
|
|
10513
|
+
},
|
|
10514
|
+
): Promise<Response>;
|
|
10515
|
+
// WebSocket
|
|
10516
|
+
run<Name extends keyof AiModelList>(
|
|
10517
|
+
model: Name,
|
|
10518
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10519
|
+
options: AiOptions & {
|
|
10520
|
+
websocket: true;
|
|
10521
|
+
},
|
|
10522
|
+
): Promise<Response>;
|
|
10523
|
+
// Streaming
|
|
10524
|
+
run<Name extends keyof AiModelList>(
|
|
10525
|
+
model: Name,
|
|
10526
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10527
|
+
stream: true;
|
|
10528
|
+
},
|
|
10529
|
+
options?: AiOptions,
|
|
10530
|
+
): Promise<ReadableStream>;
|
|
10531
|
+
// Normal (default) - known model
|
|
10532
|
+
run<Name extends keyof AiModelList>(
|
|
10533
|
+
model: Name,
|
|
10534
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10535
|
+
options?: AiOptions,
|
|
10536
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10537
|
+
// Unknown model (gateway fallback)
|
|
10538
|
+
run(
|
|
10539
|
+
model: string & {},
|
|
10540
|
+
inputs: Record<string, unknown>,
|
|
10541
|
+
options?: AiOptions,
|
|
10542
|
+
): Promise<Record<string, unknown>>;
|
|
10495
10543
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10496
10544
|
toMarkdown(): ToMarkdownService;
|
|
10497
10545
|
toMarkdown(
|