@cloudflare/workers-types 4.20260329.1 → 4.20260331.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 +379 -124
- package/2021-11-03/index.ts +379 -124
- package/2022-01-31/index.d.ts +379 -124
- package/2022-01-31/index.ts +379 -124
- package/2022-03-21/index.d.ts +379 -124
- package/2022-03-21/index.ts +379 -124
- package/2022-08-04/index.d.ts +379 -124
- package/2022-08-04/index.ts +379 -124
- package/2022-10-31/index.d.ts +379 -124
- package/2022-10-31/index.ts +379 -124
- package/2022-11-30/index.d.ts +379 -124
- package/2022-11-30/index.ts +379 -124
- package/2023-03-01/index.d.ts +379 -124
- package/2023-03-01/index.ts +379 -124
- package/2023-07-01/index.d.ts +379 -124
- package/2023-07-01/index.ts +379 -124
- package/experimental/index.d.ts +393 -126
- package/experimental/index.ts +393 -126
- package/index.d.ts +379 -124
- package/index.ts +379 -124
- package/latest/index.d.ts +379 -124
- package/latest/index.ts +379 -124
- package/oldest/index.d.ts +379 -124
- package/oldest/index.ts +379 -124
- 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;
|
|
@@ -3870,11 +3876,10 @@ export declare abstract class Performance {
|
|
|
3870
3876
|
*/
|
|
3871
3877
|
toJSON(): object;
|
|
3872
3878
|
}
|
|
3873
|
-
// AI Search
|
|
3879
|
+
// ============ AI Search Error Interfaces ============
|
|
3874
3880
|
export interface AiSearchInternalError extends Error {}
|
|
3875
3881
|
export interface AiSearchNotFoundError extends Error {}
|
|
3876
|
-
|
|
3877
|
-
// AI Search V2 Request Types
|
|
3882
|
+
// ============ AI Search Request Types ============
|
|
3878
3883
|
export type AiSearchSearchRequest = {
|
|
3879
3884
|
messages: Array<{
|
|
3880
3885
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3899,9 +3904,8 @@ export type AiSearchSearchRequest = {
|
|
|
3899
3904
|
[key: string]: unknown;
|
|
3900
3905
|
};
|
|
3901
3906
|
reranking?: {
|
|
3902
|
-
/** Enable reranking (default false) */
|
|
3903
3907
|
enabled?: boolean;
|
|
3904
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3908
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3905
3909
|
/** Match threshold (0-1, default 0.4) */
|
|
3906
3910
|
match_threshold?: number;
|
|
3907
3911
|
[key: string]: unknown;
|
|
@@ -3913,6 +3917,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3913
3917
|
messages: Array<{
|
|
3914
3918
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3915
3919
|
content: string | null;
|
|
3920
|
+
[key: string]: unknown;
|
|
3916
3921
|
}>;
|
|
3917
3922
|
model?: string;
|
|
3918
3923
|
stream?: boolean;
|
|
@@ -3933,7 +3938,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3933
3938
|
};
|
|
3934
3939
|
reranking?: {
|
|
3935
3940
|
enabled?: boolean;
|
|
3936
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3941
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3937
3942
|
match_threshold?: number;
|
|
3938
3943
|
[key: string]: unknown;
|
|
3939
3944
|
};
|
|
@@ -3941,7 +3946,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3941
3946
|
};
|
|
3942
3947
|
[key: string]: unknown;
|
|
3943
3948
|
};
|
|
3944
|
-
// AI Search
|
|
3949
|
+
// ============ AI Search Response Types ============
|
|
3945
3950
|
export type AiSearchSearchResponse = {
|
|
3946
3951
|
search_query: string;
|
|
3947
3952
|
chunks: Array<{
|
|
@@ -3960,26 +3965,65 @@ export type AiSearchSearchResponse = {
|
|
|
3960
3965
|
keyword_score?: number;
|
|
3961
3966
|
/** Vector similarity score (0-1) */
|
|
3962
3967
|
vector_score?: number;
|
|
3968
|
+
[key: string]: unknown;
|
|
3969
|
+
};
|
|
3970
|
+
}>;
|
|
3971
|
+
};
|
|
3972
|
+
export type AiSearchChatCompletionsResponse = {
|
|
3973
|
+
id?: string;
|
|
3974
|
+
object?: string;
|
|
3975
|
+
model?: string;
|
|
3976
|
+
choices: Array<{
|
|
3977
|
+
index?: number;
|
|
3978
|
+
message: {
|
|
3979
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3980
|
+
content: string | null;
|
|
3981
|
+
[key: string]: unknown;
|
|
3963
3982
|
};
|
|
3983
|
+
[key: string]: unknown;
|
|
3964
3984
|
}>;
|
|
3985
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
3986
|
+
[key: string]: unknown;
|
|
3965
3987
|
};
|
|
3966
|
-
export type
|
|
3988
|
+
export type AiSearchStatsResponse = {
|
|
3989
|
+
queued?: number;
|
|
3990
|
+
running?: number;
|
|
3991
|
+
completed?: number;
|
|
3992
|
+
error?: number;
|
|
3993
|
+
skipped?: number;
|
|
3994
|
+
outdated?: number;
|
|
3995
|
+
last_activity?: string;
|
|
3996
|
+
};
|
|
3997
|
+
// ============ AI Search Instance Info Types ============
|
|
3998
|
+
export type AiSearchInstanceInfo = {
|
|
3967
3999
|
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";
|
|
4000
|
+
type?: "r2" | "web-crawler" | string;
|
|
3974
4001
|
source?: string;
|
|
4002
|
+
paused?: boolean;
|
|
4003
|
+
status?: string;
|
|
4004
|
+
namespace?: string;
|
|
4005
|
+
created_at?: string;
|
|
4006
|
+
modified_at?: string;
|
|
3975
4007
|
[key: string]: unknown;
|
|
3976
|
-
}
|
|
4008
|
+
};
|
|
4009
|
+
export type AiSearchListResponse = {
|
|
4010
|
+
result: AiSearchInstanceInfo[];
|
|
4011
|
+
result_info?: {
|
|
4012
|
+
count: number;
|
|
4013
|
+
page: number;
|
|
4014
|
+
per_page: number;
|
|
4015
|
+
total_count: number;
|
|
4016
|
+
};
|
|
4017
|
+
};
|
|
4018
|
+
// ============ AI Search Config Types ============
|
|
3977
4019
|
export type AiSearchConfig = {
|
|
3978
4020
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3979
4021
|
id: string;
|
|
3980
|
-
type
|
|
3981
|
-
|
|
3982
|
-
|
|
4022
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4023
|
+
type?: "r2" | "web-crawler" | string;
|
|
4024
|
+
/** Source URL (required for web-crawler type). */
|
|
4025
|
+
source?: string;
|
|
4026
|
+
source_params?: unknown;
|
|
3983
4027
|
/** Token ID (UUID format) */
|
|
3984
4028
|
token_id?: string;
|
|
3985
4029
|
ai_gateway_id?: string;
|
|
@@ -3989,54 +4033,307 @@ export type AiSearchConfig = {
|
|
|
3989
4033
|
reranking?: boolean;
|
|
3990
4034
|
embedding_model?: string;
|
|
3991
4035
|
ai_search_model?: string;
|
|
4036
|
+
[key: string]: unknown;
|
|
3992
4037
|
};
|
|
3993
|
-
|
|
4038
|
+
// ============ AI Search Item Types ============
|
|
4039
|
+
export type AiSearchItemInfo = {
|
|
3994
4040
|
id: string;
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
4041
|
+
key: string;
|
|
4042
|
+
status:
|
|
4043
|
+
| "completed"
|
|
4044
|
+
| "error"
|
|
4045
|
+
| "skipped"
|
|
4046
|
+
| "queued"
|
|
4047
|
+
| "processing"
|
|
4048
|
+
| "outdated";
|
|
4049
|
+
metadata?: Record<string, unknown>;
|
|
3998
4050
|
[key: string]: unknown;
|
|
3999
4051
|
};
|
|
4000
|
-
|
|
4001
|
-
|
|
4052
|
+
export type AiSearchItemContentResult = {
|
|
4053
|
+
body: ReadableStream;
|
|
4054
|
+
contentType: string;
|
|
4055
|
+
filename: string;
|
|
4056
|
+
size: number;
|
|
4057
|
+
};
|
|
4058
|
+
export type AiSearchUploadItemOptions = {
|
|
4059
|
+
metadata?: Record<string, unknown>;
|
|
4060
|
+
};
|
|
4061
|
+
export type AiSearchListItemsParams = {
|
|
4062
|
+
page?: number;
|
|
4063
|
+
per_page?: number;
|
|
4064
|
+
};
|
|
4065
|
+
export type AiSearchListItemsResponse = {
|
|
4066
|
+
result: AiSearchItemInfo[];
|
|
4067
|
+
result_info?: {
|
|
4068
|
+
count: number;
|
|
4069
|
+
page: number;
|
|
4070
|
+
per_page: number;
|
|
4071
|
+
total_count: number;
|
|
4072
|
+
};
|
|
4073
|
+
};
|
|
4074
|
+
// ============ AI Search Job Types ============
|
|
4075
|
+
export type AiSearchJobInfo = {
|
|
4076
|
+
id: string;
|
|
4077
|
+
source: "user" | "schedule";
|
|
4078
|
+
description?: string;
|
|
4079
|
+
last_seen_at?: string;
|
|
4080
|
+
started_at?: string;
|
|
4081
|
+
ended_at?: string;
|
|
4082
|
+
end_reason?: string;
|
|
4083
|
+
};
|
|
4084
|
+
export type AiSearchJobLog = {
|
|
4085
|
+
id: number;
|
|
4086
|
+
message: string;
|
|
4087
|
+
message_type: number;
|
|
4088
|
+
created_at: number;
|
|
4089
|
+
};
|
|
4090
|
+
export type AiSearchCreateJobParams = {
|
|
4091
|
+
description?: string;
|
|
4092
|
+
};
|
|
4093
|
+
export type AiSearchListJobsParams = {
|
|
4094
|
+
page?: number;
|
|
4095
|
+
per_page?: number;
|
|
4096
|
+
};
|
|
4097
|
+
export type AiSearchListJobsResponse = {
|
|
4098
|
+
result: AiSearchJobInfo[];
|
|
4099
|
+
result_info?: {
|
|
4100
|
+
count: number;
|
|
4101
|
+
page: number;
|
|
4102
|
+
per_page: number;
|
|
4103
|
+
total_count: number;
|
|
4104
|
+
};
|
|
4105
|
+
};
|
|
4106
|
+
export type AiSearchJobLogsParams = {
|
|
4107
|
+
page?: number;
|
|
4108
|
+
per_page?: number;
|
|
4109
|
+
};
|
|
4110
|
+
export type AiSearchJobLogsResponse = {
|
|
4111
|
+
result: AiSearchJobLog[];
|
|
4112
|
+
result_info?: {
|
|
4113
|
+
count: number;
|
|
4114
|
+
page: number;
|
|
4115
|
+
per_page: number;
|
|
4116
|
+
total_count: number;
|
|
4117
|
+
};
|
|
4118
|
+
};
|
|
4119
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4120
|
+
/**
|
|
4121
|
+
* Single item service for an AI Search instance.
|
|
4122
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4123
|
+
*/
|
|
4124
|
+
export declare abstract class AiSearchItem {
|
|
4125
|
+
/** Get metadata about this item. */
|
|
4126
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4127
|
+
/**
|
|
4128
|
+
* Download the item's content.
|
|
4129
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4130
|
+
*/
|
|
4131
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4132
|
+
}
|
|
4133
|
+
/**
|
|
4134
|
+
* Items collection service for an AI Search instance.
|
|
4135
|
+
* Provides list, upload, and access to individual items.
|
|
4136
|
+
*/
|
|
4137
|
+
export declare abstract class AiSearchItems {
|
|
4138
|
+
/** List items in this instance. */
|
|
4139
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4140
|
+
/**
|
|
4141
|
+
* Upload a file as an item.
|
|
4142
|
+
* @param name Filename for the uploaded item.
|
|
4143
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4144
|
+
* @param options Optional metadata to attach to the item.
|
|
4145
|
+
* @returns The created item info.
|
|
4146
|
+
*/
|
|
4147
|
+
upload(
|
|
4148
|
+
name: string,
|
|
4149
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4150
|
+
options?: AiSearchUploadItemOptions,
|
|
4151
|
+
): Promise<AiSearchItemInfo>;
|
|
4152
|
+
/**
|
|
4153
|
+
* Upload a file and poll until processing completes.
|
|
4154
|
+
* @param name Filename for the uploaded item.
|
|
4155
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4156
|
+
* @param options Optional metadata to attach to the item.
|
|
4157
|
+
* @returns The item info after processing completes (or timeout).
|
|
4158
|
+
*/
|
|
4159
|
+
uploadAndPoll(
|
|
4160
|
+
name: string,
|
|
4161
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4162
|
+
options?: AiSearchUploadItemOptions,
|
|
4163
|
+
): Promise<AiSearchItemInfo>;
|
|
4164
|
+
/**
|
|
4165
|
+
* Get an item by ID.
|
|
4166
|
+
* @param itemId The item identifier.
|
|
4167
|
+
* @returns Item service for info, delete, and download operations.
|
|
4168
|
+
*/
|
|
4169
|
+
get(itemId: string): AiSearchItem;
|
|
4170
|
+
/** Delete this item from the instance.
|
|
4171
|
+
* @param itemId The item identifier.
|
|
4172
|
+
*/
|
|
4173
|
+
delete(itemId: string): Promise<void>;
|
|
4174
|
+
}
|
|
4175
|
+
/**
|
|
4176
|
+
* Single job service for an AI Search instance.
|
|
4177
|
+
* Provides info and logs for a specific job.
|
|
4178
|
+
*/
|
|
4179
|
+
export declare abstract class AiSearchJob {
|
|
4180
|
+
/** Get metadata about this job. */
|
|
4181
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4182
|
+
/** Get logs for this job. */
|
|
4183
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4184
|
+
}
|
|
4185
|
+
/**
|
|
4186
|
+
* Jobs collection service for an AI Search instance.
|
|
4187
|
+
* Provides list, create, and access to individual jobs.
|
|
4188
|
+
*/
|
|
4189
|
+
export declare abstract class AiSearchJobs {
|
|
4190
|
+
/** List jobs for this instance. */
|
|
4191
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4192
|
+
/**
|
|
4193
|
+
* Create a new indexing job.
|
|
4194
|
+
* @param params Optional job parameters.
|
|
4195
|
+
* @returns The created job info.
|
|
4196
|
+
*/
|
|
4197
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4198
|
+
/**
|
|
4199
|
+
* Get a job by ID.
|
|
4200
|
+
* @param jobId The job identifier.
|
|
4201
|
+
* @returns Job service for info and logs operations.
|
|
4202
|
+
*/
|
|
4203
|
+
get(jobId: string): AiSearchJob;
|
|
4204
|
+
}
|
|
4205
|
+
// ============ AI Search Binding Classes ============
|
|
4206
|
+
/**
|
|
4207
|
+
* Instance-level AI Search service.
|
|
4208
|
+
*
|
|
4209
|
+
* Used as:
|
|
4210
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4211
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4212
|
+
*
|
|
4213
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4214
|
+
*
|
|
4215
|
+
* @example
|
|
4216
|
+
* ```ts
|
|
4217
|
+
* // Via namespace binding
|
|
4218
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4219
|
+
* const results = await instance.search({
|
|
4220
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4221
|
+
* });
|
|
4222
|
+
*
|
|
4223
|
+
* // Via single instance binding
|
|
4224
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4225
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4226
|
+
* });
|
|
4227
|
+
* ```
|
|
4228
|
+
*/
|
|
4229
|
+
export declare abstract class AiSearchInstance {
|
|
4002
4230
|
/**
|
|
4003
4231
|
* 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
|
|
4232
|
+
* @param params Search request with messages and optional AI search options.
|
|
4233
|
+
* @returns Search response with matching chunks and search query.
|
|
4006
4234
|
*/
|
|
4007
4235
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4236
|
+
/**
|
|
4237
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4238
|
+
* @param params Chat completions request with stream: true.
|
|
4239
|
+
* @returns ReadableStream of server-sent events.
|
|
4240
|
+
*/
|
|
4241
|
+
chatCompletions(
|
|
4242
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4243
|
+
stream: true;
|
|
4244
|
+
},
|
|
4245
|
+
): Promise<ReadableStream>;
|
|
4008
4246
|
/**
|
|
4009
4247
|
* Generate chat completions with AI Search context.
|
|
4010
|
-
* @param params Chat completions request
|
|
4011
|
-
* @returns
|
|
4248
|
+
* @param params Chat completions request.
|
|
4249
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4012
4250
|
*/
|
|
4013
4251
|
chatCompletions(
|
|
4014
4252
|
params: AiSearchChatCompletionsRequest,
|
|
4015
|
-
): Promise<
|
|
4253
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4016
4254
|
/**
|
|
4017
|
-
*
|
|
4255
|
+
* Update the instance configuration.
|
|
4256
|
+
* @param config Partial configuration to update.
|
|
4257
|
+
* @returns Updated instance info.
|
|
4018
4258
|
*/
|
|
4019
|
-
|
|
4259
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4260
|
+
/** Get metadata about this instance. */
|
|
4261
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4262
|
+
/**
|
|
4263
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4264
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4265
|
+
*/
|
|
4266
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4267
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4268
|
+
get items(): AiSearchItems;
|
|
4269
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4270
|
+
get jobs(): AiSearchJobs;
|
|
4020
4271
|
}
|
|
4021
|
-
|
|
4022
|
-
|
|
4272
|
+
/**
|
|
4273
|
+
* Namespace-level AI Search service.
|
|
4274
|
+
*
|
|
4275
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4276
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4277
|
+
*
|
|
4278
|
+
* @example
|
|
4279
|
+
* ```ts
|
|
4280
|
+
* // Access an instance within the namespace
|
|
4281
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4282
|
+
* const results = await blog.search({
|
|
4283
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4284
|
+
* });
|
|
4285
|
+
*
|
|
4286
|
+
* // List all instances in the namespace
|
|
4287
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4288
|
+
*
|
|
4289
|
+
* // Create a new instance with built-in storage
|
|
4290
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4291
|
+
* id: "tenant-123",
|
|
4292
|
+
* });
|
|
4293
|
+
*
|
|
4294
|
+
* // Upload items into the instance
|
|
4295
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4296
|
+
*
|
|
4297
|
+
* // Delete an instance
|
|
4298
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4299
|
+
* ```
|
|
4300
|
+
*/
|
|
4301
|
+
export declare abstract class AiSearchNamespace {
|
|
4023
4302
|
/**
|
|
4024
|
-
*
|
|
4025
|
-
* @
|
|
4303
|
+
* Get an instance by name within the bound namespace.
|
|
4304
|
+
* @param name Instance name.
|
|
4305
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4306
|
+
*/
|
|
4307
|
+
get(name: string): AiSearchInstance;
|
|
4308
|
+
/**
|
|
4309
|
+
* List all instances in the bound namespace.
|
|
4310
|
+
* @returns Array of instance metadata.
|
|
4026
4311
|
*/
|
|
4027
4312
|
list(): Promise<AiSearchListResponse>;
|
|
4028
4313
|
/**
|
|
4029
|
-
*
|
|
4030
|
-
* @param
|
|
4031
|
-
* @returns Instance service for
|
|
4314
|
+
* Create a new instance within the bound namespace.
|
|
4315
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4316
|
+
* @returns Instance service for the newly created instance.
|
|
4317
|
+
*
|
|
4318
|
+
* @example
|
|
4319
|
+
* ```ts
|
|
4320
|
+
* // Create with built-in storage (upload items manually)
|
|
4321
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4322
|
+
*
|
|
4323
|
+
* // Create with web crawler source
|
|
4324
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4325
|
+
* id: "docs-search",
|
|
4326
|
+
* type: "web-crawler",
|
|
4327
|
+
* source: "https://developers.cloudflare.com",
|
|
4328
|
+
* });
|
|
4329
|
+
* ```
|
|
4032
4330
|
*/
|
|
4033
|
-
|
|
4331
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4034
4332
|
/**
|
|
4035
|
-
*
|
|
4036
|
-
* @param
|
|
4037
|
-
* @returns Instance service for performing operations
|
|
4333
|
+
* Delete an instance from the bound namespace.
|
|
4334
|
+
* @param name Instance name to delete.
|
|
4038
4335
|
*/
|
|
4039
|
-
|
|
4336
|
+
delete(name: string): Promise<void>;
|
|
4040
4337
|
}
|
|
4041
4338
|
export type AiImageClassificationInput = {
|
|
4042
4339
|
image: number[];
|
|
@@ -10037,6 +10334,7 @@ export type AiOptions = {
|
|
|
10037
10334
|
returnRawResponse?: boolean;
|
|
10038
10335
|
prefix?: string;
|
|
10039
10336
|
extraHeaders?: object;
|
|
10337
|
+
signal?: AbortSignal;
|
|
10040
10338
|
};
|
|
10041
10339
|
export type AiModelsSearchParams = {
|
|
10042
10340
|
author?: string;
|
|
@@ -10082,46 +10380,16 @@ export declare abstract class Ai<
|
|
|
10082
10380
|
aiGatewayLogId: string | null;
|
|
10083
10381
|
gateway(gatewayId: string): AiGateway;
|
|
10084
10382
|
/**
|
|
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
|
-
* ```
|
|
10383
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10384
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10110
10385
|
*/
|
|
10111
|
-
aiSearch():
|
|
10386
|
+
aiSearch(): AiSearchNamespace;
|
|
10112
10387
|
/**
|
|
10113
10388
|
* @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(...)`
|
|
10389
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10390
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10120
10391
|
*
|
|
10121
|
-
*
|
|
10122
|
-
*
|
|
10123
|
-
* @see AiSearchAccountService
|
|
10124
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10392
|
+
* @param autoragId Instance ID
|
|
10125
10393
|
*/
|
|
10126
10394
|
autorag(autoragId: string): AutoRAG;
|
|
10127
10395
|
run<
|
|
@@ -10280,22 +10548,23 @@ export declare abstract class AiGateway {
|
|
|
10280
10548
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10281
10549
|
}
|
|
10282
10550
|
/**
|
|
10283
|
-
* @deprecated
|
|
10284
|
-
*
|
|
10551
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10552
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10285
10553
|
*/
|
|
10286
10554
|
export interface AutoRAGInternalError extends Error {}
|
|
10287
10555
|
/**
|
|
10288
|
-
* @deprecated
|
|
10289
|
-
*
|
|
10556
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10557
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10290
10558
|
*/
|
|
10291
10559
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10292
10560
|
/**
|
|
10293
|
-
* @deprecated
|
|
10561
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10562
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10294
10563
|
*/
|
|
10295
10564
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10296
10565
|
/**
|
|
10297
|
-
* @deprecated
|
|
10298
|
-
*
|
|
10566
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10567
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10299
10568
|
*/
|
|
10300
10569
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10301
10570
|
export type ComparisonFilter = {
|
|
@@ -10308,9 +10577,8 @@ export type CompoundFilter = {
|
|
|
10308
10577
|
filters: ComparisonFilter[];
|
|
10309
10578
|
};
|
|
10310
10579
|
/**
|
|
10311
|
-
* @deprecated
|
|
10312
|
-
*
|
|
10313
|
-
* @see AiSearchSearchRequest
|
|
10580
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10581
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10314
10582
|
*/
|
|
10315
10583
|
export type AutoRagSearchRequest = {
|
|
10316
10584
|
query: string;
|
|
@@ -10327,18 +10595,16 @@ export type AutoRagSearchRequest = {
|
|
|
10327
10595
|
rewrite_query?: boolean;
|
|
10328
10596
|
};
|
|
10329
10597
|
/**
|
|
10330
|
-
* @deprecated
|
|
10331
|
-
*
|
|
10332
|
-
* @see AiSearchChatCompletionsRequest
|
|
10598
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10599
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10333
10600
|
*/
|
|
10334
10601
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10335
10602
|
stream?: boolean;
|
|
10336
10603
|
system_prompt?: string;
|
|
10337
10604
|
};
|
|
10338
10605
|
/**
|
|
10339
|
-
* @deprecated
|
|
10340
|
-
*
|
|
10341
|
-
* @see AiSearchChatCompletionsRequest
|
|
10606
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10607
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10342
10608
|
*/
|
|
10343
10609
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10344
10610
|
AutoRagAiSearchRequest,
|
|
@@ -10347,9 +10613,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10347
10613
|
stream: true;
|
|
10348
10614
|
};
|
|
10349
10615
|
/**
|
|
10350
|
-
* @deprecated
|
|
10351
|
-
*
|
|
10352
|
-
* @see AiSearchSearchResponse
|
|
10616
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10617
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10353
10618
|
*/
|
|
10354
10619
|
export type AutoRagSearchResponse = {
|
|
10355
10620
|
object: "vector_store.search_results.page";
|
|
@@ -10368,9 +10633,8 @@ export type AutoRagSearchResponse = {
|
|
|
10368
10633
|
next_page: string | null;
|
|
10369
10634
|
};
|
|
10370
10635
|
/**
|
|
10371
|
-
* @deprecated
|
|
10372
|
-
*
|
|
10373
|
-
* @see AiSearchListResponse
|
|
10636
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10637
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10374
10638
|
*/
|
|
10375
10639
|
export type AutoRagListResponse = {
|
|
10376
10640
|
id: string;
|
|
@@ -10382,49 +10646,40 @@ export type AutoRagListResponse = {
|
|
|
10382
10646
|
status: string;
|
|
10383
10647
|
}[];
|
|
10384
10648
|
/**
|
|
10385
|
-
* @deprecated
|
|
10386
|
-
*
|
|
10649
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10650
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10387
10651
|
*/
|
|
10388
10652
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10389
10653
|
response: string;
|
|
10390
10654
|
};
|
|
10391
10655
|
/**
|
|
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
|
|
10656
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10657
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10402
10658
|
*/
|
|
10403
10659
|
export declare abstract class AutoRAG {
|
|
10404
10660
|
/**
|
|
10405
|
-
* @deprecated Use
|
|
10406
|
-
*
|
|
10661
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10662
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10407
10663
|
*/
|
|
10408
10664
|
list(): Promise<AutoRagListResponse>;
|
|
10409
10665
|
/**
|
|
10410
|
-
* @deprecated Use
|
|
10411
|
-
*
|
|
10412
|
-
* @see AiSearchInstanceService.search
|
|
10666
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10667
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10413
10668
|
*/
|
|
10414
10669
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10415
10670
|
/**
|
|
10416
|
-
* @deprecated Use
|
|
10417
|
-
*
|
|
10671
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10672
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10418
10673
|
*/
|
|
10419
10674
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10420
10675
|
/**
|
|
10421
|
-
* @deprecated Use
|
|
10422
|
-
*
|
|
10676
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10677
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10423
10678
|
*/
|
|
10424
10679
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10425
10680
|
/**
|
|
10426
|
-
* @deprecated Use
|
|
10427
|
-
*
|
|
10681
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10682
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10428
10683
|
*/
|
|
10429
10684
|
aiSearch(
|
|
10430
10685
|
params: AutoRagAiSearchRequest,
|