@cloudflare/workers-types 4.20260329.1 → 4.20260401.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 +413 -131
- package/2021-11-03/index.ts +413 -131
- package/2022-01-31/index.d.ts +413 -131
- package/2022-01-31/index.ts +413 -131
- package/2022-03-21/index.d.ts +413 -131
- package/2022-03-21/index.ts +413 -131
- package/2022-08-04/index.d.ts +413 -131
- package/2022-08-04/index.ts +413 -131
- package/2022-10-31/index.d.ts +413 -131
- package/2022-10-31/index.ts +413 -131
- package/2022-11-30/index.d.ts +413 -131
- package/2022-11-30/index.ts +413 -131
- package/2023-03-01/index.d.ts +413 -131
- package/2023-03-01/index.ts +413 -131
- package/2023-07-01/index.d.ts +413 -131
- package/2023-07-01/index.ts +413 -131
- package/experimental/index.d.ts +398 -134
- package/experimental/index.ts +398 -134
- package/index.d.ts +413 -131
- package/index.ts +413 -131
- package/latest/index.d.ts +413 -131
- package/latest/index.ts +413 -131
- package/oldest/index.d.ts +413 -131
- package/oldest/index.ts +413 -131
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -3076,6 +3076,11 @@ interface QueuingStrategyInit {
|
|
|
3076
3076
|
*/
|
|
3077
3077
|
highWaterMark: number;
|
|
3078
3078
|
}
|
|
3079
|
+
interface TracePreviewInfo {
|
|
3080
|
+
id: string;
|
|
3081
|
+
slug: string;
|
|
3082
|
+
name: string;
|
|
3083
|
+
}
|
|
3079
3084
|
interface ScriptVersion {
|
|
3080
3085
|
id?: string;
|
|
3081
3086
|
tag?: string;
|
|
@@ -3110,6 +3115,7 @@ interface TraceItem {
|
|
|
3110
3115
|
readonly dispatchNamespace?: string;
|
|
3111
3116
|
readonly scriptTags?: string[];
|
|
3112
3117
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3118
|
+
readonly preview?: TracePreviewInfo;
|
|
3113
3119
|
readonly durableObjectId?: string;
|
|
3114
3120
|
readonly outcome: string;
|
|
3115
3121
|
readonly executionModel: string;
|
|
@@ -3656,12 +3662,42 @@ interface Container {
|
|
|
3656
3662
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3657
3663
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3658
3664
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3665
|
+
snapshotDirectory(
|
|
3666
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3667
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3668
|
+
snapshotContainer(
|
|
3669
|
+
options: ContainerSnapshotOptions,
|
|
3670
|
+
): Promise<ContainerSnapshot>;
|
|
3671
|
+
}
|
|
3672
|
+
interface ContainerDirectorySnapshot {
|
|
3673
|
+
id: string;
|
|
3674
|
+
size: number;
|
|
3675
|
+
dir: string;
|
|
3676
|
+
name?: string;
|
|
3677
|
+
}
|
|
3678
|
+
interface ContainerDirectorySnapshotOptions {
|
|
3679
|
+
dir: string;
|
|
3680
|
+
name?: string;
|
|
3681
|
+
}
|
|
3682
|
+
interface ContainerDirectorySnapshotRestoreParams {
|
|
3683
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3684
|
+
mountPoint?: string;
|
|
3685
|
+
}
|
|
3686
|
+
interface ContainerSnapshot {
|
|
3687
|
+
id: string;
|
|
3688
|
+
size: number;
|
|
3689
|
+
name?: string;
|
|
3690
|
+
}
|
|
3691
|
+
interface ContainerSnapshotOptions {
|
|
3692
|
+
name?: string;
|
|
3659
3693
|
}
|
|
3660
3694
|
interface ContainerStartupOptions {
|
|
3661
3695
|
entrypoint?: string[];
|
|
3662
3696
|
enableInternet: boolean;
|
|
3663
3697
|
env?: Record<string, string>;
|
|
3664
3698
|
labels?: Record<string, string>;
|
|
3699
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3700
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3665
3701
|
}
|
|
3666
3702
|
/**
|
|
3667
3703
|
* The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
|
|
@@ -3788,11 +3824,10 @@ declare abstract class Performance {
|
|
|
3788
3824
|
*/
|
|
3789
3825
|
toJSON(): object;
|
|
3790
3826
|
}
|
|
3791
|
-
// AI Search
|
|
3827
|
+
// ============ AI Search Error Interfaces ============
|
|
3792
3828
|
interface AiSearchInternalError extends Error {}
|
|
3793
3829
|
interface AiSearchNotFoundError extends Error {}
|
|
3794
|
-
|
|
3795
|
-
// AI Search V2 Request Types
|
|
3830
|
+
// ============ AI Search Request Types ============
|
|
3796
3831
|
type AiSearchSearchRequest = {
|
|
3797
3832
|
messages: Array<{
|
|
3798
3833
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3817,9 +3852,8 @@ type AiSearchSearchRequest = {
|
|
|
3817
3852
|
[key: string]: unknown;
|
|
3818
3853
|
};
|
|
3819
3854
|
reranking?: {
|
|
3820
|
-
/** Enable reranking (default false) */
|
|
3821
3855
|
enabled?: boolean;
|
|
3822
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3856
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3823
3857
|
/** Match threshold (0-1, default 0.4) */
|
|
3824
3858
|
match_threshold?: number;
|
|
3825
3859
|
[key: string]: unknown;
|
|
@@ -3831,6 +3865,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3831
3865
|
messages: Array<{
|
|
3832
3866
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3833
3867
|
content: string | null;
|
|
3868
|
+
[key: string]: unknown;
|
|
3834
3869
|
}>;
|
|
3835
3870
|
model?: string;
|
|
3836
3871
|
stream?: boolean;
|
|
@@ -3851,7 +3886,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3851
3886
|
};
|
|
3852
3887
|
reranking?: {
|
|
3853
3888
|
enabled?: boolean;
|
|
3854
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3889
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3855
3890
|
match_threshold?: number;
|
|
3856
3891
|
[key: string]: unknown;
|
|
3857
3892
|
};
|
|
@@ -3859,7 +3894,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3859
3894
|
};
|
|
3860
3895
|
[key: string]: unknown;
|
|
3861
3896
|
};
|
|
3862
|
-
// AI Search
|
|
3897
|
+
// ============ AI Search Response Types ============
|
|
3863
3898
|
type AiSearchSearchResponse = {
|
|
3864
3899
|
search_query: string;
|
|
3865
3900
|
chunks: Array<{
|
|
@@ -3878,26 +3913,65 @@ type AiSearchSearchResponse = {
|
|
|
3878
3913
|
keyword_score?: number;
|
|
3879
3914
|
/** Vector similarity score (0-1) */
|
|
3880
3915
|
vector_score?: number;
|
|
3916
|
+
[key: string]: unknown;
|
|
3881
3917
|
};
|
|
3882
3918
|
}>;
|
|
3883
3919
|
};
|
|
3884
|
-
type
|
|
3920
|
+
type AiSearchChatCompletionsResponse = {
|
|
3921
|
+
id?: string;
|
|
3922
|
+
object?: string;
|
|
3923
|
+
model?: string;
|
|
3924
|
+
choices: Array<{
|
|
3925
|
+
index?: number;
|
|
3926
|
+
message: {
|
|
3927
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3928
|
+
content: string | null;
|
|
3929
|
+
[key: string]: unknown;
|
|
3930
|
+
};
|
|
3931
|
+
[key: string]: unknown;
|
|
3932
|
+
}>;
|
|
3933
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
3934
|
+
[key: string]: unknown;
|
|
3935
|
+
};
|
|
3936
|
+
type AiSearchStatsResponse = {
|
|
3937
|
+
queued?: number;
|
|
3938
|
+
running?: number;
|
|
3939
|
+
completed?: number;
|
|
3940
|
+
error?: number;
|
|
3941
|
+
skipped?: number;
|
|
3942
|
+
outdated?: number;
|
|
3943
|
+
last_activity?: string;
|
|
3944
|
+
};
|
|
3945
|
+
// ============ AI Search Instance Info Types ============
|
|
3946
|
+
type AiSearchInstanceInfo = {
|
|
3885
3947
|
id: string;
|
|
3886
|
-
|
|
3887
|
-
account_id?: string;
|
|
3888
|
-
account_tag?: string;
|
|
3889
|
-
/** Whether the instance is enabled (default true) */
|
|
3890
|
-
enable?: boolean;
|
|
3891
|
-
type?: "r2" | "web-crawler";
|
|
3948
|
+
type?: "r2" | "web-crawler" | string;
|
|
3892
3949
|
source?: string;
|
|
3950
|
+
paused?: boolean;
|
|
3951
|
+
status?: string;
|
|
3952
|
+
namespace?: string;
|
|
3953
|
+
created_at?: string;
|
|
3954
|
+
modified_at?: string;
|
|
3893
3955
|
[key: string]: unknown;
|
|
3894
|
-
}
|
|
3956
|
+
};
|
|
3957
|
+
type AiSearchListResponse = {
|
|
3958
|
+
result: AiSearchInstanceInfo[];
|
|
3959
|
+
result_info?: {
|
|
3960
|
+
count: number;
|
|
3961
|
+
page: number;
|
|
3962
|
+
per_page: number;
|
|
3963
|
+
total_count: number;
|
|
3964
|
+
};
|
|
3965
|
+
};
|
|
3966
|
+
// ============ AI Search Config Types ============
|
|
3895
3967
|
type AiSearchConfig = {
|
|
3896
3968
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3897
3969
|
id: string;
|
|
3898
|
-
type
|
|
3899
|
-
|
|
3900
|
-
|
|
3970
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
3971
|
+
type?: "r2" | "web-crawler" | string;
|
|
3972
|
+
/** Source URL (required for web-crawler type). */
|
|
3973
|
+
source?: string;
|
|
3974
|
+
source_params?: unknown;
|
|
3901
3975
|
/** Token ID (UUID format) */
|
|
3902
3976
|
token_id?: string;
|
|
3903
3977
|
ai_gateway_id?: string;
|
|
@@ -3907,54 +3981,307 @@ type AiSearchConfig = {
|
|
|
3907
3981
|
reranking?: boolean;
|
|
3908
3982
|
embedding_model?: string;
|
|
3909
3983
|
ai_search_model?: string;
|
|
3984
|
+
[key: string]: unknown;
|
|
3910
3985
|
};
|
|
3911
|
-
|
|
3986
|
+
// ============ AI Search Item Types ============
|
|
3987
|
+
type AiSearchItemInfo = {
|
|
3912
3988
|
id: string;
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3989
|
+
key: string;
|
|
3990
|
+
status:
|
|
3991
|
+
| "completed"
|
|
3992
|
+
| "error"
|
|
3993
|
+
| "skipped"
|
|
3994
|
+
| "queued"
|
|
3995
|
+
| "processing"
|
|
3996
|
+
| "outdated";
|
|
3997
|
+
metadata?: Record<string, unknown>;
|
|
3916
3998
|
[key: string]: unknown;
|
|
3917
3999
|
};
|
|
3918
|
-
|
|
3919
|
-
|
|
4000
|
+
type AiSearchItemContentResult = {
|
|
4001
|
+
body: ReadableStream;
|
|
4002
|
+
contentType: string;
|
|
4003
|
+
filename: string;
|
|
4004
|
+
size: number;
|
|
4005
|
+
};
|
|
4006
|
+
type AiSearchUploadItemOptions = {
|
|
4007
|
+
metadata?: Record<string, unknown>;
|
|
4008
|
+
};
|
|
4009
|
+
type AiSearchListItemsParams = {
|
|
4010
|
+
page?: number;
|
|
4011
|
+
per_page?: number;
|
|
4012
|
+
};
|
|
4013
|
+
type AiSearchListItemsResponse = {
|
|
4014
|
+
result: AiSearchItemInfo[];
|
|
4015
|
+
result_info?: {
|
|
4016
|
+
count: number;
|
|
4017
|
+
page: number;
|
|
4018
|
+
per_page: number;
|
|
4019
|
+
total_count: number;
|
|
4020
|
+
};
|
|
4021
|
+
};
|
|
4022
|
+
// ============ AI Search Job Types ============
|
|
4023
|
+
type AiSearchJobInfo = {
|
|
4024
|
+
id: string;
|
|
4025
|
+
source: "user" | "schedule";
|
|
4026
|
+
description?: string;
|
|
4027
|
+
last_seen_at?: string;
|
|
4028
|
+
started_at?: string;
|
|
4029
|
+
ended_at?: string;
|
|
4030
|
+
end_reason?: string;
|
|
4031
|
+
};
|
|
4032
|
+
type AiSearchJobLog = {
|
|
4033
|
+
id: number;
|
|
4034
|
+
message: string;
|
|
4035
|
+
message_type: number;
|
|
4036
|
+
created_at: number;
|
|
4037
|
+
};
|
|
4038
|
+
type AiSearchCreateJobParams = {
|
|
4039
|
+
description?: string;
|
|
4040
|
+
};
|
|
4041
|
+
type AiSearchListJobsParams = {
|
|
4042
|
+
page?: number;
|
|
4043
|
+
per_page?: number;
|
|
4044
|
+
};
|
|
4045
|
+
type AiSearchListJobsResponse = {
|
|
4046
|
+
result: AiSearchJobInfo[];
|
|
4047
|
+
result_info?: {
|
|
4048
|
+
count: number;
|
|
4049
|
+
page: number;
|
|
4050
|
+
per_page: number;
|
|
4051
|
+
total_count: number;
|
|
4052
|
+
};
|
|
4053
|
+
};
|
|
4054
|
+
type AiSearchJobLogsParams = {
|
|
4055
|
+
page?: number;
|
|
4056
|
+
per_page?: number;
|
|
4057
|
+
};
|
|
4058
|
+
type AiSearchJobLogsResponse = {
|
|
4059
|
+
result: AiSearchJobLog[];
|
|
4060
|
+
result_info?: {
|
|
4061
|
+
count: number;
|
|
4062
|
+
page: number;
|
|
4063
|
+
per_page: number;
|
|
4064
|
+
total_count: number;
|
|
4065
|
+
};
|
|
4066
|
+
};
|
|
4067
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4068
|
+
/**
|
|
4069
|
+
* Single item service for an AI Search instance.
|
|
4070
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4071
|
+
*/
|
|
4072
|
+
declare abstract class AiSearchItem {
|
|
4073
|
+
/** Get metadata about this item. */
|
|
4074
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4075
|
+
/**
|
|
4076
|
+
* Download the item's content.
|
|
4077
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4078
|
+
*/
|
|
4079
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4080
|
+
}
|
|
4081
|
+
/**
|
|
4082
|
+
* Items collection service for an AI Search instance.
|
|
4083
|
+
* Provides list, upload, and access to individual items.
|
|
4084
|
+
*/
|
|
4085
|
+
declare abstract class AiSearchItems {
|
|
4086
|
+
/** List items in this instance. */
|
|
4087
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4088
|
+
/**
|
|
4089
|
+
* Upload a file as an item.
|
|
4090
|
+
* @param name Filename for the uploaded item.
|
|
4091
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4092
|
+
* @param options Optional metadata to attach to the item.
|
|
4093
|
+
* @returns The created item info.
|
|
4094
|
+
*/
|
|
4095
|
+
upload(
|
|
4096
|
+
name: string,
|
|
4097
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4098
|
+
options?: AiSearchUploadItemOptions,
|
|
4099
|
+
): Promise<AiSearchItemInfo>;
|
|
4100
|
+
/**
|
|
4101
|
+
* Upload a file and poll until processing completes.
|
|
4102
|
+
* @param name Filename for the uploaded item.
|
|
4103
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4104
|
+
* @param options Optional metadata to attach to the item.
|
|
4105
|
+
* @returns The item info after processing completes (or timeout).
|
|
4106
|
+
*/
|
|
4107
|
+
uploadAndPoll(
|
|
4108
|
+
name: string,
|
|
4109
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4110
|
+
options?: AiSearchUploadItemOptions,
|
|
4111
|
+
): Promise<AiSearchItemInfo>;
|
|
4112
|
+
/**
|
|
4113
|
+
* Get an item by ID.
|
|
4114
|
+
* @param itemId The item identifier.
|
|
4115
|
+
* @returns Item service for info, delete, and download operations.
|
|
4116
|
+
*/
|
|
4117
|
+
get(itemId: string): AiSearchItem;
|
|
4118
|
+
/** Delete this item from the instance.
|
|
4119
|
+
* @param itemId The item identifier.
|
|
4120
|
+
*/
|
|
4121
|
+
delete(itemId: string): Promise<void>;
|
|
4122
|
+
}
|
|
4123
|
+
/**
|
|
4124
|
+
* Single job service for an AI Search instance.
|
|
4125
|
+
* Provides info and logs for a specific job.
|
|
4126
|
+
*/
|
|
4127
|
+
declare abstract class AiSearchJob {
|
|
4128
|
+
/** Get metadata about this job. */
|
|
4129
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4130
|
+
/** Get logs for this job. */
|
|
4131
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4132
|
+
}
|
|
4133
|
+
/**
|
|
4134
|
+
* Jobs collection service for an AI Search instance.
|
|
4135
|
+
* Provides list, create, and access to individual jobs.
|
|
4136
|
+
*/
|
|
4137
|
+
declare abstract class AiSearchJobs {
|
|
4138
|
+
/** List jobs for this instance. */
|
|
4139
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4140
|
+
/**
|
|
4141
|
+
* Create a new indexing job.
|
|
4142
|
+
* @param params Optional job parameters.
|
|
4143
|
+
* @returns The created job info.
|
|
4144
|
+
*/
|
|
4145
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4146
|
+
/**
|
|
4147
|
+
* Get a job by ID.
|
|
4148
|
+
* @param jobId The job identifier.
|
|
4149
|
+
* @returns Job service for info and logs operations.
|
|
4150
|
+
*/
|
|
4151
|
+
get(jobId: string): AiSearchJob;
|
|
4152
|
+
}
|
|
4153
|
+
// ============ AI Search Binding Classes ============
|
|
4154
|
+
/**
|
|
4155
|
+
* Instance-level AI Search service.
|
|
4156
|
+
*
|
|
4157
|
+
* Used as:
|
|
4158
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4159
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4160
|
+
*
|
|
4161
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4162
|
+
*
|
|
4163
|
+
* @example
|
|
4164
|
+
* ```ts
|
|
4165
|
+
* // Via namespace binding
|
|
4166
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4167
|
+
* const results = await instance.search({
|
|
4168
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4169
|
+
* });
|
|
4170
|
+
*
|
|
4171
|
+
* // Via single instance binding
|
|
4172
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4173
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4174
|
+
* });
|
|
4175
|
+
* ```
|
|
4176
|
+
*/
|
|
4177
|
+
declare abstract class AiSearchInstance {
|
|
3920
4178
|
/**
|
|
3921
4179
|
* Search the AI Search instance for relevant chunks.
|
|
3922
|
-
* @param params Search request with messages and AI search options
|
|
3923
|
-
* @returns Search response with matching chunks
|
|
4180
|
+
* @param params Search request with messages and optional AI search options.
|
|
4181
|
+
* @returns Search response with matching chunks and search query.
|
|
3924
4182
|
*/
|
|
3925
4183
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4184
|
+
/**
|
|
4185
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4186
|
+
* @param params Chat completions request with stream: true.
|
|
4187
|
+
* @returns ReadableStream of server-sent events.
|
|
4188
|
+
*/
|
|
4189
|
+
chatCompletions(
|
|
4190
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4191
|
+
stream: true;
|
|
4192
|
+
},
|
|
4193
|
+
): Promise<ReadableStream>;
|
|
3926
4194
|
/**
|
|
3927
4195
|
* Generate chat completions with AI Search context.
|
|
3928
|
-
* @param params Chat completions request
|
|
3929
|
-
* @returns
|
|
4196
|
+
* @param params Chat completions request.
|
|
4197
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
3930
4198
|
*/
|
|
3931
4199
|
chatCompletions(
|
|
3932
4200
|
params: AiSearchChatCompletionsRequest,
|
|
3933
|
-
): Promise<
|
|
4201
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
3934
4202
|
/**
|
|
3935
|
-
*
|
|
4203
|
+
* Update the instance configuration.
|
|
4204
|
+
* @param config Partial configuration to update.
|
|
4205
|
+
* @returns Updated instance info.
|
|
3936
4206
|
*/
|
|
3937
|
-
|
|
4207
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4208
|
+
/** Get metadata about this instance. */
|
|
4209
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4210
|
+
/**
|
|
4211
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4212
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4213
|
+
*/
|
|
4214
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4215
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4216
|
+
get items(): AiSearchItems;
|
|
4217
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4218
|
+
get jobs(): AiSearchJobs;
|
|
3938
4219
|
}
|
|
3939
|
-
|
|
3940
|
-
|
|
4220
|
+
/**
|
|
4221
|
+
* Namespace-level AI Search service.
|
|
4222
|
+
*
|
|
4223
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4224
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4225
|
+
*
|
|
4226
|
+
* @example
|
|
4227
|
+
* ```ts
|
|
4228
|
+
* // Access an instance within the namespace
|
|
4229
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4230
|
+
* const results = await blog.search({
|
|
4231
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4232
|
+
* });
|
|
4233
|
+
*
|
|
4234
|
+
* // List all instances in the namespace
|
|
4235
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4236
|
+
*
|
|
4237
|
+
* // Create a new instance with built-in storage
|
|
4238
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4239
|
+
* id: "tenant-123",
|
|
4240
|
+
* });
|
|
4241
|
+
*
|
|
4242
|
+
* // Upload items into the instance
|
|
4243
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4244
|
+
*
|
|
4245
|
+
* // Delete an instance
|
|
4246
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4247
|
+
* ```
|
|
4248
|
+
*/
|
|
4249
|
+
declare abstract class AiSearchNamespace {
|
|
3941
4250
|
/**
|
|
3942
|
-
*
|
|
3943
|
-
* @
|
|
4251
|
+
* Get an instance by name within the bound namespace.
|
|
4252
|
+
* @param name Instance name.
|
|
4253
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4254
|
+
*/
|
|
4255
|
+
get(name: string): AiSearchInstance;
|
|
4256
|
+
/**
|
|
4257
|
+
* List all instances in the bound namespace.
|
|
4258
|
+
* @returns Array of instance metadata.
|
|
3944
4259
|
*/
|
|
3945
4260
|
list(): Promise<AiSearchListResponse>;
|
|
3946
4261
|
/**
|
|
3947
|
-
*
|
|
3948
|
-
* @param
|
|
3949
|
-
* @returns Instance service for
|
|
4262
|
+
* Create a new instance within the bound namespace.
|
|
4263
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4264
|
+
* @returns Instance service for the newly created instance.
|
|
4265
|
+
*
|
|
4266
|
+
* @example
|
|
4267
|
+
* ```ts
|
|
4268
|
+
* // Create with built-in storage (upload items manually)
|
|
4269
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4270
|
+
*
|
|
4271
|
+
* // Create with web crawler source
|
|
4272
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4273
|
+
* id: "docs-search",
|
|
4274
|
+
* type: "web-crawler",
|
|
4275
|
+
* source: "https://developers.cloudflare.com",
|
|
4276
|
+
* });
|
|
4277
|
+
* ```
|
|
3950
4278
|
*/
|
|
3951
|
-
|
|
4279
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
3952
4280
|
/**
|
|
3953
|
-
*
|
|
3954
|
-
* @param
|
|
3955
|
-
* @returns Instance service for performing operations
|
|
4281
|
+
* Delete an instance from the bound namespace.
|
|
4282
|
+
* @param name Instance name to delete.
|
|
3956
4283
|
*/
|
|
3957
|
-
|
|
4284
|
+
delete(name: string): Promise<void>;
|
|
3958
4285
|
}
|
|
3959
4286
|
type AiImageClassificationInput = {
|
|
3960
4287
|
image: number[];
|
|
@@ -9952,6 +10279,7 @@ type AiOptions = {
|
|
|
9952
10279
|
returnRawResponse?: boolean;
|
|
9953
10280
|
prefix?: string;
|
|
9954
10281
|
extraHeaders?: object;
|
|
10282
|
+
signal?: AbortSignal;
|
|
9955
10283
|
};
|
|
9956
10284
|
type AiModelsSearchParams = {
|
|
9957
10285
|
author?: string;
|
|
@@ -9995,46 +10323,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
9995
10323
|
aiGatewayLogId: string | null;
|
|
9996
10324
|
gateway(gatewayId: string): AiGateway;
|
|
9997
10325
|
/**
|
|
9998
|
-
*
|
|
9999
|
-
*
|
|
10000
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10001
|
-
* - Account-level operations: `list()`, `create()`
|
|
10002
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10003
|
-
*
|
|
10004
|
-
* @example
|
|
10005
|
-
* ```typescript
|
|
10006
|
-
* // List all AI Search instances
|
|
10007
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10008
|
-
*
|
|
10009
|
-
* // Search an instance
|
|
10010
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10011
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10012
|
-
* ai_search_options: {
|
|
10013
|
-
* retrieval: { max_num_results: 10 }
|
|
10014
|
-
* }
|
|
10015
|
-
* });
|
|
10016
|
-
*
|
|
10017
|
-
* // Generate chat completions with AI Search context
|
|
10018
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10019
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10020
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10021
|
-
* });
|
|
10022
|
-
* ```
|
|
10326
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10327
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10023
10328
|
*/
|
|
10024
|
-
aiSearch():
|
|
10329
|
+
aiSearch(): AiSearchNamespace;
|
|
10025
10330
|
/**
|
|
10026
10331
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10027
|
-
* Use `
|
|
10028
|
-
*
|
|
10029
|
-
* Migration guide:
|
|
10030
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10031
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10032
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10332
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10333
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10033
10334
|
*
|
|
10034
|
-
*
|
|
10035
|
-
*
|
|
10036
|
-
* @see AiSearchAccountService
|
|
10037
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10335
|
+
* @param autoragId Instance ID
|
|
10038
10336
|
*/
|
|
10039
10337
|
autorag(autoragId: string): AutoRAG;
|
|
10040
10338
|
run<
|
|
@@ -10193,22 +10491,23 @@ declare abstract class AiGateway {
|
|
|
10193
10491
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10194
10492
|
}
|
|
10195
10493
|
/**
|
|
10196
|
-
* @deprecated
|
|
10197
|
-
*
|
|
10494
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10495
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10198
10496
|
*/
|
|
10199
10497
|
interface AutoRAGInternalError extends Error {}
|
|
10200
10498
|
/**
|
|
10201
|
-
* @deprecated
|
|
10202
|
-
*
|
|
10499
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10500
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10203
10501
|
*/
|
|
10204
10502
|
interface AutoRAGNotFoundError extends Error {}
|
|
10205
10503
|
/**
|
|
10206
|
-
* @deprecated
|
|
10504
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10505
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10207
10506
|
*/
|
|
10208
10507
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10209
10508
|
/**
|
|
10210
|
-
* @deprecated
|
|
10211
|
-
*
|
|
10509
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10510
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10212
10511
|
*/
|
|
10213
10512
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10214
10513
|
type ComparisonFilter = {
|
|
@@ -10221,9 +10520,8 @@ type CompoundFilter = {
|
|
|
10221
10520
|
filters: ComparisonFilter[];
|
|
10222
10521
|
};
|
|
10223
10522
|
/**
|
|
10224
|
-
* @deprecated
|
|
10225
|
-
*
|
|
10226
|
-
* @see AiSearchSearchRequest
|
|
10523
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10524
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10227
10525
|
*/
|
|
10228
10526
|
type AutoRagSearchRequest = {
|
|
10229
10527
|
query: string;
|
|
@@ -10240,18 +10538,16 @@ type AutoRagSearchRequest = {
|
|
|
10240
10538
|
rewrite_query?: boolean;
|
|
10241
10539
|
};
|
|
10242
10540
|
/**
|
|
10243
|
-
* @deprecated
|
|
10244
|
-
*
|
|
10245
|
-
* @see AiSearchChatCompletionsRequest
|
|
10541
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10542
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10246
10543
|
*/
|
|
10247
10544
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10248
10545
|
stream?: boolean;
|
|
10249
10546
|
system_prompt?: string;
|
|
10250
10547
|
};
|
|
10251
10548
|
/**
|
|
10252
|
-
* @deprecated
|
|
10253
|
-
*
|
|
10254
|
-
* @see AiSearchChatCompletionsRequest
|
|
10549
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10550
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10255
10551
|
*/
|
|
10256
10552
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10257
10553
|
AutoRagAiSearchRequest,
|
|
@@ -10260,9 +10556,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10260
10556
|
stream: true;
|
|
10261
10557
|
};
|
|
10262
10558
|
/**
|
|
10263
|
-
* @deprecated
|
|
10264
|
-
*
|
|
10265
|
-
* @see AiSearchSearchResponse
|
|
10559
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10560
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10266
10561
|
*/
|
|
10267
10562
|
type AutoRagSearchResponse = {
|
|
10268
10563
|
object: "vector_store.search_results.page";
|
|
@@ -10281,9 +10576,8 @@ type AutoRagSearchResponse = {
|
|
|
10281
10576
|
next_page: string | null;
|
|
10282
10577
|
};
|
|
10283
10578
|
/**
|
|
10284
|
-
* @deprecated
|
|
10285
|
-
*
|
|
10286
|
-
* @see AiSearchListResponse
|
|
10579
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10580
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10287
10581
|
*/
|
|
10288
10582
|
type AutoRagListResponse = {
|
|
10289
10583
|
id: string;
|
|
@@ -10295,49 +10589,40 @@ type AutoRagListResponse = {
|
|
|
10295
10589
|
status: string;
|
|
10296
10590
|
}[];
|
|
10297
10591
|
/**
|
|
10298
|
-
* @deprecated
|
|
10299
|
-
*
|
|
10592
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10593
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10300
10594
|
*/
|
|
10301
10595
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10302
10596
|
response: string;
|
|
10303
10597
|
};
|
|
10304
10598
|
/**
|
|
10305
|
-
* @deprecated
|
|
10306
|
-
*
|
|
10307
|
-
*
|
|
10308
|
-
* Migration guide:
|
|
10309
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10310
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10311
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10312
|
-
*
|
|
10313
|
-
* @see AiSearchAccountService
|
|
10314
|
-
* @see AiSearchInstanceService
|
|
10599
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10600
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10315
10601
|
*/
|
|
10316
10602
|
declare abstract class AutoRAG {
|
|
10317
10603
|
/**
|
|
10318
|
-
* @deprecated Use
|
|
10319
|
-
*
|
|
10604
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10605
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10320
10606
|
*/
|
|
10321
10607
|
list(): Promise<AutoRagListResponse>;
|
|
10322
10608
|
/**
|
|
10323
|
-
* @deprecated Use
|
|
10324
|
-
*
|
|
10325
|
-
* @see AiSearchInstanceService.search
|
|
10609
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10610
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10326
10611
|
*/
|
|
10327
10612
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10328
10613
|
/**
|
|
10329
|
-
* @deprecated Use
|
|
10330
|
-
*
|
|
10614
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10615
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10331
10616
|
*/
|
|
10332
10617
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10333
10618
|
/**
|
|
10334
|
-
* @deprecated Use
|
|
10335
|
-
*
|
|
10619
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10620
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10336
10621
|
*/
|
|
10337
10622
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10338
10623
|
/**
|
|
10339
|
-
* @deprecated Use
|
|
10340
|
-
*
|
|
10624
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10625
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10341
10626
|
*/
|
|
10342
10627
|
aiSearch(
|
|
10343
10628
|
params: AutoRagAiSearchRequest,
|
|
@@ -12917,14 +13202,13 @@ interface StreamScopedCaptions {
|
|
|
12917
13202
|
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
|
|
12918
13203
|
* One caption or subtitle file per language is allowed.
|
|
12919
13204
|
* @param language The BCP 47 language tag for the caption or subtitle.
|
|
12920
|
-
* @param
|
|
13205
|
+
* @param input The caption or subtitle stream to upload.
|
|
12921
13206
|
* @returns The created caption entry.
|
|
12922
13207
|
* @throws {NotFoundError} if the video is not found
|
|
12923
13208
|
* @throws {BadRequestError} if the language or file is invalid
|
|
12924
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12925
13209
|
* @throws {InternalError} if an unexpected error occurs
|
|
12926
13210
|
*/
|
|
12927
|
-
upload(language: string,
|
|
13211
|
+
upload(language: string, input: ReadableStream): Promise<StreamCaption>;
|
|
12928
13212
|
/**
|
|
12929
13213
|
* Generate captions or subtitles for the provided language via AI.
|
|
12930
13214
|
* @param language The BCP 47 language tag to generate.
|
|
@@ -13000,17 +13284,16 @@ interface StreamVideos {
|
|
|
13000
13284
|
interface StreamWatermarks {
|
|
13001
13285
|
/**
|
|
13002
13286
|
* Generate a new watermark profile
|
|
13003
|
-
* @param
|
|
13287
|
+
* @param input The image stream to upload
|
|
13004
13288
|
* @param params The watermark creation parameters.
|
|
13005
13289
|
* @returns The created watermark profile.
|
|
13006
13290
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13007
13291
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13008
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13009
13292
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13010
13293
|
* @throws {InternalError} if an unexpected error occurs
|
|
13011
13294
|
*/
|
|
13012
13295
|
generate(
|
|
13013
|
-
|
|
13296
|
+
input: ReadableStream,
|
|
13014
13297
|
params: StreamWatermarkCreateParams,
|
|
13015
13298
|
): Promise<StreamWatermark>;
|
|
13016
13299
|
/**
|
|
@@ -13020,7 +13303,6 @@ interface StreamWatermarks {
|
|
|
13020
13303
|
* @returns The created watermark profile.
|
|
13021
13304
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13022
13305
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13023
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13024
13306
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13025
13307
|
* @throws {InternalError} if an unexpected error occurs
|
|
13026
13308
|
*/
|