@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-03-21/index.ts
CHANGED
|
@@ -3097,6 +3097,11 @@ export interface QueuingStrategyInit {
|
|
|
3097
3097
|
*/
|
|
3098
3098
|
highWaterMark: number;
|
|
3099
3099
|
}
|
|
3100
|
+
export interface TracePreviewInfo {
|
|
3101
|
+
id: string;
|
|
3102
|
+
slug: string;
|
|
3103
|
+
name: string;
|
|
3104
|
+
}
|
|
3100
3105
|
export interface ScriptVersion {
|
|
3101
3106
|
id?: string;
|
|
3102
3107
|
tag?: string;
|
|
@@ -3131,6 +3136,7 @@ export interface TraceItem {
|
|
|
3131
3136
|
readonly dispatchNamespace?: string;
|
|
3132
3137
|
readonly scriptTags?: string[];
|
|
3133
3138
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3139
|
+
readonly preview?: TracePreviewInfo;
|
|
3134
3140
|
readonly durableObjectId?: string;
|
|
3135
3141
|
readonly outcome: string;
|
|
3136
3142
|
readonly executionModel: string;
|
|
@@ -3737,12 +3743,42 @@ export interface Container {
|
|
|
3737
3743
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3738
3744
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3739
3745
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3746
|
+
snapshotDirectory(
|
|
3747
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3748
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3749
|
+
snapshotContainer(
|
|
3750
|
+
options: ContainerSnapshotOptions,
|
|
3751
|
+
): Promise<ContainerSnapshot>;
|
|
3752
|
+
}
|
|
3753
|
+
export interface ContainerDirectorySnapshot {
|
|
3754
|
+
id: string;
|
|
3755
|
+
size: number;
|
|
3756
|
+
dir: string;
|
|
3757
|
+
name?: string;
|
|
3758
|
+
}
|
|
3759
|
+
export interface ContainerDirectorySnapshotOptions {
|
|
3760
|
+
dir: string;
|
|
3761
|
+
name?: string;
|
|
3762
|
+
}
|
|
3763
|
+
export interface ContainerDirectorySnapshotRestoreParams {
|
|
3764
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3765
|
+
mountPoint?: string;
|
|
3766
|
+
}
|
|
3767
|
+
export interface ContainerSnapshot {
|
|
3768
|
+
id: string;
|
|
3769
|
+
size: number;
|
|
3770
|
+
name?: string;
|
|
3771
|
+
}
|
|
3772
|
+
export interface ContainerSnapshotOptions {
|
|
3773
|
+
name?: string;
|
|
3740
3774
|
}
|
|
3741
3775
|
export interface ContainerStartupOptions {
|
|
3742
3776
|
entrypoint?: string[];
|
|
3743
3777
|
enableInternet: boolean;
|
|
3744
3778
|
env?: Record<string, string>;
|
|
3745
3779
|
labels?: Record<string, string>;
|
|
3780
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3781
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3746
3782
|
}
|
|
3747
3783
|
/**
|
|
3748
3784
|
* 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.
|
|
@@ -3869,11 +3905,10 @@ export declare abstract class Performance {
|
|
|
3869
3905
|
*/
|
|
3870
3906
|
toJSON(): object;
|
|
3871
3907
|
}
|
|
3872
|
-
// AI Search
|
|
3908
|
+
// ============ AI Search Error Interfaces ============
|
|
3873
3909
|
export interface AiSearchInternalError extends Error {}
|
|
3874
3910
|
export interface AiSearchNotFoundError extends Error {}
|
|
3875
|
-
|
|
3876
|
-
// AI Search V2 Request Types
|
|
3911
|
+
// ============ AI Search Request Types ============
|
|
3877
3912
|
export type AiSearchSearchRequest = {
|
|
3878
3913
|
messages: Array<{
|
|
3879
3914
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3898,9 +3933,8 @@ export type AiSearchSearchRequest = {
|
|
|
3898
3933
|
[key: string]: unknown;
|
|
3899
3934
|
};
|
|
3900
3935
|
reranking?: {
|
|
3901
|
-
/** Enable reranking (default false) */
|
|
3902
3936
|
enabled?: boolean;
|
|
3903
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3937
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3904
3938
|
/** Match threshold (0-1, default 0.4) */
|
|
3905
3939
|
match_threshold?: number;
|
|
3906
3940
|
[key: string]: unknown;
|
|
@@ -3912,6 +3946,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3912
3946
|
messages: Array<{
|
|
3913
3947
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3914
3948
|
content: string | null;
|
|
3949
|
+
[key: string]: unknown;
|
|
3915
3950
|
}>;
|
|
3916
3951
|
model?: string;
|
|
3917
3952
|
stream?: boolean;
|
|
@@ -3932,7 +3967,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3932
3967
|
};
|
|
3933
3968
|
reranking?: {
|
|
3934
3969
|
enabled?: boolean;
|
|
3935
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3970
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3936
3971
|
match_threshold?: number;
|
|
3937
3972
|
[key: string]: unknown;
|
|
3938
3973
|
};
|
|
@@ -3940,7 +3975,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3940
3975
|
};
|
|
3941
3976
|
[key: string]: unknown;
|
|
3942
3977
|
};
|
|
3943
|
-
// AI Search
|
|
3978
|
+
// ============ AI Search Response Types ============
|
|
3944
3979
|
export type AiSearchSearchResponse = {
|
|
3945
3980
|
search_query: string;
|
|
3946
3981
|
chunks: Array<{
|
|
@@ -3959,26 +3994,65 @@ export type AiSearchSearchResponse = {
|
|
|
3959
3994
|
keyword_score?: number;
|
|
3960
3995
|
/** Vector similarity score (0-1) */
|
|
3961
3996
|
vector_score?: number;
|
|
3997
|
+
[key: string]: unknown;
|
|
3962
3998
|
};
|
|
3963
3999
|
}>;
|
|
3964
4000
|
};
|
|
3965
|
-
export type
|
|
4001
|
+
export type AiSearchChatCompletionsResponse = {
|
|
4002
|
+
id?: string;
|
|
4003
|
+
object?: string;
|
|
4004
|
+
model?: string;
|
|
4005
|
+
choices: Array<{
|
|
4006
|
+
index?: number;
|
|
4007
|
+
message: {
|
|
4008
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4009
|
+
content: string | null;
|
|
4010
|
+
[key: string]: unknown;
|
|
4011
|
+
};
|
|
4012
|
+
[key: string]: unknown;
|
|
4013
|
+
}>;
|
|
4014
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4015
|
+
[key: string]: unknown;
|
|
4016
|
+
};
|
|
4017
|
+
export type AiSearchStatsResponse = {
|
|
4018
|
+
queued?: number;
|
|
4019
|
+
running?: number;
|
|
4020
|
+
completed?: number;
|
|
4021
|
+
error?: number;
|
|
4022
|
+
skipped?: number;
|
|
4023
|
+
outdated?: number;
|
|
4024
|
+
last_activity?: string;
|
|
4025
|
+
};
|
|
4026
|
+
// ============ AI Search Instance Info Types ============
|
|
4027
|
+
export type AiSearchInstanceInfo = {
|
|
3966
4028
|
id: string;
|
|
3967
|
-
|
|
3968
|
-
account_id?: string;
|
|
3969
|
-
account_tag?: string;
|
|
3970
|
-
/** Whether the instance is enabled (default true) */
|
|
3971
|
-
enable?: boolean;
|
|
3972
|
-
type?: "r2" | "web-crawler";
|
|
4029
|
+
type?: "r2" | "web-crawler" | string;
|
|
3973
4030
|
source?: string;
|
|
4031
|
+
paused?: boolean;
|
|
4032
|
+
status?: string;
|
|
4033
|
+
namespace?: string;
|
|
4034
|
+
created_at?: string;
|
|
4035
|
+
modified_at?: string;
|
|
3974
4036
|
[key: string]: unknown;
|
|
3975
|
-
}
|
|
4037
|
+
};
|
|
4038
|
+
export type AiSearchListResponse = {
|
|
4039
|
+
result: AiSearchInstanceInfo[];
|
|
4040
|
+
result_info?: {
|
|
4041
|
+
count: number;
|
|
4042
|
+
page: number;
|
|
4043
|
+
per_page: number;
|
|
4044
|
+
total_count: number;
|
|
4045
|
+
};
|
|
4046
|
+
};
|
|
4047
|
+
// ============ AI Search Config Types ============
|
|
3976
4048
|
export type AiSearchConfig = {
|
|
3977
4049
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3978
4050
|
id: string;
|
|
3979
|
-
type
|
|
3980
|
-
|
|
3981
|
-
|
|
4051
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4052
|
+
type?: "r2" | "web-crawler" | string;
|
|
4053
|
+
/** Source URL (required for web-crawler type). */
|
|
4054
|
+
source?: string;
|
|
4055
|
+
source_params?: unknown;
|
|
3982
4056
|
/** Token ID (UUID format) */
|
|
3983
4057
|
token_id?: string;
|
|
3984
4058
|
ai_gateway_id?: string;
|
|
@@ -3988,54 +4062,307 @@ export type AiSearchConfig = {
|
|
|
3988
4062
|
reranking?: boolean;
|
|
3989
4063
|
embedding_model?: string;
|
|
3990
4064
|
ai_search_model?: string;
|
|
4065
|
+
[key: string]: unknown;
|
|
3991
4066
|
};
|
|
3992
|
-
|
|
4067
|
+
// ============ AI Search Item Types ============
|
|
4068
|
+
export type AiSearchItemInfo = {
|
|
3993
4069
|
id: string;
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4070
|
+
key: string;
|
|
4071
|
+
status:
|
|
4072
|
+
| "completed"
|
|
4073
|
+
| "error"
|
|
4074
|
+
| "skipped"
|
|
4075
|
+
| "queued"
|
|
4076
|
+
| "processing"
|
|
4077
|
+
| "outdated";
|
|
4078
|
+
metadata?: Record<string, unknown>;
|
|
3997
4079
|
[key: string]: unknown;
|
|
3998
4080
|
};
|
|
3999
|
-
|
|
4000
|
-
|
|
4081
|
+
export type AiSearchItemContentResult = {
|
|
4082
|
+
body: ReadableStream;
|
|
4083
|
+
contentType: string;
|
|
4084
|
+
filename: string;
|
|
4085
|
+
size: number;
|
|
4086
|
+
};
|
|
4087
|
+
export type AiSearchUploadItemOptions = {
|
|
4088
|
+
metadata?: Record<string, unknown>;
|
|
4089
|
+
};
|
|
4090
|
+
export type AiSearchListItemsParams = {
|
|
4091
|
+
page?: number;
|
|
4092
|
+
per_page?: number;
|
|
4093
|
+
};
|
|
4094
|
+
export type AiSearchListItemsResponse = {
|
|
4095
|
+
result: AiSearchItemInfo[];
|
|
4096
|
+
result_info?: {
|
|
4097
|
+
count: number;
|
|
4098
|
+
page: number;
|
|
4099
|
+
per_page: number;
|
|
4100
|
+
total_count: number;
|
|
4101
|
+
};
|
|
4102
|
+
};
|
|
4103
|
+
// ============ AI Search Job Types ============
|
|
4104
|
+
export type AiSearchJobInfo = {
|
|
4105
|
+
id: string;
|
|
4106
|
+
source: "user" | "schedule";
|
|
4107
|
+
description?: string;
|
|
4108
|
+
last_seen_at?: string;
|
|
4109
|
+
started_at?: string;
|
|
4110
|
+
ended_at?: string;
|
|
4111
|
+
end_reason?: string;
|
|
4112
|
+
};
|
|
4113
|
+
export type AiSearchJobLog = {
|
|
4114
|
+
id: number;
|
|
4115
|
+
message: string;
|
|
4116
|
+
message_type: number;
|
|
4117
|
+
created_at: number;
|
|
4118
|
+
};
|
|
4119
|
+
export type AiSearchCreateJobParams = {
|
|
4120
|
+
description?: string;
|
|
4121
|
+
};
|
|
4122
|
+
export type AiSearchListJobsParams = {
|
|
4123
|
+
page?: number;
|
|
4124
|
+
per_page?: number;
|
|
4125
|
+
};
|
|
4126
|
+
export type AiSearchListJobsResponse = {
|
|
4127
|
+
result: AiSearchJobInfo[];
|
|
4128
|
+
result_info?: {
|
|
4129
|
+
count: number;
|
|
4130
|
+
page: number;
|
|
4131
|
+
per_page: number;
|
|
4132
|
+
total_count: number;
|
|
4133
|
+
};
|
|
4134
|
+
};
|
|
4135
|
+
export type AiSearchJobLogsParams = {
|
|
4136
|
+
page?: number;
|
|
4137
|
+
per_page?: number;
|
|
4138
|
+
};
|
|
4139
|
+
export type AiSearchJobLogsResponse = {
|
|
4140
|
+
result: AiSearchJobLog[];
|
|
4141
|
+
result_info?: {
|
|
4142
|
+
count: number;
|
|
4143
|
+
page: number;
|
|
4144
|
+
per_page: number;
|
|
4145
|
+
total_count: number;
|
|
4146
|
+
};
|
|
4147
|
+
};
|
|
4148
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4149
|
+
/**
|
|
4150
|
+
* Single item service for an AI Search instance.
|
|
4151
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4152
|
+
*/
|
|
4153
|
+
export declare abstract class AiSearchItem {
|
|
4154
|
+
/** Get metadata about this item. */
|
|
4155
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4156
|
+
/**
|
|
4157
|
+
* Download the item's content.
|
|
4158
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4159
|
+
*/
|
|
4160
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4161
|
+
}
|
|
4162
|
+
/**
|
|
4163
|
+
* Items collection service for an AI Search instance.
|
|
4164
|
+
* Provides list, upload, and access to individual items.
|
|
4165
|
+
*/
|
|
4166
|
+
export declare abstract class AiSearchItems {
|
|
4167
|
+
/** List items in this instance. */
|
|
4168
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4169
|
+
/**
|
|
4170
|
+
* Upload a file as an item.
|
|
4171
|
+
* @param name Filename for the uploaded item.
|
|
4172
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4173
|
+
* @param options Optional metadata to attach to the item.
|
|
4174
|
+
* @returns The created item info.
|
|
4175
|
+
*/
|
|
4176
|
+
upload(
|
|
4177
|
+
name: string,
|
|
4178
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4179
|
+
options?: AiSearchUploadItemOptions,
|
|
4180
|
+
): Promise<AiSearchItemInfo>;
|
|
4181
|
+
/**
|
|
4182
|
+
* Upload a file and poll until processing completes.
|
|
4183
|
+
* @param name Filename for the uploaded item.
|
|
4184
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4185
|
+
* @param options Optional metadata to attach to the item.
|
|
4186
|
+
* @returns The item info after processing completes (or timeout).
|
|
4187
|
+
*/
|
|
4188
|
+
uploadAndPoll(
|
|
4189
|
+
name: string,
|
|
4190
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4191
|
+
options?: AiSearchUploadItemOptions,
|
|
4192
|
+
): Promise<AiSearchItemInfo>;
|
|
4193
|
+
/**
|
|
4194
|
+
* Get an item by ID.
|
|
4195
|
+
* @param itemId The item identifier.
|
|
4196
|
+
* @returns Item service for info, delete, and download operations.
|
|
4197
|
+
*/
|
|
4198
|
+
get(itemId: string): AiSearchItem;
|
|
4199
|
+
/** Delete this item from the instance.
|
|
4200
|
+
* @param itemId The item identifier.
|
|
4201
|
+
*/
|
|
4202
|
+
delete(itemId: string): Promise<void>;
|
|
4203
|
+
}
|
|
4204
|
+
/**
|
|
4205
|
+
* Single job service for an AI Search instance.
|
|
4206
|
+
* Provides info and logs for a specific job.
|
|
4207
|
+
*/
|
|
4208
|
+
export declare abstract class AiSearchJob {
|
|
4209
|
+
/** Get metadata about this job. */
|
|
4210
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4211
|
+
/** Get logs for this job. */
|
|
4212
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4213
|
+
}
|
|
4214
|
+
/**
|
|
4215
|
+
* Jobs collection service for an AI Search instance.
|
|
4216
|
+
* Provides list, create, and access to individual jobs.
|
|
4217
|
+
*/
|
|
4218
|
+
export declare abstract class AiSearchJobs {
|
|
4219
|
+
/** List jobs for this instance. */
|
|
4220
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4221
|
+
/**
|
|
4222
|
+
* Create a new indexing job.
|
|
4223
|
+
* @param params Optional job parameters.
|
|
4224
|
+
* @returns The created job info.
|
|
4225
|
+
*/
|
|
4226
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4227
|
+
/**
|
|
4228
|
+
* Get a job by ID.
|
|
4229
|
+
* @param jobId The job identifier.
|
|
4230
|
+
* @returns Job service for info and logs operations.
|
|
4231
|
+
*/
|
|
4232
|
+
get(jobId: string): AiSearchJob;
|
|
4233
|
+
}
|
|
4234
|
+
// ============ AI Search Binding Classes ============
|
|
4235
|
+
/**
|
|
4236
|
+
* Instance-level AI Search service.
|
|
4237
|
+
*
|
|
4238
|
+
* Used as:
|
|
4239
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4240
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4241
|
+
*
|
|
4242
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4243
|
+
*
|
|
4244
|
+
* @example
|
|
4245
|
+
* ```ts
|
|
4246
|
+
* // Via namespace binding
|
|
4247
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4248
|
+
* const results = await instance.search({
|
|
4249
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4250
|
+
* });
|
|
4251
|
+
*
|
|
4252
|
+
* // Via single instance binding
|
|
4253
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4254
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4255
|
+
* });
|
|
4256
|
+
* ```
|
|
4257
|
+
*/
|
|
4258
|
+
export declare abstract class AiSearchInstance {
|
|
4001
4259
|
/**
|
|
4002
4260
|
* Search the AI Search instance for relevant chunks.
|
|
4003
|
-
* @param params Search request with messages and AI search options
|
|
4004
|
-
* @returns Search response with matching chunks
|
|
4261
|
+
* @param params Search request with messages and optional AI search options.
|
|
4262
|
+
* @returns Search response with matching chunks and search query.
|
|
4005
4263
|
*/
|
|
4006
4264
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4265
|
+
/**
|
|
4266
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4267
|
+
* @param params Chat completions request with stream: true.
|
|
4268
|
+
* @returns ReadableStream of server-sent events.
|
|
4269
|
+
*/
|
|
4270
|
+
chatCompletions(
|
|
4271
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4272
|
+
stream: true;
|
|
4273
|
+
},
|
|
4274
|
+
): Promise<ReadableStream>;
|
|
4007
4275
|
/**
|
|
4008
4276
|
* Generate chat completions with AI Search context.
|
|
4009
|
-
* @param params Chat completions request
|
|
4010
|
-
* @returns
|
|
4277
|
+
* @param params Chat completions request.
|
|
4278
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4011
4279
|
*/
|
|
4012
4280
|
chatCompletions(
|
|
4013
4281
|
params: AiSearchChatCompletionsRequest,
|
|
4014
|
-
): Promise<
|
|
4282
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4015
4283
|
/**
|
|
4016
|
-
*
|
|
4284
|
+
* Update the instance configuration.
|
|
4285
|
+
* @param config Partial configuration to update.
|
|
4286
|
+
* @returns Updated instance info.
|
|
4017
4287
|
*/
|
|
4018
|
-
|
|
4288
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4289
|
+
/** Get metadata about this instance. */
|
|
4290
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4291
|
+
/**
|
|
4292
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4293
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4294
|
+
*/
|
|
4295
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4296
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4297
|
+
get items(): AiSearchItems;
|
|
4298
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4299
|
+
get jobs(): AiSearchJobs;
|
|
4019
4300
|
}
|
|
4020
|
-
|
|
4021
|
-
|
|
4301
|
+
/**
|
|
4302
|
+
* Namespace-level AI Search service.
|
|
4303
|
+
*
|
|
4304
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4305
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4306
|
+
*
|
|
4307
|
+
* @example
|
|
4308
|
+
* ```ts
|
|
4309
|
+
* // Access an instance within the namespace
|
|
4310
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4311
|
+
* const results = await blog.search({
|
|
4312
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4313
|
+
* });
|
|
4314
|
+
*
|
|
4315
|
+
* // List all instances in the namespace
|
|
4316
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4317
|
+
*
|
|
4318
|
+
* // Create a new instance with built-in storage
|
|
4319
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4320
|
+
* id: "tenant-123",
|
|
4321
|
+
* });
|
|
4322
|
+
*
|
|
4323
|
+
* // Upload items into the instance
|
|
4324
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4325
|
+
*
|
|
4326
|
+
* // Delete an instance
|
|
4327
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4328
|
+
* ```
|
|
4329
|
+
*/
|
|
4330
|
+
export declare abstract class AiSearchNamespace {
|
|
4022
4331
|
/**
|
|
4023
|
-
*
|
|
4024
|
-
* @
|
|
4332
|
+
* Get an instance by name within the bound namespace.
|
|
4333
|
+
* @param name Instance name.
|
|
4334
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4335
|
+
*/
|
|
4336
|
+
get(name: string): AiSearchInstance;
|
|
4337
|
+
/**
|
|
4338
|
+
* List all instances in the bound namespace.
|
|
4339
|
+
* @returns Array of instance metadata.
|
|
4025
4340
|
*/
|
|
4026
4341
|
list(): Promise<AiSearchListResponse>;
|
|
4027
4342
|
/**
|
|
4028
|
-
*
|
|
4029
|
-
* @param
|
|
4030
|
-
* @returns Instance service for
|
|
4343
|
+
* Create a new instance within the bound namespace.
|
|
4344
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4345
|
+
* @returns Instance service for the newly created instance.
|
|
4346
|
+
*
|
|
4347
|
+
* @example
|
|
4348
|
+
* ```ts
|
|
4349
|
+
* // Create with built-in storage (upload items manually)
|
|
4350
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4351
|
+
*
|
|
4352
|
+
* // Create with web crawler source
|
|
4353
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4354
|
+
* id: "docs-search",
|
|
4355
|
+
* type: "web-crawler",
|
|
4356
|
+
* source: "https://developers.cloudflare.com",
|
|
4357
|
+
* });
|
|
4358
|
+
* ```
|
|
4031
4359
|
*/
|
|
4032
|
-
|
|
4360
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4033
4361
|
/**
|
|
4034
|
-
*
|
|
4035
|
-
* @param
|
|
4036
|
-
* @returns Instance service for performing operations
|
|
4362
|
+
* Delete an instance from the bound namespace.
|
|
4363
|
+
* @param name Instance name to delete.
|
|
4037
4364
|
*/
|
|
4038
|
-
|
|
4365
|
+
delete(name: string): Promise<void>;
|
|
4039
4366
|
}
|
|
4040
4367
|
export type AiImageClassificationInput = {
|
|
4041
4368
|
image: number[];
|
|
@@ -10036,6 +10363,7 @@ export type AiOptions = {
|
|
|
10036
10363
|
returnRawResponse?: boolean;
|
|
10037
10364
|
prefix?: string;
|
|
10038
10365
|
extraHeaders?: object;
|
|
10366
|
+
signal?: AbortSignal;
|
|
10039
10367
|
};
|
|
10040
10368
|
export type AiModelsSearchParams = {
|
|
10041
10369
|
author?: string;
|
|
@@ -10081,46 +10409,16 @@ export declare abstract class Ai<
|
|
|
10081
10409
|
aiGatewayLogId: string | null;
|
|
10082
10410
|
gateway(gatewayId: string): AiGateway;
|
|
10083
10411
|
/**
|
|
10084
|
-
*
|
|
10085
|
-
*
|
|
10086
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10087
|
-
* - Account-level operations: `list()`, `create()`
|
|
10088
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10089
|
-
*
|
|
10090
|
-
* @example
|
|
10091
|
-
* ```typescript
|
|
10092
|
-
* // List all AI Search instances
|
|
10093
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10094
|
-
*
|
|
10095
|
-
* // Search an instance
|
|
10096
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10097
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10098
|
-
* ai_search_options: {
|
|
10099
|
-
* retrieval: { max_num_results: 10 }
|
|
10100
|
-
* }
|
|
10101
|
-
* });
|
|
10102
|
-
*
|
|
10103
|
-
* // Generate chat completions with AI Search context
|
|
10104
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10105
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10106
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10107
|
-
* });
|
|
10108
|
-
* ```
|
|
10412
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10413
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10109
10414
|
*/
|
|
10110
|
-
aiSearch():
|
|
10415
|
+
aiSearch(): AiSearchNamespace;
|
|
10111
10416
|
/**
|
|
10112
10417
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10113
|
-
* Use `
|
|
10114
|
-
*
|
|
10115
|
-
* Migration guide:
|
|
10116
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10117
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10118
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10418
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10419
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10119
10420
|
*
|
|
10120
|
-
*
|
|
10121
|
-
*
|
|
10122
|
-
* @see AiSearchAccountService
|
|
10123
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10421
|
+
* @param autoragId Instance ID
|
|
10124
10422
|
*/
|
|
10125
10423
|
autorag(autoragId: string): AutoRAG;
|
|
10126
10424
|
run<
|
|
@@ -10279,22 +10577,23 @@ export declare abstract class AiGateway {
|
|
|
10279
10577
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10280
10578
|
}
|
|
10281
10579
|
/**
|
|
10282
|
-
* @deprecated
|
|
10283
|
-
*
|
|
10580
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10581
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10284
10582
|
*/
|
|
10285
10583
|
export interface AutoRAGInternalError extends Error {}
|
|
10286
10584
|
/**
|
|
10287
|
-
* @deprecated
|
|
10288
|
-
*
|
|
10585
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10586
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10289
10587
|
*/
|
|
10290
10588
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10291
10589
|
/**
|
|
10292
|
-
* @deprecated
|
|
10590
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10591
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10293
10592
|
*/
|
|
10294
10593
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10295
10594
|
/**
|
|
10296
|
-
* @deprecated
|
|
10297
|
-
*
|
|
10595
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10596
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10298
10597
|
*/
|
|
10299
10598
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10300
10599
|
export type ComparisonFilter = {
|
|
@@ -10307,9 +10606,8 @@ export type CompoundFilter = {
|
|
|
10307
10606
|
filters: ComparisonFilter[];
|
|
10308
10607
|
};
|
|
10309
10608
|
/**
|
|
10310
|
-
* @deprecated
|
|
10311
|
-
*
|
|
10312
|
-
* @see AiSearchSearchRequest
|
|
10609
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10610
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10313
10611
|
*/
|
|
10314
10612
|
export type AutoRagSearchRequest = {
|
|
10315
10613
|
query: string;
|
|
@@ -10326,18 +10624,16 @@ export type AutoRagSearchRequest = {
|
|
|
10326
10624
|
rewrite_query?: boolean;
|
|
10327
10625
|
};
|
|
10328
10626
|
/**
|
|
10329
|
-
* @deprecated
|
|
10330
|
-
*
|
|
10331
|
-
* @see AiSearchChatCompletionsRequest
|
|
10627
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10628
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10332
10629
|
*/
|
|
10333
10630
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10334
10631
|
stream?: boolean;
|
|
10335
10632
|
system_prompt?: string;
|
|
10336
10633
|
};
|
|
10337
10634
|
/**
|
|
10338
|
-
* @deprecated
|
|
10339
|
-
*
|
|
10340
|
-
* @see AiSearchChatCompletionsRequest
|
|
10635
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10636
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10341
10637
|
*/
|
|
10342
10638
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10343
10639
|
AutoRagAiSearchRequest,
|
|
@@ -10346,9 +10642,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10346
10642
|
stream: true;
|
|
10347
10643
|
};
|
|
10348
10644
|
/**
|
|
10349
|
-
* @deprecated
|
|
10350
|
-
*
|
|
10351
|
-
* @see AiSearchSearchResponse
|
|
10645
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10646
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10352
10647
|
*/
|
|
10353
10648
|
export type AutoRagSearchResponse = {
|
|
10354
10649
|
object: "vector_store.search_results.page";
|
|
@@ -10367,9 +10662,8 @@ export type AutoRagSearchResponse = {
|
|
|
10367
10662
|
next_page: string | null;
|
|
10368
10663
|
};
|
|
10369
10664
|
/**
|
|
10370
|
-
* @deprecated
|
|
10371
|
-
*
|
|
10372
|
-
* @see AiSearchListResponse
|
|
10665
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10666
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10373
10667
|
*/
|
|
10374
10668
|
export type AutoRagListResponse = {
|
|
10375
10669
|
id: string;
|
|
@@ -10381,49 +10675,40 @@ export type AutoRagListResponse = {
|
|
|
10381
10675
|
status: string;
|
|
10382
10676
|
}[];
|
|
10383
10677
|
/**
|
|
10384
|
-
* @deprecated
|
|
10385
|
-
*
|
|
10678
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10679
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10386
10680
|
*/
|
|
10387
10681
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10388
10682
|
response: string;
|
|
10389
10683
|
};
|
|
10390
10684
|
/**
|
|
10391
|
-
* @deprecated
|
|
10392
|
-
*
|
|
10393
|
-
*
|
|
10394
|
-
* Migration guide:
|
|
10395
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10396
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10397
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10398
|
-
*
|
|
10399
|
-
* @see AiSearchAccountService
|
|
10400
|
-
* @see AiSearchInstanceService
|
|
10685
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10686
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10401
10687
|
*/
|
|
10402
10688
|
export declare abstract class AutoRAG {
|
|
10403
10689
|
/**
|
|
10404
|
-
* @deprecated Use
|
|
10405
|
-
*
|
|
10690
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10691
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10406
10692
|
*/
|
|
10407
10693
|
list(): Promise<AutoRagListResponse>;
|
|
10408
10694
|
/**
|
|
10409
|
-
* @deprecated Use
|
|
10410
|
-
*
|
|
10411
|
-
* @see AiSearchInstanceService.search
|
|
10695
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10696
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10412
10697
|
*/
|
|
10413
10698
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10414
10699
|
/**
|
|
10415
|
-
* @deprecated Use
|
|
10416
|
-
*
|
|
10700
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10701
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10417
10702
|
*/
|
|
10418
10703
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10419
10704
|
/**
|
|
10420
|
-
* @deprecated Use
|
|
10421
|
-
*
|
|
10705
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10706
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10422
10707
|
*/
|
|
10423
10708
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10424
10709
|
/**
|
|
10425
|
-
* @deprecated Use
|
|
10426
|
-
*
|
|
10710
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10711
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10427
10712
|
*/
|
|
10428
10713
|
aiSearch(
|
|
10429
10714
|
params: AutoRagAiSearchRequest,
|
|
@@ -12949,14 +13234,13 @@ export interface StreamScopedCaptions {
|
|
|
12949
13234
|
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
|
|
12950
13235
|
* One caption or subtitle file per language is allowed.
|
|
12951
13236
|
* @param language The BCP 47 language tag for the caption or subtitle.
|
|
12952
|
-
* @param
|
|
13237
|
+
* @param input The caption or subtitle stream to upload.
|
|
12953
13238
|
* @returns The created caption entry.
|
|
12954
13239
|
* @throws {NotFoundError} if the video is not found
|
|
12955
13240
|
* @throws {BadRequestError} if the language or file is invalid
|
|
12956
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12957
13241
|
* @throws {InternalError} if an unexpected error occurs
|
|
12958
13242
|
*/
|
|
12959
|
-
upload(language: string,
|
|
13243
|
+
upload(language: string, input: ReadableStream): Promise<StreamCaption>;
|
|
12960
13244
|
/**
|
|
12961
13245
|
* Generate captions or subtitles for the provided language via AI.
|
|
12962
13246
|
* @param language The BCP 47 language tag to generate.
|
|
@@ -13032,17 +13316,16 @@ export interface StreamVideos {
|
|
|
13032
13316
|
export interface StreamWatermarks {
|
|
13033
13317
|
/**
|
|
13034
13318
|
* Generate a new watermark profile
|
|
13035
|
-
* @param
|
|
13319
|
+
* @param input The image stream to upload
|
|
13036
13320
|
* @param params The watermark creation parameters.
|
|
13037
13321
|
* @returns The created watermark profile.
|
|
13038
13322
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13039
13323
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13040
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13041
13324
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13042
13325
|
* @throws {InternalError} if an unexpected error occurs
|
|
13043
13326
|
*/
|
|
13044
13327
|
generate(
|
|
13045
|
-
|
|
13328
|
+
input: ReadableStream,
|
|
13046
13329
|
params: StreamWatermarkCreateParams,
|
|
13047
13330
|
): Promise<StreamWatermark>;
|
|
13048
13331
|
/**
|
|
@@ -13052,7 +13335,6 @@ export interface StreamWatermarks {
|
|
|
13052
13335
|
* @returns The created watermark profile.
|
|
13053
13336
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13054
13337
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13055
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13056
13338
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13057
13339
|
* @throws {InternalError} if an unexpected error occurs
|
|
13058
13340
|
*/
|