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