@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/2022-01-31/index.ts
CHANGED
|
@@ -3089,6 +3089,11 @@ export interface QueuingStrategyInit {
|
|
|
3089
3089
|
*/
|
|
3090
3090
|
highWaterMark: number;
|
|
3091
3091
|
}
|
|
3092
|
+
export interface TracePreviewInfo {
|
|
3093
|
+
id: string;
|
|
3094
|
+
slug: string;
|
|
3095
|
+
name: string;
|
|
3096
|
+
}
|
|
3092
3097
|
export interface ScriptVersion {
|
|
3093
3098
|
id?: string;
|
|
3094
3099
|
tag?: string;
|
|
@@ -3123,6 +3128,7 @@ export interface TraceItem {
|
|
|
3123
3128
|
readonly dispatchNamespace?: string;
|
|
3124
3129
|
readonly scriptTags?: string[];
|
|
3125
3130
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3131
|
+
readonly preview?: TracePreviewInfo;
|
|
3126
3132
|
readonly durableObjectId?: string;
|
|
3127
3133
|
readonly outcome: string;
|
|
3128
3134
|
readonly executionModel: string;
|
|
@@ -3729,12 +3735,42 @@ export interface Container {
|
|
|
3729
3735
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3730
3736
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3731
3737
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3738
|
+
snapshotDirectory(
|
|
3739
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3740
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3741
|
+
snapshotContainer(
|
|
3742
|
+
options: ContainerSnapshotOptions,
|
|
3743
|
+
): Promise<ContainerSnapshot>;
|
|
3744
|
+
}
|
|
3745
|
+
export interface ContainerDirectorySnapshot {
|
|
3746
|
+
id: string;
|
|
3747
|
+
size: number;
|
|
3748
|
+
dir: string;
|
|
3749
|
+
name?: string;
|
|
3750
|
+
}
|
|
3751
|
+
export interface ContainerDirectorySnapshotOptions {
|
|
3752
|
+
dir: string;
|
|
3753
|
+
name?: string;
|
|
3754
|
+
}
|
|
3755
|
+
export interface ContainerDirectorySnapshotRestoreParams {
|
|
3756
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3757
|
+
mountPoint?: string;
|
|
3758
|
+
}
|
|
3759
|
+
export interface ContainerSnapshot {
|
|
3760
|
+
id: string;
|
|
3761
|
+
size: number;
|
|
3762
|
+
name?: string;
|
|
3763
|
+
}
|
|
3764
|
+
export interface ContainerSnapshotOptions {
|
|
3765
|
+
name?: string;
|
|
3732
3766
|
}
|
|
3733
3767
|
export interface ContainerStartupOptions {
|
|
3734
3768
|
entrypoint?: string[];
|
|
3735
3769
|
enableInternet: boolean;
|
|
3736
3770
|
env?: Record<string, string>;
|
|
3737
3771
|
labels?: Record<string, string>;
|
|
3772
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3773
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3738
3774
|
}
|
|
3739
3775
|
/**
|
|
3740
3776
|
* 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.
|
|
@@ -3861,11 +3897,10 @@ export declare abstract class Performance {
|
|
|
3861
3897
|
*/
|
|
3862
3898
|
toJSON(): object;
|
|
3863
3899
|
}
|
|
3864
|
-
// AI Search
|
|
3900
|
+
// ============ AI Search Error Interfaces ============
|
|
3865
3901
|
export interface AiSearchInternalError extends Error {}
|
|
3866
3902
|
export interface AiSearchNotFoundError extends Error {}
|
|
3867
|
-
|
|
3868
|
-
// AI Search V2 Request Types
|
|
3903
|
+
// ============ AI Search Request Types ============
|
|
3869
3904
|
export type AiSearchSearchRequest = {
|
|
3870
3905
|
messages: Array<{
|
|
3871
3906
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3890,9 +3925,8 @@ export type AiSearchSearchRequest = {
|
|
|
3890
3925
|
[key: string]: unknown;
|
|
3891
3926
|
};
|
|
3892
3927
|
reranking?: {
|
|
3893
|
-
/** Enable reranking (default false) */
|
|
3894
3928
|
enabled?: boolean;
|
|
3895
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3929
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3896
3930
|
/** Match threshold (0-1, default 0.4) */
|
|
3897
3931
|
match_threshold?: number;
|
|
3898
3932
|
[key: string]: unknown;
|
|
@@ -3904,6 +3938,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3904
3938
|
messages: Array<{
|
|
3905
3939
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3906
3940
|
content: string | null;
|
|
3941
|
+
[key: string]: unknown;
|
|
3907
3942
|
}>;
|
|
3908
3943
|
model?: string;
|
|
3909
3944
|
stream?: boolean;
|
|
@@ -3924,7 +3959,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3924
3959
|
};
|
|
3925
3960
|
reranking?: {
|
|
3926
3961
|
enabled?: boolean;
|
|
3927
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3962
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3928
3963
|
match_threshold?: number;
|
|
3929
3964
|
[key: string]: unknown;
|
|
3930
3965
|
};
|
|
@@ -3932,7 +3967,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3932
3967
|
};
|
|
3933
3968
|
[key: string]: unknown;
|
|
3934
3969
|
};
|
|
3935
|
-
// AI Search
|
|
3970
|
+
// ============ AI Search Response Types ============
|
|
3936
3971
|
export type AiSearchSearchResponse = {
|
|
3937
3972
|
search_query: string;
|
|
3938
3973
|
chunks: Array<{
|
|
@@ -3951,26 +3986,65 @@ export type AiSearchSearchResponse = {
|
|
|
3951
3986
|
keyword_score?: number;
|
|
3952
3987
|
/** Vector similarity score (0-1) */
|
|
3953
3988
|
vector_score?: number;
|
|
3989
|
+
[key: string]: unknown;
|
|
3954
3990
|
};
|
|
3955
3991
|
}>;
|
|
3956
3992
|
};
|
|
3957
|
-
export type
|
|
3993
|
+
export type AiSearchChatCompletionsResponse = {
|
|
3994
|
+
id?: string;
|
|
3995
|
+
object?: string;
|
|
3996
|
+
model?: string;
|
|
3997
|
+
choices: Array<{
|
|
3998
|
+
index?: number;
|
|
3999
|
+
message: {
|
|
4000
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4001
|
+
content: string | null;
|
|
4002
|
+
[key: string]: unknown;
|
|
4003
|
+
};
|
|
4004
|
+
[key: string]: unknown;
|
|
4005
|
+
}>;
|
|
4006
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4007
|
+
[key: string]: unknown;
|
|
4008
|
+
};
|
|
4009
|
+
export type AiSearchStatsResponse = {
|
|
4010
|
+
queued?: number;
|
|
4011
|
+
running?: number;
|
|
4012
|
+
completed?: number;
|
|
4013
|
+
error?: number;
|
|
4014
|
+
skipped?: number;
|
|
4015
|
+
outdated?: number;
|
|
4016
|
+
last_activity?: string;
|
|
4017
|
+
};
|
|
4018
|
+
// ============ AI Search Instance Info Types ============
|
|
4019
|
+
export type AiSearchInstanceInfo = {
|
|
3958
4020
|
id: string;
|
|
3959
|
-
|
|
3960
|
-
account_id?: string;
|
|
3961
|
-
account_tag?: string;
|
|
3962
|
-
/** Whether the instance is enabled (default true) */
|
|
3963
|
-
enable?: boolean;
|
|
3964
|
-
type?: "r2" | "web-crawler";
|
|
4021
|
+
type?: "r2" | "web-crawler" | string;
|
|
3965
4022
|
source?: string;
|
|
4023
|
+
paused?: boolean;
|
|
4024
|
+
status?: string;
|
|
4025
|
+
namespace?: string;
|
|
4026
|
+
created_at?: string;
|
|
4027
|
+
modified_at?: string;
|
|
3966
4028
|
[key: string]: unknown;
|
|
3967
|
-
}
|
|
4029
|
+
};
|
|
4030
|
+
export type AiSearchListResponse = {
|
|
4031
|
+
result: AiSearchInstanceInfo[];
|
|
4032
|
+
result_info?: {
|
|
4033
|
+
count: number;
|
|
4034
|
+
page: number;
|
|
4035
|
+
per_page: number;
|
|
4036
|
+
total_count: number;
|
|
4037
|
+
};
|
|
4038
|
+
};
|
|
4039
|
+
// ============ AI Search Config Types ============
|
|
3968
4040
|
export type AiSearchConfig = {
|
|
3969
4041
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3970
4042
|
id: string;
|
|
3971
|
-
type
|
|
3972
|
-
|
|
3973
|
-
|
|
4043
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4044
|
+
type?: "r2" | "web-crawler" | string;
|
|
4045
|
+
/** Source URL (required for web-crawler type). */
|
|
4046
|
+
source?: string;
|
|
4047
|
+
source_params?: unknown;
|
|
3974
4048
|
/** Token ID (UUID format) */
|
|
3975
4049
|
token_id?: string;
|
|
3976
4050
|
ai_gateway_id?: string;
|
|
@@ -3980,54 +4054,307 @@ export type AiSearchConfig = {
|
|
|
3980
4054
|
reranking?: boolean;
|
|
3981
4055
|
embedding_model?: string;
|
|
3982
4056
|
ai_search_model?: string;
|
|
4057
|
+
[key: string]: unknown;
|
|
3983
4058
|
};
|
|
3984
|
-
|
|
4059
|
+
// ============ AI Search Item Types ============
|
|
4060
|
+
export type AiSearchItemInfo = {
|
|
3985
4061
|
id: string;
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
4062
|
+
key: string;
|
|
4063
|
+
status:
|
|
4064
|
+
| "completed"
|
|
4065
|
+
| "error"
|
|
4066
|
+
| "skipped"
|
|
4067
|
+
| "queued"
|
|
4068
|
+
| "processing"
|
|
4069
|
+
| "outdated";
|
|
4070
|
+
metadata?: Record<string, unknown>;
|
|
3989
4071
|
[key: string]: unknown;
|
|
3990
4072
|
};
|
|
3991
|
-
|
|
3992
|
-
|
|
4073
|
+
export type AiSearchItemContentResult = {
|
|
4074
|
+
body: ReadableStream;
|
|
4075
|
+
contentType: string;
|
|
4076
|
+
filename: string;
|
|
4077
|
+
size: number;
|
|
4078
|
+
};
|
|
4079
|
+
export type AiSearchUploadItemOptions = {
|
|
4080
|
+
metadata?: Record<string, unknown>;
|
|
4081
|
+
};
|
|
4082
|
+
export type AiSearchListItemsParams = {
|
|
4083
|
+
page?: number;
|
|
4084
|
+
per_page?: number;
|
|
4085
|
+
};
|
|
4086
|
+
export type AiSearchListItemsResponse = {
|
|
4087
|
+
result: AiSearchItemInfo[];
|
|
4088
|
+
result_info?: {
|
|
4089
|
+
count: number;
|
|
4090
|
+
page: number;
|
|
4091
|
+
per_page: number;
|
|
4092
|
+
total_count: number;
|
|
4093
|
+
};
|
|
4094
|
+
};
|
|
4095
|
+
// ============ AI Search Job Types ============
|
|
4096
|
+
export type AiSearchJobInfo = {
|
|
4097
|
+
id: string;
|
|
4098
|
+
source: "user" | "schedule";
|
|
4099
|
+
description?: string;
|
|
4100
|
+
last_seen_at?: string;
|
|
4101
|
+
started_at?: string;
|
|
4102
|
+
ended_at?: string;
|
|
4103
|
+
end_reason?: string;
|
|
4104
|
+
};
|
|
4105
|
+
export type AiSearchJobLog = {
|
|
4106
|
+
id: number;
|
|
4107
|
+
message: string;
|
|
4108
|
+
message_type: number;
|
|
4109
|
+
created_at: number;
|
|
4110
|
+
};
|
|
4111
|
+
export type AiSearchCreateJobParams = {
|
|
4112
|
+
description?: string;
|
|
4113
|
+
};
|
|
4114
|
+
export type AiSearchListJobsParams = {
|
|
4115
|
+
page?: number;
|
|
4116
|
+
per_page?: number;
|
|
4117
|
+
};
|
|
4118
|
+
export type AiSearchListJobsResponse = {
|
|
4119
|
+
result: AiSearchJobInfo[];
|
|
4120
|
+
result_info?: {
|
|
4121
|
+
count: number;
|
|
4122
|
+
page: number;
|
|
4123
|
+
per_page: number;
|
|
4124
|
+
total_count: number;
|
|
4125
|
+
};
|
|
4126
|
+
};
|
|
4127
|
+
export type AiSearchJobLogsParams = {
|
|
4128
|
+
page?: number;
|
|
4129
|
+
per_page?: number;
|
|
4130
|
+
};
|
|
4131
|
+
export type AiSearchJobLogsResponse = {
|
|
4132
|
+
result: AiSearchJobLog[];
|
|
4133
|
+
result_info?: {
|
|
4134
|
+
count: number;
|
|
4135
|
+
page: number;
|
|
4136
|
+
per_page: number;
|
|
4137
|
+
total_count: number;
|
|
4138
|
+
};
|
|
4139
|
+
};
|
|
4140
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4141
|
+
/**
|
|
4142
|
+
* Single item service for an AI Search instance.
|
|
4143
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4144
|
+
*/
|
|
4145
|
+
export declare abstract class AiSearchItem {
|
|
4146
|
+
/** Get metadata about this item. */
|
|
4147
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4148
|
+
/**
|
|
4149
|
+
* Download the item's content.
|
|
4150
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4151
|
+
*/
|
|
4152
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4153
|
+
}
|
|
4154
|
+
/**
|
|
4155
|
+
* Items collection service for an AI Search instance.
|
|
4156
|
+
* Provides list, upload, and access to individual items.
|
|
4157
|
+
*/
|
|
4158
|
+
export declare abstract class AiSearchItems {
|
|
4159
|
+
/** List items in this instance. */
|
|
4160
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4161
|
+
/**
|
|
4162
|
+
* Upload a file as an item.
|
|
4163
|
+
* @param name Filename for the uploaded item.
|
|
4164
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4165
|
+
* @param options Optional metadata to attach to the item.
|
|
4166
|
+
* @returns The created item info.
|
|
4167
|
+
*/
|
|
4168
|
+
upload(
|
|
4169
|
+
name: string,
|
|
4170
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4171
|
+
options?: AiSearchUploadItemOptions,
|
|
4172
|
+
): Promise<AiSearchItemInfo>;
|
|
4173
|
+
/**
|
|
4174
|
+
* Upload a file and poll until processing completes.
|
|
4175
|
+
* @param name Filename for the uploaded item.
|
|
4176
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4177
|
+
* @param options Optional metadata to attach to the item.
|
|
4178
|
+
* @returns The item info after processing completes (or timeout).
|
|
4179
|
+
*/
|
|
4180
|
+
uploadAndPoll(
|
|
4181
|
+
name: string,
|
|
4182
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4183
|
+
options?: AiSearchUploadItemOptions,
|
|
4184
|
+
): Promise<AiSearchItemInfo>;
|
|
4185
|
+
/**
|
|
4186
|
+
* Get an item by ID.
|
|
4187
|
+
* @param itemId The item identifier.
|
|
4188
|
+
* @returns Item service for info, delete, and download operations.
|
|
4189
|
+
*/
|
|
4190
|
+
get(itemId: string): AiSearchItem;
|
|
4191
|
+
/** Delete this item from the instance.
|
|
4192
|
+
* @param itemId The item identifier.
|
|
4193
|
+
*/
|
|
4194
|
+
delete(itemId: string): Promise<void>;
|
|
4195
|
+
}
|
|
4196
|
+
/**
|
|
4197
|
+
* Single job service for an AI Search instance.
|
|
4198
|
+
* Provides info and logs for a specific job.
|
|
4199
|
+
*/
|
|
4200
|
+
export declare abstract class AiSearchJob {
|
|
4201
|
+
/** Get metadata about this job. */
|
|
4202
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4203
|
+
/** Get logs for this job. */
|
|
4204
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4205
|
+
}
|
|
4206
|
+
/**
|
|
4207
|
+
* Jobs collection service for an AI Search instance.
|
|
4208
|
+
* Provides list, create, and access to individual jobs.
|
|
4209
|
+
*/
|
|
4210
|
+
export declare abstract class AiSearchJobs {
|
|
4211
|
+
/** List jobs for this instance. */
|
|
4212
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4213
|
+
/**
|
|
4214
|
+
* Create a new indexing job.
|
|
4215
|
+
* @param params Optional job parameters.
|
|
4216
|
+
* @returns The created job info.
|
|
4217
|
+
*/
|
|
4218
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4219
|
+
/**
|
|
4220
|
+
* Get a job by ID.
|
|
4221
|
+
* @param jobId The job identifier.
|
|
4222
|
+
* @returns Job service for info and logs operations.
|
|
4223
|
+
*/
|
|
4224
|
+
get(jobId: string): AiSearchJob;
|
|
4225
|
+
}
|
|
4226
|
+
// ============ AI Search Binding Classes ============
|
|
4227
|
+
/**
|
|
4228
|
+
* Instance-level AI Search service.
|
|
4229
|
+
*
|
|
4230
|
+
* Used as:
|
|
4231
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4232
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4233
|
+
*
|
|
4234
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4235
|
+
*
|
|
4236
|
+
* @example
|
|
4237
|
+
* ```ts
|
|
4238
|
+
* // Via namespace binding
|
|
4239
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4240
|
+
* const results = await instance.search({
|
|
4241
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4242
|
+
* });
|
|
4243
|
+
*
|
|
4244
|
+
* // Via single instance binding
|
|
4245
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4246
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4247
|
+
* });
|
|
4248
|
+
* ```
|
|
4249
|
+
*/
|
|
4250
|
+
export declare abstract class AiSearchInstance {
|
|
3993
4251
|
/**
|
|
3994
4252
|
* Search the AI Search instance for relevant chunks.
|
|
3995
|
-
* @param params Search request with messages and AI search options
|
|
3996
|
-
* @returns Search response with matching chunks
|
|
4253
|
+
* @param params Search request with messages and optional AI search options.
|
|
4254
|
+
* @returns Search response with matching chunks and search query.
|
|
3997
4255
|
*/
|
|
3998
4256
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4257
|
+
/**
|
|
4258
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4259
|
+
* @param params Chat completions request with stream: true.
|
|
4260
|
+
* @returns ReadableStream of server-sent events.
|
|
4261
|
+
*/
|
|
4262
|
+
chatCompletions(
|
|
4263
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4264
|
+
stream: true;
|
|
4265
|
+
},
|
|
4266
|
+
): Promise<ReadableStream>;
|
|
3999
4267
|
/**
|
|
4000
4268
|
* Generate chat completions with AI Search context.
|
|
4001
|
-
* @param params Chat completions request
|
|
4002
|
-
* @returns
|
|
4269
|
+
* @param params Chat completions request.
|
|
4270
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4003
4271
|
*/
|
|
4004
4272
|
chatCompletions(
|
|
4005
4273
|
params: AiSearchChatCompletionsRequest,
|
|
4006
|
-
): Promise<
|
|
4274
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4007
4275
|
/**
|
|
4008
|
-
*
|
|
4276
|
+
* Update the instance configuration.
|
|
4277
|
+
* @param config Partial configuration to update.
|
|
4278
|
+
* @returns Updated instance info.
|
|
4009
4279
|
*/
|
|
4010
|
-
|
|
4280
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4281
|
+
/** Get metadata about this instance. */
|
|
4282
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4283
|
+
/**
|
|
4284
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4285
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4286
|
+
*/
|
|
4287
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4288
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4289
|
+
get items(): AiSearchItems;
|
|
4290
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4291
|
+
get jobs(): AiSearchJobs;
|
|
4011
4292
|
}
|
|
4012
|
-
|
|
4013
|
-
|
|
4293
|
+
/**
|
|
4294
|
+
* Namespace-level AI Search service.
|
|
4295
|
+
*
|
|
4296
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4297
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4298
|
+
*
|
|
4299
|
+
* @example
|
|
4300
|
+
* ```ts
|
|
4301
|
+
* // Access an instance within the namespace
|
|
4302
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4303
|
+
* const results = await blog.search({
|
|
4304
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4305
|
+
* });
|
|
4306
|
+
*
|
|
4307
|
+
* // List all instances in the namespace
|
|
4308
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4309
|
+
*
|
|
4310
|
+
* // Create a new instance with built-in storage
|
|
4311
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4312
|
+
* id: "tenant-123",
|
|
4313
|
+
* });
|
|
4314
|
+
*
|
|
4315
|
+
* // Upload items into the instance
|
|
4316
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4317
|
+
*
|
|
4318
|
+
* // Delete an instance
|
|
4319
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4320
|
+
* ```
|
|
4321
|
+
*/
|
|
4322
|
+
export declare abstract class AiSearchNamespace {
|
|
4014
4323
|
/**
|
|
4015
|
-
*
|
|
4016
|
-
* @
|
|
4324
|
+
* Get an instance by name within the bound namespace.
|
|
4325
|
+
* @param name Instance name.
|
|
4326
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4327
|
+
*/
|
|
4328
|
+
get(name: string): AiSearchInstance;
|
|
4329
|
+
/**
|
|
4330
|
+
* List all instances in the bound namespace.
|
|
4331
|
+
* @returns Array of instance metadata.
|
|
4017
4332
|
*/
|
|
4018
4333
|
list(): Promise<AiSearchListResponse>;
|
|
4019
4334
|
/**
|
|
4020
|
-
*
|
|
4021
|
-
* @param
|
|
4022
|
-
* @returns Instance service for
|
|
4335
|
+
* Create a new instance within the bound namespace.
|
|
4336
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4337
|
+
* @returns Instance service for the newly created instance.
|
|
4338
|
+
*
|
|
4339
|
+
* @example
|
|
4340
|
+
* ```ts
|
|
4341
|
+
* // Create with built-in storage (upload items manually)
|
|
4342
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4343
|
+
*
|
|
4344
|
+
* // Create with web crawler source
|
|
4345
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4346
|
+
* id: "docs-search",
|
|
4347
|
+
* type: "web-crawler",
|
|
4348
|
+
* source: "https://developers.cloudflare.com",
|
|
4349
|
+
* });
|
|
4350
|
+
* ```
|
|
4023
4351
|
*/
|
|
4024
|
-
|
|
4352
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4025
4353
|
/**
|
|
4026
|
-
*
|
|
4027
|
-
* @param
|
|
4028
|
-
* @returns Instance service for performing operations
|
|
4354
|
+
* Delete an instance from the bound namespace.
|
|
4355
|
+
* @param name Instance name to delete.
|
|
4029
4356
|
*/
|
|
4030
|
-
|
|
4357
|
+
delete(name: string): Promise<void>;
|
|
4031
4358
|
}
|
|
4032
4359
|
export type AiImageClassificationInput = {
|
|
4033
4360
|
image: number[];
|
|
@@ -10028,6 +10355,7 @@ export type AiOptions = {
|
|
|
10028
10355
|
returnRawResponse?: boolean;
|
|
10029
10356
|
prefix?: string;
|
|
10030
10357
|
extraHeaders?: object;
|
|
10358
|
+
signal?: AbortSignal;
|
|
10031
10359
|
};
|
|
10032
10360
|
export type AiModelsSearchParams = {
|
|
10033
10361
|
author?: string;
|
|
@@ -10073,46 +10401,16 @@ export declare abstract class Ai<
|
|
|
10073
10401
|
aiGatewayLogId: string | null;
|
|
10074
10402
|
gateway(gatewayId: string): AiGateway;
|
|
10075
10403
|
/**
|
|
10076
|
-
*
|
|
10077
|
-
*
|
|
10078
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10079
|
-
* - Account-level operations: `list()`, `create()`
|
|
10080
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10081
|
-
*
|
|
10082
|
-
* @example
|
|
10083
|
-
* ```typescript
|
|
10084
|
-
* // List all AI Search instances
|
|
10085
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10086
|
-
*
|
|
10087
|
-
* // Search an instance
|
|
10088
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10089
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10090
|
-
* ai_search_options: {
|
|
10091
|
-
* retrieval: { max_num_results: 10 }
|
|
10092
|
-
* }
|
|
10093
|
-
* });
|
|
10094
|
-
*
|
|
10095
|
-
* // Generate chat completions with AI Search context
|
|
10096
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10097
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10098
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10099
|
-
* });
|
|
10100
|
-
* ```
|
|
10404
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10405
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10101
10406
|
*/
|
|
10102
|
-
aiSearch():
|
|
10407
|
+
aiSearch(): AiSearchNamespace;
|
|
10103
10408
|
/**
|
|
10104
10409
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10105
|
-
* Use `
|
|
10106
|
-
*
|
|
10107
|
-
* Migration guide:
|
|
10108
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10109
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10110
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10410
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10411
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10111
10412
|
*
|
|
10112
|
-
*
|
|
10113
|
-
*
|
|
10114
|
-
* @see AiSearchAccountService
|
|
10115
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10413
|
+
* @param autoragId Instance ID
|
|
10116
10414
|
*/
|
|
10117
10415
|
autorag(autoragId: string): AutoRAG;
|
|
10118
10416
|
run<
|
|
@@ -10271,22 +10569,23 @@ export declare abstract class AiGateway {
|
|
|
10271
10569
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10272
10570
|
}
|
|
10273
10571
|
/**
|
|
10274
|
-
* @deprecated
|
|
10275
|
-
*
|
|
10572
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10573
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10276
10574
|
*/
|
|
10277
10575
|
export interface AutoRAGInternalError extends Error {}
|
|
10278
10576
|
/**
|
|
10279
|
-
* @deprecated
|
|
10280
|
-
*
|
|
10577
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10578
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10281
10579
|
*/
|
|
10282
10580
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10283
10581
|
/**
|
|
10284
|
-
* @deprecated
|
|
10582
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10583
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10285
10584
|
*/
|
|
10286
10585
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10287
10586
|
/**
|
|
10288
|
-
* @deprecated
|
|
10289
|
-
*
|
|
10587
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10588
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10290
10589
|
*/
|
|
10291
10590
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10292
10591
|
export type ComparisonFilter = {
|
|
@@ -10299,9 +10598,8 @@ export type CompoundFilter = {
|
|
|
10299
10598
|
filters: ComparisonFilter[];
|
|
10300
10599
|
};
|
|
10301
10600
|
/**
|
|
10302
|
-
* @deprecated
|
|
10303
|
-
*
|
|
10304
|
-
* @see AiSearchSearchRequest
|
|
10601
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10602
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10305
10603
|
*/
|
|
10306
10604
|
export type AutoRagSearchRequest = {
|
|
10307
10605
|
query: string;
|
|
@@ -10318,18 +10616,16 @@ export type AutoRagSearchRequest = {
|
|
|
10318
10616
|
rewrite_query?: boolean;
|
|
10319
10617
|
};
|
|
10320
10618
|
/**
|
|
10321
|
-
* @deprecated
|
|
10322
|
-
*
|
|
10323
|
-
* @see AiSearchChatCompletionsRequest
|
|
10619
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10620
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10324
10621
|
*/
|
|
10325
10622
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10326
10623
|
stream?: boolean;
|
|
10327
10624
|
system_prompt?: string;
|
|
10328
10625
|
};
|
|
10329
10626
|
/**
|
|
10330
|
-
* @deprecated
|
|
10331
|
-
*
|
|
10332
|
-
* @see AiSearchChatCompletionsRequest
|
|
10627
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10628
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10333
10629
|
*/
|
|
10334
10630
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10335
10631
|
AutoRagAiSearchRequest,
|
|
@@ -10338,9 +10634,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10338
10634
|
stream: true;
|
|
10339
10635
|
};
|
|
10340
10636
|
/**
|
|
10341
|
-
* @deprecated
|
|
10342
|
-
*
|
|
10343
|
-
* @see AiSearchSearchResponse
|
|
10637
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10638
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10344
10639
|
*/
|
|
10345
10640
|
export type AutoRagSearchResponse = {
|
|
10346
10641
|
object: "vector_store.search_results.page";
|
|
@@ -10359,9 +10654,8 @@ export type AutoRagSearchResponse = {
|
|
|
10359
10654
|
next_page: string | null;
|
|
10360
10655
|
};
|
|
10361
10656
|
/**
|
|
10362
|
-
* @deprecated
|
|
10363
|
-
*
|
|
10364
|
-
* @see AiSearchListResponse
|
|
10657
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10658
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10365
10659
|
*/
|
|
10366
10660
|
export type AutoRagListResponse = {
|
|
10367
10661
|
id: string;
|
|
@@ -10373,49 +10667,40 @@ export type AutoRagListResponse = {
|
|
|
10373
10667
|
status: string;
|
|
10374
10668
|
}[];
|
|
10375
10669
|
/**
|
|
10376
|
-
* @deprecated
|
|
10377
|
-
*
|
|
10670
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10671
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10378
10672
|
*/
|
|
10379
10673
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10380
10674
|
response: string;
|
|
10381
10675
|
};
|
|
10382
10676
|
/**
|
|
10383
|
-
* @deprecated
|
|
10384
|
-
*
|
|
10385
|
-
*
|
|
10386
|
-
* Migration guide:
|
|
10387
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10388
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10389
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10390
|
-
*
|
|
10391
|
-
* @see AiSearchAccountService
|
|
10392
|
-
* @see AiSearchInstanceService
|
|
10677
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10678
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10393
10679
|
*/
|
|
10394
10680
|
export declare abstract class AutoRAG {
|
|
10395
10681
|
/**
|
|
10396
|
-
* @deprecated Use
|
|
10397
|
-
*
|
|
10682
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10683
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10398
10684
|
*/
|
|
10399
10685
|
list(): Promise<AutoRagListResponse>;
|
|
10400
10686
|
/**
|
|
10401
|
-
* @deprecated Use
|
|
10402
|
-
*
|
|
10403
|
-
* @see AiSearchInstanceService.search
|
|
10687
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10688
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10404
10689
|
*/
|
|
10405
10690
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10406
10691
|
/**
|
|
10407
|
-
* @deprecated Use
|
|
10408
|
-
*
|
|
10692
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10693
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10409
10694
|
*/
|
|
10410
10695
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10411
10696
|
/**
|
|
10412
|
-
* @deprecated Use
|
|
10413
|
-
*
|
|
10697
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10698
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10414
10699
|
*/
|
|
10415
10700
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10416
10701
|
/**
|
|
10417
|
-
* @deprecated Use
|
|
10418
|
-
*
|
|
10702
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10703
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10419
10704
|
*/
|
|
10420
10705
|
aiSearch(
|
|
10421
10706
|
params: AutoRagAiSearchRequest,
|
|
@@ -12941,14 +13226,13 @@ export interface StreamScopedCaptions {
|
|
|
12941
13226
|
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
|
|
12942
13227
|
* One caption or subtitle file per language is allowed.
|
|
12943
13228
|
* @param language The BCP 47 language tag for the caption or subtitle.
|
|
12944
|
-
* @param
|
|
13229
|
+
* @param input The caption or subtitle stream to upload.
|
|
12945
13230
|
* @returns The created caption entry.
|
|
12946
13231
|
* @throws {NotFoundError} if the video is not found
|
|
12947
13232
|
* @throws {BadRequestError} if the language or file is invalid
|
|
12948
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12949
13233
|
* @throws {InternalError} if an unexpected error occurs
|
|
12950
13234
|
*/
|
|
12951
|
-
upload(language: string,
|
|
13235
|
+
upload(language: string, input: ReadableStream): Promise<StreamCaption>;
|
|
12952
13236
|
/**
|
|
12953
13237
|
* Generate captions or subtitles for the provided language via AI.
|
|
12954
13238
|
* @param language The BCP 47 language tag to generate.
|
|
@@ -13024,17 +13308,16 @@ export interface StreamVideos {
|
|
|
13024
13308
|
export interface StreamWatermarks {
|
|
13025
13309
|
/**
|
|
13026
13310
|
* Generate a new watermark profile
|
|
13027
|
-
* @param
|
|
13311
|
+
* @param input The image stream to upload
|
|
13028
13312
|
* @param params The watermark creation parameters.
|
|
13029
13313
|
* @returns The created watermark profile.
|
|
13030
13314
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13031
13315
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13032
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13033
13316
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13034
13317
|
* @throws {InternalError} if an unexpected error occurs
|
|
13035
13318
|
*/
|
|
13036
13319
|
generate(
|
|
13037
|
-
|
|
13320
|
+
input: ReadableStream,
|
|
13038
13321
|
params: StreamWatermarkCreateParams,
|
|
13039
13322
|
): Promise<StreamWatermark>;
|
|
13040
13323
|
/**
|
|
@@ -13044,7 +13327,6 @@ export interface StreamWatermarks {
|
|
|
13044
13327
|
* @returns The created watermark profile.
|
|
13045
13328
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13046
13329
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13047
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13048
13330
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13049
13331
|
* @throws {InternalError} if an unexpected error occurs
|
|
13050
13332
|
*/
|