@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.d.ts
CHANGED
|
@@ -3083,6 +3083,11 @@ interface QueuingStrategyInit {
|
|
|
3083
3083
|
*/
|
|
3084
3084
|
highWaterMark: number;
|
|
3085
3085
|
}
|
|
3086
|
+
interface TracePreviewInfo {
|
|
3087
|
+
id: string;
|
|
3088
|
+
slug: string;
|
|
3089
|
+
name: string;
|
|
3090
|
+
}
|
|
3086
3091
|
interface ScriptVersion {
|
|
3087
3092
|
id?: string;
|
|
3088
3093
|
tag?: string;
|
|
@@ -3117,6 +3122,7 @@ interface TraceItem {
|
|
|
3117
3122
|
readonly dispatchNamespace?: string;
|
|
3118
3123
|
readonly scriptTags?: string[];
|
|
3119
3124
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3125
|
+
readonly preview?: TracePreviewInfo;
|
|
3120
3126
|
readonly durableObjectId?: string;
|
|
3121
3127
|
readonly outcome: string;
|
|
3122
3128
|
readonly executionModel: string;
|
|
@@ -3723,12 +3729,42 @@ interface Container {
|
|
|
3723
3729
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3724
3730
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3725
3731
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3732
|
+
snapshotDirectory(
|
|
3733
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3734
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3735
|
+
snapshotContainer(
|
|
3736
|
+
options: ContainerSnapshotOptions,
|
|
3737
|
+
): Promise<ContainerSnapshot>;
|
|
3738
|
+
}
|
|
3739
|
+
interface ContainerDirectorySnapshot {
|
|
3740
|
+
id: string;
|
|
3741
|
+
size: number;
|
|
3742
|
+
dir: string;
|
|
3743
|
+
name?: string;
|
|
3744
|
+
}
|
|
3745
|
+
interface ContainerDirectorySnapshotOptions {
|
|
3746
|
+
dir: string;
|
|
3747
|
+
name?: string;
|
|
3748
|
+
}
|
|
3749
|
+
interface ContainerDirectorySnapshotRestoreParams {
|
|
3750
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3751
|
+
mountPoint?: string;
|
|
3752
|
+
}
|
|
3753
|
+
interface ContainerSnapshot {
|
|
3754
|
+
id: string;
|
|
3755
|
+
size: number;
|
|
3756
|
+
name?: string;
|
|
3757
|
+
}
|
|
3758
|
+
interface ContainerSnapshotOptions {
|
|
3759
|
+
name?: string;
|
|
3726
3760
|
}
|
|
3727
3761
|
interface ContainerStartupOptions {
|
|
3728
3762
|
entrypoint?: string[];
|
|
3729
3763
|
enableInternet: boolean;
|
|
3730
3764
|
env?: Record<string, string>;
|
|
3731
3765
|
labels?: Record<string, string>;
|
|
3766
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3767
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3732
3768
|
}
|
|
3733
3769
|
/**
|
|
3734
3770
|
* 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.
|
|
@@ -3855,11 +3891,10 @@ declare abstract class Performance {
|
|
|
3855
3891
|
*/
|
|
3856
3892
|
toJSON(): object;
|
|
3857
3893
|
}
|
|
3858
|
-
// AI Search
|
|
3894
|
+
// ============ AI Search Error Interfaces ============
|
|
3859
3895
|
interface AiSearchInternalError extends Error {}
|
|
3860
3896
|
interface AiSearchNotFoundError extends Error {}
|
|
3861
|
-
|
|
3862
|
-
// AI Search V2 Request Types
|
|
3897
|
+
// ============ AI Search Request Types ============
|
|
3863
3898
|
type AiSearchSearchRequest = {
|
|
3864
3899
|
messages: Array<{
|
|
3865
3900
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3884,9 +3919,8 @@ type AiSearchSearchRequest = {
|
|
|
3884
3919
|
[key: string]: unknown;
|
|
3885
3920
|
};
|
|
3886
3921
|
reranking?: {
|
|
3887
|
-
/** Enable reranking (default false) */
|
|
3888
3922
|
enabled?: boolean;
|
|
3889
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3923
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3890
3924
|
/** Match threshold (0-1, default 0.4) */
|
|
3891
3925
|
match_threshold?: number;
|
|
3892
3926
|
[key: string]: unknown;
|
|
@@ -3898,6 +3932,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3898
3932
|
messages: Array<{
|
|
3899
3933
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3900
3934
|
content: string | null;
|
|
3935
|
+
[key: string]: unknown;
|
|
3901
3936
|
}>;
|
|
3902
3937
|
model?: string;
|
|
3903
3938
|
stream?: boolean;
|
|
@@ -3918,7 +3953,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3918
3953
|
};
|
|
3919
3954
|
reranking?: {
|
|
3920
3955
|
enabled?: boolean;
|
|
3921
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3956
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3922
3957
|
match_threshold?: number;
|
|
3923
3958
|
[key: string]: unknown;
|
|
3924
3959
|
};
|
|
@@ -3926,7 +3961,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3926
3961
|
};
|
|
3927
3962
|
[key: string]: unknown;
|
|
3928
3963
|
};
|
|
3929
|
-
// AI Search
|
|
3964
|
+
// ============ AI Search Response Types ============
|
|
3930
3965
|
type AiSearchSearchResponse = {
|
|
3931
3966
|
search_query: string;
|
|
3932
3967
|
chunks: Array<{
|
|
@@ -3945,26 +3980,65 @@ type AiSearchSearchResponse = {
|
|
|
3945
3980
|
keyword_score?: number;
|
|
3946
3981
|
/** Vector similarity score (0-1) */
|
|
3947
3982
|
vector_score?: number;
|
|
3983
|
+
[key: string]: unknown;
|
|
3948
3984
|
};
|
|
3949
3985
|
}>;
|
|
3950
3986
|
};
|
|
3951
|
-
type
|
|
3987
|
+
type AiSearchChatCompletionsResponse = {
|
|
3988
|
+
id?: string;
|
|
3989
|
+
object?: string;
|
|
3990
|
+
model?: string;
|
|
3991
|
+
choices: Array<{
|
|
3992
|
+
index?: number;
|
|
3993
|
+
message: {
|
|
3994
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3995
|
+
content: string | null;
|
|
3996
|
+
[key: string]: unknown;
|
|
3997
|
+
};
|
|
3998
|
+
[key: string]: unknown;
|
|
3999
|
+
}>;
|
|
4000
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4001
|
+
[key: string]: unknown;
|
|
4002
|
+
};
|
|
4003
|
+
type AiSearchStatsResponse = {
|
|
4004
|
+
queued?: number;
|
|
4005
|
+
running?: number;
|
|
4006
|
+
completed?: number;
|
|
4007
|
+
error?: number;
|
|
4008
|
+
skipped?: number;
|
|
4009
|
+
outdated?: number;
|
|
4010
|
+
last_activity?: string;
|
|
4011
|
+
};
|
|
4012
|
+
// ============ AI Search Instance Info Types ============
|
|
4013
|
+
type AiSearchInstanceInfo = {
|
|
3952
4014
|
id: string;
|
|
3953
|
-
|
|
3954
|
-
account_id?: string;
|
|
3955
|
-
account_tag?: string;
|
|
3956
|
-
/** Whether the instance is enabled (default true) */
|
|
3957
|
-
enable?: boolean;
|
|
3958
|
-
type?: "r2" | "web-crawler";
|
|
4015
|
+
type?: "r2" | "web-crawler" | string;
|
|
3959
4016
|
source?: string;
|
|
4017
|
+
paused?: boolean;
|
|
4018
|
+
status?: string;
|
|
4019
|
+
namespace?: string;
|
|
4020
|
+
created_at?: string;
|
|
4021
|
+
modified_at?: string;
|
|
3960
4022
|
[key: string]: unknown;
|
|
3961
|
-
}
|
|
4023
|
+
};
|
|
4024
|
+
type AiSearchListResponse = {
|
|
4025
|
+
result: AiSearchInstanceInfo[];
|
|
4026
|
+
result_info?: {
|
|
4027
|
+
count: number;
|
|
4028
|
+
page: number;
|
|
4029
|
+
per_page: number;
|
|
4030
|
+
total_count: number;
|
|
4031
|
+
};
|
|
4032
|
+
};
|
|
4033
|
+
// ============ AI Search Config Types ============
|
|
3962
4034
|
type AiSearchConfig = {
|
|
3963
4035
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3964
4036
|
id: string;
|
|
3965
|
-
type
|
|
3966
|
-
|
|
3967
|
-
|
|
4037
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4038
|
+
type?: "r2" | "web-crawler" | string;
|
|
4039
|
+
/** Source URL (required for web-crawler type). */
|
|
4040
|
+
source?: string;
|
|
4041
|
+
source_params?: unknown;
|
|
3968
4042
|
/** Token ID (UUID format) */
|
|
3969
4043
|
token_id?: string;
|
|
3970
4044
|
ai_gateway_id?: string;
|
|
@@ -3974,54 +4048,307 @@ type AiSearchConfig = {
|
|
|
3974
4048
|
reranking?: boolean;
|
|
3975
4049
|
embedding_model?: string;
|
|
3976
4050
|
ai_search_model?: string;
|
|
4051
|
+
[key: string]: unknown;
|
|
3977
4052
|
};
|
|
3978
|
-
|
|
4053
|
+
// ============ AI Search Item Types ============
|
|
4054
|
+
type AiSearchItemInfo = {
|
|
3979
4055
|
id: string;
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
4056
|
+
key: string;
|
|
4057
|
+
status:
|
|
4058
|
+
| "completed"
|
|
4059
|
+
| "error"
|
|
4060
|
+
| "skipped"
|
|
4061
|
+
| "queued"
|
|
4062
|
+
| "processing"
|
|
4063
|
+
| "outdated";
|
|
4064
|
+
metadata?: Record<string, unknown>;
|
|
3983
4065
|
[key: string]: unknown;
|
|
3984
4066
|
};
|
|
3985
|
-
|
|
3986
|
-
|
|
4067
|
+
type AiSearchItemContentResult = {
|
|
4068
|
+
body: ReadableStream;
|
|
4069
|
+
contentType: string;
|
|
4070
|
+
filename: string;
|
|
4071
|
+
size: number;
|
|
4072
|
+
};
|
|
4073
|
+
type AiSearchUploadItemOptions = {
|
|
4074
|
+
metadata?: Record<string, unknown>;
|
|
4075
|
+
};
|
|
4076
|
+
type AiSearchListItemsParams = {
|
|
4077
|
+
page?: number;
|
|
4078
|
+
per_page?: number;
|
|
4079
|
+
};
|
|
4080
|
+
type AiSearchListItemsResponse = {
|
|
4081
|
+
result: AiSearchItemInfo[];
|
|
4082
|
+
result_info?: {
|
|
4083
|
+
count: number;
|
|
4084
|
+
page: number;
|
|
4085
|
+
per_page: number;
|
|
4086
|
+
total_count: number;
|
|
4087
|
+
};
|
|
4088
|
+
};
|
|
4089
|
+
// ============ AI Search Job Types ============
|
|
4090
|
+
type AiSearchJobInfo = {
|
|
4091
|
+
id: string;
|
|
4092
|
+
source: "user" | "schedule";
|
|
4093
|
+
description?: string;
|
|
4094
|
+
last_seen_at?: string;
|
|
4095
|
+
started_at?: string;
|
|
4096
|
+
ended_at?: string;
|
|
4097
|
+
end_reason?: string;
|
|
4098
|
+
};
|
|
4099
|
+
type AiSearchJobLog = {
|
|
4100
|
+
id: number;
|
|
4101
|
+
message: string;
|
|
4102
|
+
message_type: number;
|
|
4103
|
+
created_at: number;
|
|
4104
|
+
};
|
|
4105
|
+
type AiSearchCreateJobParams = {
|
|
4106
|
+
description?: string;
|
|
4107
|
+
};
|
|
4108
|
+
type AiSearchListJobsParams = {
|
|
4109
|
+
page?: number;
|
|
4110
|
+
per_page?: number;
|
|
4111
|
+
};
|
|
4112
|
+
type AiSearchListJobsResponse = {
|
|
4113
|
+
result: AiSearchJobInfo[];
|
|
4114
|
+
result_info?: {
|
|
4115
|
+
count: number;
|
|
4116
|
+
page: number;
|
|
4117
|
+
per_page: number;
|
|
4118
|
+
total_count: number;
|
|
4119
|
+
};
|
|
4120
|
+
};
|
|
4121
|
+
type AiSearchJobLogsParams = {
|
|
4122
|
+
page?: number;
|
|
4123
|
+
per_page?: number;
|
|
4124
|
+
};
|
|
4125
|
+
type AiSearchJobLogsResponse = {
|
|
4126
|
+
result: AiSearchJobLog[];
|
|
4127
|
+
result_info?: {
|
|
4128
|
+
count: number;
|
|
4129
|
+
page: number;
|
|
4130
|
+
per_page: number;
|
|
4131
|
+
total_count: number;
|
|
4132
|
+
};
|
|
4133
|
+
};
|
|
4134
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4135
|
+
/**
|
|
4136
|
+
* Single item service for an AI Search instance.
|
|
4137
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4138
|
+
*/
|
|
4139
|
+
declare abstract class AiSearchItem {
|
|
4140
|
+
/** Get metadata about this item. */
|
|
4141
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4142
|
+
/**
|
|
4143
|
+
* Download the item's content.
|
|
4144
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4145
|
+
*/
|
|
4146
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4147
|
+
}
|
|
4148
|
+
/**
|
|
4149
|
+
* Items collection service for an AI Search instance.
|
|
4150
|
+
* Provides list, upload, and access to individual items.
|
|
4151
|
+
*/
|
|
4152
|
+
declare abstract class AiSearchItems {
|
|
4153
|
+
/** List items in this instance. */
|
|
4154
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4155
|
+
/**
|
|
4156
|
+
* Upload a file as an item.
|
|
4157
|
+
* @param name Filename for the uploaded item.
|
|
4158
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4159
|
+
* @param options Optional metadata to attach to the item.
|
|
4160
|
+
* @returns The created item info.
|
|
4161
|
+
*/
|
|
4162
|
+
upload(
|
|
4163
|
+
name: string,
|
|
4164
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4165
|
+
options?: AiSearchUploadItemOptions,
|
|
4166
|
+
): Promise<AiSearchItemInfo>;
|
|
4167
|
+
/**
|
|
4168
|
+
* Upload a file and poll until processing completes.
|
|
4169
|
+
* @param name Filename for the uploaded item.
|
|
4170
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4171
|
+
* @param options Optional metadata to attach to the item.
|
|
4172
|
+
* @returns The item info after processing completes (or timeout).
|
|
4173
|
+
*/
|
|
4174
|
+
uploadAndPoll(
|
|
4175
|
+
name: string,
|
|
4176
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4177
|
+
options?: AiSearchUploadItemOptions,
|
|
4178
|
+
): Promise<AiSearchItemInfo>;
|
|
4179
|
+
/**
|
|
4180
|
+
* Get an item by ID.
|
|
4181
|
+
* @param itemId The item identifier.
|
|
4182
|
+
* @returns Item service for info, delete, and download operations.
|
|
4183
|
+
*/
|
|
4184
|
+
get(itemId: string): AiSearchItem;
|
|
4185
|
+
/** Delete this item from the instance.
|
|
4186
|
+
* @param itemId The item identifier.
|
|
4187
|
+
*/
|
|
4188
|
+
delete(itemId: string): Promise<void>;
|
|
4189
|
+
}
|
|
4190
|
+
/**
|
|
4191
|
+
* Single job service for an AI Search instance.
|
|
4192
|
+
* Provides info and logs for a specific job.
|
|
4193
|
+
*/
|
|
4194
|
+
declare abstract class AiSearchJob {
|
|
4195
|
+
/** Get metadata about this job. */
|
|
4196
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4197
|
+
/** Get logs for this job. */
|
|
4198
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4199
|
+
}
|
|
4200
|
+
/**
|
|
4201
|
+
* Jobs collection service for an AI Search instance.
|
|
4202
|
+
* Provides list, create, and access to individual jobs.
|
|
4203
|
+
*/
|
|
4204
|
+
declare abstract class AiSearchJobs {
|
|
4205
|
+
/** List jobs for this instance. */
|
|
4206
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4207
|
+
/**
|
|
4208
|
+
* Create a new indexing job.
|
|
4209
|
+
* @param params Optional job parameters.
|
|
4210
|
+
* @returns The created job info.
|
|
4211
|
+
*/
|
|
4212
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4213
|
+
/**
|
|
4214
|
+
* Get a job by ID.
|
|
4215
|
+
* @param jobId The job identifier.
|
|
4216
|
+
* @returns Job service for info and logs operations.
|
|
4217
|
+
*/
|
|
4218
|
+
get(jobId: string): AiSearchJob;
|
|
4219
|
+
}
|
|
4220
|
+
// ============ AI Search Binding Classes ============
|
|
4221
|
+
/**
|
|
4222
|
+
* Instance-level AI Search service.
|
|
4223
|
+
*
|
|
4224
|
+
* Used as:
|
|
4225
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4226
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4227
|
+
*
|
|
4228
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4229
|
+
*
|
|
4230
|
+
* @example
|
|
4231
|
+
* ```ts
|
|
4232
|
+
* // Via namespace binding
|
|
4233
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4234
|
+
* const results = await instance.search({
|
|
4235
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4236
|
+
* });
|
|
4237
|
+
*
|
|
4238
|
+
* // Via single instance binding
|
|
4239
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4240
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4241
|
+
* });
|
|
4242
|
+
* ```
|
|
4243
|
+
*/
|
|
4244
|
+
declare abstract class AiSearchInstance {
|
|
3987
4245
|
/**
|
|
3988
4246
|
* Search the AI Search instance for relevant chunks.
|
|
3989
|
-
* @param params Search request with messages and AI search options
|
|
3990
|
-
* @returns Search response with matching chunks
|
|
4247
|
+
* @param params Search request with messages and optional AI search options.
|
|
4248
|
+
* @returns Search response with matching chunks and search query.
|
|
3991
4249
|
*/
|
|
3992
4250
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4251
|
+
/**
|
|
4252
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4253
|
+
* @param params Chat completions request with stream: true.
|
|
4254
|
+
* @returns ReadableStream of server-sent events.
|
|
4255
|
+
*/
|
|
4256
|
+
chatCompletions(
|
|
4257
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4258
|
+
stream: true;
|
|
4259
|
+
},
|
|
4260
|
+
): Promise<ReadableStream>;
|
|
3993
4261
|
/**
|
|
3994
4262
|
* Generate chat completions with AI Search context.
|
|
3995
|
-
* @param params Chat completions request
|
|
3996
|
-
* @returns
|
|
4263
|
+
* @param params Chat completions request.
|
|
4264
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
3997
4265
|
*/
|
|
3998
4266
|
chatCompletions(
|
|
3999
4267
|
params: AiSearchChatCompletionsRequest,
|
|
4000
|
-
): Promise<
|
|
4268
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4001
4269
|
/**
|
|
4002
|
-
*
|
|
4270
|
+
* Update the instance configuration.
|
|
4271
|
+
* @param config Partial configuration to update.
|
|
4272
|
+
* @returns Updated instance info.
|
|
4003
4273
|
*/
|
|
4004
|
-
|
|
4274
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4275
|
+
/** Get metadata about this instance. */
|
|
4276
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4277
|
+
/**
|
|
4278
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4279
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4280
|
+
*/
|
|
4281
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4282
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4283
|
+
get items(): AiSearchItems;
|
|
4284
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4285
|
+
get jobs(): AiSearchJobs;
|
|
4005
4286
|
}
|
|
4006
|
-
|
|
4007
|
-
|
|
4287
|
+
/**
|
|
4288
|
+
* Namespace-level AI Search service.
|
|
4289
|
+
*
|
|
4290
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4291
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4292
|
+
*
|
|
4293
|
+
* @example
|
|
4294
|
+
* ```ts
|
|
4295
|
+
* // Access an instance within the namespace
|
|
4296
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4297
|
+
* const results = await blog.search({
|
|
4298
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4299
|
+
* });
|
|
4300
|
+
*
|
|
4301
|
+
* // List all instances in the namespace
|
|
4302
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4303
|
+
*
|
|
4304
|
+
* // Create a new instance with built-in storage
|
|
4305
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4306
|
+
* id: "tenant-123",
|
|
4307
|
+
* });
|
|
4308
|
+
*
|
|
4309
|
+
* // Upload items into the instance
|
|
4310
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4311
|
+
*
|
|
4312
|
+
* // Delete an instance
|
|
4313
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4314
|
+
* ```
|
|
4315
|
+
*/
|
|
4316
|
+
declare abstract class AiSearchNamespace {
|
|
4008
4317
|
/**
|
|
4009
|
-
*
|
|
4010
|
-
* @
|
|
4318
|
+
* Get an instance by name within the bound namespace.
|
|
4319
|
+
* @param name Instance name.
|
|
4320
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4321
|
+
*/
|
|
4322
|
+
get(name: string): AiSearchInstance;
|
|
4323
|
+
/**
|
|
4324
|
+
* List all instances in the bound namespace.
|
|
4325
|
+
* @returns Array of instance metadata.
|
|
4011
4326
|
*/
|
|
4012
4327
|
list(): Promise<AiSearchListResponse>;
|
|
4013
4328
|
/**
|
|
4014
|
-
*
|
|
4015
|
-
* @param
|
|
4016
|
-
* @returns Instance service for
|
|
4329
|
+
* Create a new instance within the bound namespace.
|
|
4330
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4331
|
+
* @returns Instance service for the newly created instance.
|
|
4332
|
+
*
|
|
4333
|
+
* @example
|
|
4334
|
+
* ```ts
|
|
4335
|
+
* // Create with built-in storage (upload items manually)
|
|
4336
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4337
|
+
*
|
|
4338
|
+
* // Create with web crawler source
|
|
4339
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4340
|
+
* id: "docs-search",
|
|
4341
|
+
* type: "web-crawler",
|
|
4342
|
+
* source: "https://developers.cloudflare.com",
|
|
4343
|
+
* });
|
|
4344
|
+
* ```
|
|
4017
4345
|
*/
|
|
4018
|
-
|
|
4346
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4019
4347
|
/**
|
|
4020
|
-
*
|
|
4021
|
-
* @param
|
|
4022
|
-
* @returns Instance service for performing operations
|
|
4348
|
+
* Delete an instance from the bound namespace.
|
|
4349
|
+
* @param name Instance name to delete.
|
|
4023
4350
|
*/
|
|
4024
|
-
|
|
4351
|
+
delete(name: string): Promise<void>;
|
|
4025
4352
|
}
|
|
4026
4353
|
type AiImageClassificationInput = {
|
|
4027
4354
|
image: number[];
|
|
@@ -10019,6 +10346,7 @@ type AiOptions = {
|
|
|
10019
10346
|
returnRawResponse?: boolean;
|
|
10020
10347
|
prefix?: string;
|
|
10021
10348
|
extraHeaders?: object;
|
|
10349
|
+
signal?: AbortSignal;
|
|
10022
10350
|
};
|
|
10023
10351
|
type AiModelsSearchParams = {
|
|
10024
10352
|
author?: string;
|
|
@@ -10062,46 +10390,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10062
10390
|
aiGatewayLogId: string | null;
|
|
10063
10391
|
gateway(gatewayId: string): AiGateway;
|
|
10064
10392
|
/**
|
|
10065
|
-
*
|
|
10066
|
-
*
|
|
10067
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10068
|
-
* - Account-level operations: `list()`, `create()`
|
|
10069
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10070
|
-
*
|
|
10071
|
-
* @example
|
|
10072
|
-
* ```typescript
|
|
10073
|
-
* // List all AI Search instances
|
|
10074
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10075
|
-
*
|
|
10076
|
-
* // Search an instance
|
|
10077
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10078
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10079
|
-
* ai_search_options: {
|
|
10080
|
-
* retrieval: { max_num_results: 10 }
|
|
10081
|
-
* }
|
|
10082
|
-
* });
|
|
10083
|
-
*
|
|
10084
|
-
* // Generate chat completions with AI Search context
|
|
10085
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10086
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10087
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10088
|
-
* });
|
|
10089
|
-
* ```
|
|
10393
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10394
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10090
10395
|
*/
|
|
10091
|
-
aiSearch():
|
|
10396
|
+
aiSearch(): AiSearchNamespace;
|
|
10092
10397
|
/**
|
|
10093
10398
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10094
|
-
* Use `
|
|
10095
|
-
*
|
|
10096
|
-
* Migration guide:
|
|
10097
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10098
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10099
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10399
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10400
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10100
10401
|
*
|
|
10101
|
-
*
|
|
10102
|
-
*
|
|
10103
|
-
* @see AiSearchAccountService
|
|
10104
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10402
|
+
* @param autoragId Instance ID
|
|
10105
10403
|
*/
|
|
10106
10404
|
autorag(autoragId: string): AutoRAG;
|
|
10107
10405
|
run<
|
|
@@ -10260,22 +10558,23 @@ declare abstract class AiGateway {
|
|
|
10260
10558
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10261
10559
|
}
|
|
10262
10560
|
/**
|
|
10263
|
-
* @deprecated
|
|
10264
|
-
*
|
|
10561
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10562
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10265
10563
|
*/
|
|
10266
10564
|
interface AutoRAGInternalError extends Error {}
|
|
10267
10565
|
/**
|
|
10268
|
-
* @deprecated
|
|
10269
|
-
*
|
|
10566
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10567
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10270
10568
|
*/
|
|
10271
10569
|
interface AutoRAGNotFoundError extends Error {}
|
|
10272
10570
|
/**
|
|
10273
|
-
* @deprecated
|
|
10571
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10572
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10274
10573
|
*/
|
|
10275
10574
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10276
10575
|
/**
|
|
10277
|
-
* @deprecated
|
|
10278
|
-
*
|
|
10576
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10577
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10279
10578
|
*/
|
|
10280
10579
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10281
10580
|
type ComparisonFilter = {
|
|
@@ -10288,9 +10587,8 @@ type CompoundFilter = {
|
|
|
10288
10587
|
filters: ComparisonFilter[];
|
|
10289
10588
|
};
|
|
10290
10589
|
/**
|
|
10291
|
-
* @deprecated
|
|
10292
|
-
*
|
|
10293
|
-
* @see AiSearchSearchRequest
|
|
10590
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10591
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10294
10592
|
*/
|
|
10295
10593
|
type AutoRagSearchRequest = {
|
|
10296
10594
|
query: string;
|
|
@@ -10307,18 +10605,16 @@ type AutoRagSearchRequest = {
|
|
|
10307
10605
|
rewrite_query?: boolean;
|
|
10308
10606
|
};
|
|
10309
10607
|
/**
|
|
10310
|
-
* @deprecated
|
|
10311
|
-
*
|
|
10312
|
-
* @see AiSearchChatCompletionsRequest
|
|
10608
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10609
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10313
10610
|
*/
|
|
10314
10611
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10315
10612
|
stream?: boolean;
|
|
10316
10613
|
system_prompt?: string;
|
|
10317
10614
|
};
|
|
10318
10615
|
/**
|
|
10319
|
-
* @deprecated
|
|
10320
|
-
*
|
|
10321
|
-
* @see AiSearchChatCompletionsRequest
|
|
10616
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10617
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10322
10618
|
*/
|
|
10323
10619
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10324
10620
|
AutoRagAiSearchRequest,
|
|
@@ -10327,9 +10623,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10327
10623
|
stream: true;
|
|
10328
10624
|
};
|
|
10329
10625
|
/**
|
|
10330
|
-
* @deprecated
|
|
10331
|
-
*
|
|
10332
|
-
* @see AiSearchSearchResponse
|
|
10626
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10627
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10333
10628
|
*/
|
|
10334
10629
|
type AutoRagSearchResponse = {
|
|
10335
10630
|
object: "vector_store.search_results.page";
|
|
@@ -10348,9 +10643,8 @@ type AutoRagSearchResponse = {
|
|
|
10348
10643
|
next_page: string | null;
|
|
10349
10644
|
};
|
|
10350
10645
|
/**
|
|
10351
|
-
* @deprecated
|
|
10352
|
-
*
|
|
10353
|
-
* @see AiSearchListResponse
|
|
10646
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10647
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10354
10648
|
*/
|
|
10355
10649
|
type AutoRagListResponse = {
|
|
10356
10650
|
id: string;
|
|
@@ -10362,49 +10656,40 @@ type AutoRagListResponse = {
|
|
|
10362
10656
|
status: string;
|
|
10363
10657
|
}[];
|
|
10364
10658
|
/**
|
|
10365
|
-
* @deprecated
|
|
10366
|
-
*
|
|
10659
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10660
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10367
10661
|
*/
|
|
10368
10662
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10369
10663
|
response: string;
|
|
10370
10664
|
};
|
|
10371
10665
|
/**
|
|
10372
|
-
* @deprecated
|
|
10373
|
-
*
|
|
10374
|
-
*
|
|
10375
|
-
* Migration guide:
|
|
10376
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10377
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10378
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10379
|
-
*
|
|
10380
|
-
* @see AiSearchAccountService
|
|
10381
|
-
* @see AiSearchInstanceService
|
|
10666
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10667
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10382
10668
|
*/
|
|
10383
10669
|
declare abstract class AutoRAG {
|
|
10384
10670
|
/**
|
|
10385
|
-
* @deprecated Use
|
|
10386
|
-
*
|
|
10671
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10672
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10387
10673
|
*/
|
|
10388
10674
|
list(): Promise<AutoRagListResponse>;
|
|
10389
10675
|
/**
|
|
10390
|
-
* @deprecated Use
|
|
10391
|
-
*
|
|
10392
|
-
* @see AiSearchInstanceService.search
|
|
10676
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10677
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10393
10678
|
*/
|
|
10394
10679
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10395
10680
|
/**
|
|
10396
|
-
* @deprecated Use
|
|
10397
|
-
*
|
|
10681
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10682
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10398
10683
|
*/
|
|
10399
10684
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10400
10685
|
/**
|
|
10401
|
-
* @deprecated Use
|
|
10402
|
-
*
|
|
10686
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10687
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10403
10688
|
*/
|
|
10404
10689
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10405
10690
|
/**
|
|
10406
|
-
* @deprecated Use
|
|
10407
|
-
*
|
|
10691
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10692
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10408
10693
|
*/
|
|
10409
10694
|
aiSearch(
|
|
10410
10695
|
params: AutoRagAiSearchRequest,
|
|
@@ -12984,14 +13269,13 @@ interface StreamScopedCaptions {
|
|
|
12984
13269
|
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
|
|
12985
13270
|
* One caption or subtitle file per language is allowed.
|
|
12986
13271
|
* @param language The BCP 47 language tag for the caption or subtitle.
|
|
12987
|
-
* @param
|
|
13272
|
+
* @param input The caption or subtitle stream to upload.
|
|
12988
13273
|
* @returns The created caption entry.
|
|
12989
13274
|
* @throws {NotFoundError} if the video is not found
|
|
12990
13275
|
* @throws {BadRequestError} if the language or file is invalid
|
|
12991
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12992
13276
|
* @throws {InternalError} if an unexpected error occurs
|
|
12993
13277
|
*/
|
|
12994
|
-
upload(language: string,
|
|
13278
|
+
upload(language: string, input: ReadableStream): Promise<StreamCaption>;
|
|
12995
13279
|
/**
|
|
12996
13280
|
* Generate captions or subtitles for the provided language via AI.
|
|
12997
13281
|
* @param language The BCP 47 language tag to generate.
|
|
@@ -13067,17 +13351,16 @@ interface StreamVideos {
|
|
|
13067
13351
|
interface StreamWatermarks {
|
|
13068
13352
|
/**
|
|
13069
13353
|
* Generate a new watermark profile
|
|
13070
|
-
* @param
|
|
13354
|
+
* @param input The image stream to upload
|
|
13071
13355
|
* @param params The watermark creation parameters.
|
|
13072
13356
|
* @returns The created watermark profile.
|
|
13073
13357
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13074
13358
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13075
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13076
13359
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13077
13360
|
* @throws {InternalError} if an unexpected error occurs
|
|
13078
13361
|
*/
|
|
13079
13362
|
generate(
|
|
13080
|
-
|
|
13363
|
+
input: ReadableStream,
|
|
13081
13364
|
params: StreamWatermarkCreateParams,
|
|
13082
13365
|
): Promise<StreamWatermark>;
|
|
13083
13366
|
/**
|
|
@@ -13087,7 +13370,6 @@ interface StreamWatermarks {
|
|
|
13087
13370
|
* @returns The created watermark profile.
|
|
13088
13371
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13089
13372
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13090
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13091
13373
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13092
13374
|
* @throws {InternalError} if an unexpected error occurs
|
|
13093
13375
|
*/
|