@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/2021-11-03/index.ts
CHANGED
|
@@ -3082,6 +3082,11 @@ export interface QueuingStrategyInit {
|
|
|
3082
3082
|
*/
|
|
3083
3083
|
highWaterMark: number;
|
|
3084
3084
|
}
|
|
3085
|
+
export interface TracePreviewInfo {
|
|
3086
|
+
id: string;
|
|
3087
|
+
slug: string;
|
|
3088
|
+
name: string;
|
|
3089
|
+
}
|
|
3085
3090
|
export interface ScriptVersion {
|
|
3086
3091
|
id?: string;
|
|
3087
3092
|
tag?: string;
|
|
@@ -3116,6 +3121,7 @@ export interface TraceItem {
|
|
|
3116
3121
|
readonly dispatchNamespace?: string;
|
|
3117
3122
|
readonly scriptTags?: string[];
|
|
3118
3123
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3124
|
+
readonly preview?: TracePreviewInfo;
|
|
3119
3125
|
readonly durableObjectId?: string;
|
|
3120
3126
|
readonly outcome: string;
|
|
3121
3127
|
readonly executionModel: string;
|
|
@@ -3794,11 +3800,10 @@ export declare abstract class Performance {
|
|
|
3794
3800
|
*/
|
|
3795
3801
|
toJSON(): object;
|
|
3796
3802
|
}
|
|
3797
|
-
// AI Search
|
|
3803
|
+
// ============ AI Search Error Interfaces ============
|
|
3798
3804
|
export interface AiSearchInternalError extends Error {}
|
|
3799
3805
|
export interface AiSearchNotFoundError extends Error {}
|
|
3800
|
-
|
|
3801
|
-
// AI Search V2 Request Types
|
|
3806
|
+
// ============ AI Search Request Types ============
|
|
3802
3807
|
export type AiSearchSearchRequest = {
|
|
3803
3808
|
messages: Array<{
|
|
3804
3809
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3823,9 +3828,8 @@ export type AiSearchSearchRequest = {
|
|
|
3823
3828
|
[key: string]: unknown;
|
|
3824
3829
|
};
|
|
3825
3830
|
reranking?: {
|
|
3826
|
-
/** Enable reranking (default false) */
|
|
3827
3831
|
enabled?: boolean;
|
|
3828
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3832
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3829
3833
|
/** Match threshold (0-1, default 0.4) */
|
|
3830
3834
|
match_threshold?: number;
|
|
3831
3835
|
[key: string]: unknown;
|
|
@@ -3837,6 +3841,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3837
3841
|
messages: Array<{
|
|
3838
3842
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3839
3843
|
content: string | null;
|
|
3844
|
+
[key: string]: unknown;
|
|
3840
3845
|
}>;
|
|
3841
3846
|
model?: string;
|
|
3842
3847
|
stream?: boolean;
|
|
@@ -3857,7 +3862,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3857
3862
|
};
|
|
3858
3863
|
reranking?: {
|
|
3859
3864
|
enabled?: boolean;
|
|
3860
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3865
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3861
3866
|
match_threshold?: number;
|
|
3862
3867
|
[key: string]: unknown;
|
|
3863
3868
|
};
|
|
@@ -3865,7 +3870,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3865
3870
|
};
|
|
3866
3871
|
[key: string]: unknown;
|
|
3867
3872
|
};
|
|
3868
|
-
// AI Search
|
|
3873
|
+
// ============ AI Search Response Types ============
|
|
3869
3874
|
export type AiSearchSearchResponse = {
|
|
3870
3875
|
search_query: string;
|
|
3871
3876
|
chunks: Array<{
|
|
@@ -3884,26 +3889,65 @@ export type AiSearchSearchResponse = {
|
|
|
3884
3889
|
keyword_score?: number;
|
|
3885
3890
|
/** Vector similarity score (0-1) */
|
|
3886
3891
|
vector_score?: number;
|
|
3892
|
+
[key: string]: unknown;
|
|
3893
|
+
};
|
|
3894
|
+
}>;
|
|
3895
|
+
};
|
|
3896
|
+
export type AiSearchChatCompletionsResponse = {
|
|
3897
|
+
id?: string;
|
|
3898
|
+
object?: string;
|
|
3899
|
+
model?: string;
|
|
3900
|
+
choices: Array<{
|
|
3901
|
+
index?: number;
|
|
3902
|
+
message: {
|
|
3903
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3904
|
+
content: string | null;
|
|
3905
|
+
[key: string]: unknown;
|
|
3887
3906
|
};
|
|
3907
|
+
[key: string]: unknown;
|
|
3888
3908
|
}>;
|
|
3909
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
3910
|
+
[key: string]: unknown;
|
|
3889
3911
|
};
|
|
3890
|
-
export type
|
|
3912
|
+
export type AiSearchStatsResponse = {
|
|
3913
|
+
queued?: number;
|
|
3914
|
+
running?: number;
|
|
3915
|
+
completed?: number;
|
|
3916
|
+
error?: number;
|
|
3917
|
+
skipped?: number;
|
|
3918
|
+
outdated?: number;
|
|
3919
|
+
last_activity?: string;
|
|
3920
|
+
};
|
|
3921
|
+
// ============ AI Search Instance Info Types ============
|
|
3922
|
+
export type AiSearchInstanceInfo = {
|
|
3891
3923
|
id: string;
|
|
3892
|
-
|
|
3893
|
-
account_id?: string;
|
|
3894
|
-
account_tag?: string;
|
|
3895
|
-
/** Whether the instance is enabled (default true) */
|
|
3896
|
-
enable?: boolean;
|
|
3897
|
-
type?: "r2" | "web-crawler";
|
|
3924
|
+
type?: "r2" | "web-crawler" | string;
|
|
3898
3925
|
source?: string;
|
|
3926
|
+
paused?: boolean;
|
|
3927
|
+
status?: string;
|
|
3928
|
+
namespace?: string;
|
|
3929
|
+
created_at?: string;
|
|
3930
|
+
modified_at?: string;
|
|
3899
3931
|
[key: string]: unknown;
|
|
3900
|
-
}
|
|
3932
|
+
};
|
|
3933
|
+
export type AiSearchListResponse = {
|
|
3934
|
+
result: AiSearchInstanceInfo[];
|
|
3935
|
+
result_info?: {
|
|
3936
|
+
count: number;
|
|
3937
|
+
page: number;
|
|
3938
|
+
per_page: number;
|
|
3939
|
+
total_count: number;
|
|
3940
|
+
};
|
|
3941
|
+
};
|
|
3942
|
+
// ============ AI Search Config Types ============
|
|
3901
3943
|
export type AiSearchConfig = {
|
|
3902
3944
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3903
3945
|
id: string;
|
|
3904
|
-
type
|
|
3905
|
-
|
|
3906
|
-
|
|
3946
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
3947
|
+
type?: "r2" | "web-crawler" | string;
|
|
3948
|
+
/** Source URL (required for web-crawler type). */
|
|
3949
|
+
source?: string;
|
|
3950
|
+
source_params?: unknown;
|
|
3907
3951
|
/** Token ID (UUID format) */
|
|
3908
3952
|
token_id?: string;
|
|
3909
3953
|
ai_gateway_id?: string;
|
|
@@ -3913,54 +3957,307 @@ export type AiSearchConfig = {
|
|
|
3913
3957
|
reranking?: boolean;
|
|
3914
3958
|
embedding_model?: string;
|
|
3915
3959
|
ai_search_model?: string;
|
|
3960
|
+
[key: string]: unknown;
|
|
3916
3961
|
};
|
|
3917
|
-
|
|
3962
|
+
// ============ AI Search Item Types ============
|
|
3963
|
+
export type AiSearchItemInfo = {
|
|
3918
3964
|
id: string;
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3965
|
+
key: string;
|
|
3966
|
+
status:
|
|
3967
|
+
| "completed"
|
|
3968
|
+
| "error"
|
|
3969
|
+
| "skipped"
|
|
3970
|
+
| "queued"
|
|
3971
|
+
| "processing"
|
|
3972
|
+
| "outdated";
|
|
3973
|
+
metadata?: Record<string, unknown>;
|
|
3922
3974
|
[key: string]: unknown;
|
|
3923
3975
|
};
|
|
3924
|
-
|
|
3925
|
-
|
|
3976
|
+
export type AiSearchItemContentResult = {
|
|
3977
|
+
body: ReadableStream;
|
|
3978
|
+
contentType: string;
|
|
3979
|
+
filename: string;
|
|
3980
|
+
size: number;
|
|
3981
|
+
};
|
|
3982
|
+
export type AiSearchUploadItemOptions = {
|
|
3983
|
+
metadata?: Record<string, unknown>;
|
|
3984
|
+
};
|
|
3985
|
+
export type AiSearchListItemsParams = {
|
|
3986
|
+
page?: number;
|
|
3987
|
+
per_page?: number;
|
|
3988
|
+
};
|
|
3989
|
+
export type AiSearchListItemsResponse = {
|
|
3990
|
+
result: AiSearchItemInfo[];
|
|
3991
|
+
result_info?: {
|
|
3992
|
+
count: number;
|
|
3993
|
+
page: number;
|
|
3994
|
+
per_page: number;
|
|
3995
|
+
total_count: number;
|
|
3996
|
+
};
|
|
3997
|
+
};
|
|
3998
|
+
// ============ AI Search Job Types ============
|
|
3999
|
+
export type AiSearchJobInfo = {
|
|
4000
|
+
id: string;
|
|
4001
|
+
source: "user" | "schedule";
|
|
4002
|
+
description?: string;
|
|
4003
|
+
last_seen_at?: string;
|
|
4004
|
+
started_at?: string;
|
|
4005
|
+
ended_at?: string;
|
|
4006
|
+
end_reason?: string;
|
|
4007
|
+
};
|
|
4008
|
+
export type AiSearchJobLog = {
|
|
4009
|
+
id: number;
|
|
4010
|
+
message: string;
|
|
4011
|
+
message_type: number;
|
|
4012
|
+
created_at: number;
|
|
4013
|
+
};
|
|
4014
|
+
export type AiSearchCreateJobParams = {
|
|
4015
|
+
description?: string;
|
|
4016
|
+
};
|
|
4017
|
+
export type AiSearchListJobsParams = {
|
|
4018
|
+
page?: number;
|
|
4019
|
+
per_page?: number;
|
|
4020
|
+
};
|
|
4021
|
+
export type AiSearchListJobsResponse = {
|
|
4022
|
+
result: AiSearchJobInfo[];
|
|
4023
|
+
result_info?: {
|
|
4024
|
+
count: number;
|
|
4025
|
+
page: number;
|
|
4026
|
+
per_page: number;
|
|
4027
|
+
total_count: number;
|
|
4028
|
+
};
|
|
4029
|
+
};
|
|
4030
|
+
export type AiSearchJobLogsParams = {
|
|
4031
|
+
page?: number;
|
|
4032
|
+
per_page?: number;
|
|
4033
|
+
};
|
|
4034
|
+
export type AiSearchJobLogsResponse = {
|
|
4035
|
+
result: AiSearchJobLog[];
|
|
4036
|
+
result_info?: {
|
|
4037
|
+
count: number;
|
|
4038
|
+
page: number;
|
|
4039
|
+
per_page: number;
|
|
4040
|
+
total_count: number;
|
|
4041
|
+
};
|
|
4042
|
+
};
|
|
4043
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4044
|
+
/**
|
|
4045
|
+
* Single item service for an AI Search instance.
|
|
4046
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4047
|
+
*/
|
|
4048
|
+
export declare abstract class AiSearchItem {
|
|
4049
|
+
/** Get metadata about this item. */
|
|
4050
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4051
|
+
/**
|
|
4052
|
+
* Download the item's content.
|
|
4053
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4054
|
+
*/
|
|
4055
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4056
|
+
}
|
|
4057
|
+
/**
|
|
4058
|
+
* Items collection service for an AI Search instance.
|
|
4059
|
+
* Provides list, upload, and access to individual items.
|
|
4060
|
+
*/
|
|
4061
|
+
export declare abstract class AiSearchItems {
|
|
4062
|
+
/** List items in this instance. */
|
|
4063
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4064
|
+
/**
|
|
4065
|
+
* Upload a file as an item.
|
|
4066
|
+
* @param name Filename for the uploaded item.
|
|
4067
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4068
|
+
* @param options Optional metadata to attach to the item.
|
|
4069
|
+
* @returns The created item info.
|
|
4070
|
+
*/
|
|
4071
|
+
upload(
|
|
4072
|
+
name: string,
|
|
4073
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4074
|
+
options?: AiSearchUploadItemOptions,
|
|
4075
|
+
): Promise<AiSearchItemInfo>;
|
|
4076
|
+
/**
|
|
4077
|
+
* Upload a file and poll until processing completes.
|
|
4078
|
+
* @param name Filename for the uploaded item.
|
|
4079
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4080
|
+
* @param options Optional metadata to attach to the item.
|
|
4081
|
+
* @returns The item info after processing completes (or timeout).
|
|
4082
|
+
*/
|
|
4083
|
+
uploadAndPoll(
|
|
4084
|
+
name: string,
|
|
4085
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4086
|
+
options?: AiSearchUploadItemOptions,
|
|
4087
|
+
): Promise<AiSearchItemInfo>;
|
|
4088
|
+
/**
|
|
4089
|
+
* Get an item by ID.
|
|
4090
|
+
* @param itemId The item identifier.
|
|
4091
|
+
* @returns Item service for info, delete, and download operations.
|
|
4092
|
+
*/
|
|
4093
|
+
get(itemId: string): AiSearchItem;
|
|
4094
|
+
/** Delete this item from the instance.
|
|
4095
|
+
* @param itemId The item identifier.
|
|
4096
|
+
*/
|
|
4097
|
+
delete(itemId: string): Promise<void>;
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
* Single job service for an AI Search instance.
|
|
4101
|
+
* Provides info and logs for a specific job.
|
|
4102
|
+
*/
|
|
4103
|
+
export declare abstract class AiSearchJob {
|
|
4104
|
+
/** Get metadata about this job. */
|
|
4105
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4106
|
+
/** Get logs for this job. */
|
|
4107
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4108
|
+
}
|
|
4109
|
+
/**
|
|
4110
|
+
* Jobs collection service for an AI Search instance.
|
|
4111
|
+
* Provides list, create, and access to individual jobs.
|
|
4112
|
+
*/
|
|
4113
|
+
export declare abstract class AiSearchJobs {
|
|
4114
|
+
/** List jobs for this instance. */
|
|
4115
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4116
|
+
/**
|
|
4117
|
+
* Create a new indexing job.
|
|
4118
|
+
* @param params Optional job parameters.
|
|
4119
|
+
* @returns The created job info.
|
|
4120
|
+
*/
|
|
4121
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4122
|
+
/**
|
|
4123
|
+
* Get a job by ID.
|
|
4124
|
+
* @param jobId The job identifier.
|
|
4125
|
+
* @returns Job service for info and logs operations.
|
|
4126
|
+
*/
|
|
4127
|
+
get(jobId: string): AiSearchJob;
|
|
4128
|
+
}
|
|
4129
|
+
// ============ AI Search Binding Classes ============
|
|
4130
|
+
/**
|
|
4131
|
+
* Instance-level AI Search service.
|
|
4132
|
+
*
|
|
4133
|
+
* Used as:
|
|
4134
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4135
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4136
|
+
*
|
|
4137
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4138
|
+
*
|
|
4139
|
+
* @example
|
|
4140
|
+
* ```ts
|
|
4141
|
+
* // Via namespace binding
|
|
4142
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4143
|
+
* const results = await instance.search({
|
|
4144
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4145
|
+
* });
|
|
4146
|
+
*
|
|
4147
|
+
* // Via single instance binding
|
|
4148
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4149
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4150
|
+
* });
|
|
4151
|
+
* ```
|
|
4152
|
+
*/
|
|
4153
|
+
export declare abstract class AiSearchInstance {
|
|
3926
4154
|
/**
|
|
3927
4155
|
* Search the AI Search instance for relevant chunks.
|
|
3928
|
-
* @param params Search request with messages and AI search options
|
|
3929
|
-
* @returns Search response with matching chunks
|
|
4156
|
+
* @param params Search request with messages and optional AI search options.
|
|
4157
|
+
* @returns Search response with matching chunks and search query.
|
|
3930
4158
|
*/
|
|
3931
4159
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4160
|
+
/**
|
|
4161
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4162
|
+
* @param params Chat completions request with stream: true.
|
|
4163
|
+
* @returns ReadableStream of server-sent events.
|
|
4164
|
+
*/
|
|
4165
|
+
chatCompletions(
|
|
4166
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4167
|
+
stream: true;
|
|
4168
|
+
},
|
|
4169
|
+
): Promise<ReadableStream>;
|
|
3932
4170
|
/**
|
|
3933
4171
|
* Generate chat completions with AI Search context.
|
|
3934
|
-
* @param params Chat completions request
|
|
3935
|
-
* @returns
|
|
4172
|
+
* @param params Chat completions request.
|
|
4173
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
3936
4174
|
*/
|
|
3937
4175
|
chatCompletions(
|
|
3938
4176
|
params: AiSearchChatCompletionsRequest,
|
|
3939
|
-
): Promise<
|
|
4177
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
3940
4178
|
/**
|
|
3941
|
-
*
|
|
4179
|
+
* Update the instance configuration.
|
|
4180
|
+
* @param config Partial configuration to update.
|
|
4181
|
+
* @returns Updated instance info.
|
|
3942
4182
|
*/
|
|
3943
|
-
|
|
4183
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4184
|
+
/** Get metadata about this instance. */
|
|
4185
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4186
|
+
/**
|
|
4187
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4188
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4189
|
+
*/
|
|
4190
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4191
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4192
|
+
get items(): AiSearchItems;
|
|
4193
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4194
|
+
get jobs(): AiSearchJobs;
|
|
3944
4195
|
}
|
|
3945
|
-
|
|
3946
|
-
|
|
4196
|
+
/**
|
|
4197
|
+
* Namespace-level AI Search service.
|
|
4198
|
+
*
|
|
4199
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4200
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4201
|
+
*
|
|
4202
|
+
* @example
|
|
4203
|
+
* ```ts
|
|
4204
|
+
* // Access an instance within the namespace
|
|
4205
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4206
|
+
* const results = await blog.search({
|
|
4207
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4208
|
+
* });
|
|
4209
|
+
*
|
|
4210
|
+
* // List all instances in the namespace
|
|
4211
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4212
|
+
*
|
|
4213
|
+
* // Create a new instance with built-in storage
|
|
4214
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4215
|
+
* id: "tenant-123",
|
|
4216
|
+
* });
|
|
4217
|
+
*
|
|
4218
|
+
* // Upload items into the instance
|
|
4219
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4220
|
+
*
|
|
4221
|
+
* // Delete an instance
|
|
4222
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4223
|
+
* ```
|
|
4224
|
+
*/
|
|
4225
|
+
export declare abstract class AiSearchNamespace {
|
|
3947
4226
|
/**
|
|
3948
|
-
*
|
|
3949
|
-
* @
|
|
4227
|
+
* Get an instance by name within the bound namespace.
|
|
4228
|
+
* @param name Instance name.
|
|
4229
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4230
|
+
*/
|
|
4231
|
+
get(name: string): AiSearchInstance;
|
|
4232
|
+
/**
|
|
4233
|
+
* List all instances in the bound namespace.
|
|
4234
|
+
* @returns Array of instance metadata.
|
|
3950
4235
|
*/
|
|
3951
4236
|
list(): Promise<AiSearchListResponse>;
|
|
3952
4237
|
/**
|
|
3953
|
-
*
|
|
3954
|
-
* @param
|
|
3955
|
-
* @returns Instance service for
|
|
4238
|
+
* Create a new instance within the bound namespace.
|
|
4239
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4240
|
+
* @returns Instance service for the newly created instance.
|
|
4241
|
+
*
|
|
4242
|
+
* @example
|
|
4243
|
+
* ```ts
|
|
4244
|
+
* // Create with built-in storage (upload items manually)
|
|
4245
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4246
|
+
*
|
|
4247
|
+
* // Create with web crawler source
|
|
4248
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4249
|
+
* id: "docs-search",
|
|
4250
|
+
* type: "web-crawler",
|
|
4251
|
+
* source: "https://developers.cloudflare.com",
|
|
4252
|
+
* });
|
|
4253
|
+
* ```
|
|
3956
4254
|
*/
|
|
3957
|
-
|
|
4255
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
3958
4256
|
/**
|
|
3959
|
-
*
|
|
3960
|
-
* @param
|
|
3961
|
-
* @returns Instance service for performing operations
|
|
4257
|
+
* Delete an instance from the bound namespace.
|
|
4258
|
+
* @param name Instance name to delete.
|
|
3962
4259
|
*/
|
|
3963
|
-
|
|
4260
|
+
delete(name: string): Promise<void>;
|
|
3964
4261
|
}
|
|
3965
4262
|
export type AiImageClassificationInput = {
|
|
3966
4263
|
image: number[];
|
|
@@ -9961,6 +10258,7 @@ export type AiOptions = {
|
|
|
9961
10258
|
returnRawResponse?: boolean;
|
|
9962
10259
|
prefix?: string;
|
|
9963
10260
|
extraHeaders?: object;
|
|
10261
|
+
signal?: AbortSignal;
|
|
9964
10262
|
};
|
|
9965
10263
|
export type AiModelsSearchParams = {
|
|
9966
10264
|
author?: string;
|
|
@@ -10006,46 +10304,16 @@ export declare abstract class Ai<
|
|
|
10006
10304
|
aiGatewayLogId: string | null;
|
|
10007
10305
|
gateway(gatewayId: string): AiGateway;
|
|
10008
10306
|
/**
|
|
10009
|
-
*
|
|
10010
|
-
*
|
|
10011
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10012
|
-
* - Account-level operations: `list()`, `create()`
|
|
10013
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10014
|
-
*
|
|
10015
|
-
* @example
|
|
10016
|
-
* ```typescript
|
|
10017
|
-
* // List all AI Search instances
|
|
10018
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10019
|
-
*
|
|
10020
|
-
* // Search an instance
|
|
10021
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10022
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10023
|
-
* ai_search_options: {
|
|
10024
|
-
* retrieval: { max_num_results: 10 }
|
|
10025
|
-
* }
|
|
10026
|
-
* });
|
|
10027
|
-
*
|
|
10028
|
-
* // Generate chat completions with AI Search context
|
|
10029
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10030
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10031
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10032
|
-
* });
|
|
10033
|
-
* ```
|
|
10307
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10308
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10034
10309
|
*/
|
|
10035
|
-
aiSearch():
|
|
10310
|
+
aiSearch(): AiSearchNamespace;
|
|
10036
10311
|
/**
|
|
10037
10312
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10038
|
-
* Use `
|
|
10039
|
-
*
|
|
10040
|
-
* Migration guide:
|
|
10041
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10042
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10043
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10313
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10314
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10044
10315
|
*
|
|
10045
|
-
*
|
|
10046
|
-
*
|
|
10047
|
-
* @see AiSearchAccountService
|
|
10048
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10316
|
+
* @param autoragId Instance ID
|
|
10049
10317
|
*/
|
|
10050
10318
|
autorag(autoragId: string): AutoRAG;
|
|
10051
10319
|
run<
|
|
@@ -10204,22 +10472,23 @@ export declare abstract class AiGateway {
|
|
|
10204
10472
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10205
10473
|
}
|
|
10206
10474
|
/**
|
|
10207
|
-
* @deprecated
|
|
10208
|
-
*
|
|
10475
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10476
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10209
10477
|
*/
|
|
10210
10478
|
export interface AutoRAGInternalError extends Error {}
|
|
10211
10479
|
/**
|
|
10212
|
-
* @deprecated
|
|
10213
|
-
*
|
|
10480
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10481
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10214
10482
|
*/
|
|
10215
10483
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10216
10484
|
/**
|
|
10217
|
-
* @deprecated
|
|
10485
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10486
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10218
10487
|
*/
|
|
10219
10488
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10220
10489
|
/**
|
|
10221
|
-
* @deprecated
|
|
10222
|
-
*
|
|
10490
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10491
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10223
10492
|
*/
|
|
10224
10493
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10225
10494
|
export type ComparisonFilter = {
|
|
@@ -10232,9 +10501,8 @@ export type CompoundFilter = {
|
|
|
10232
10501
|
filters: ComparisonFilter[];
|
|
10233
10502
|
};
|
|
10234
10503
|
/**
|
|
10235
|
-
* @deprecated
|
|
10236
|
-
*
|
|
10237
|
-
* @see AiSearchSearchRequest
|
|
10504
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10505
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10238
10506
|
*/
|
|
10239
10507
|
export type AutoRagSearchRequest = {
|
|
10240
10508
|
query: string;
|
|
@@ -10251,18 +10519,16 @@ export type AutoRagSearchRequest = {
|
|
|
10251
10519
|
rewrite_query?: boolean;
|
|
10252
10520
|
};
|
|
10253
10521
|
/**
|
|
10254
|
-
* @deprecated
|
|
10255
|
-
*
|
|
10256
|
-
* @see AiSearchChatCompletionsRequest
|
|
10522
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10523
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10257
10524
|
*/
|
|
10258
10525
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10259
10526
|
stream?: boolean;
|
|
10260
10527
|
system_prompt?: string;
|
|
10261
10528
|
};
|
|
10262
10529
|
/**
|
|
10263
|
-
* @deprecated
|
|
10264
|
-
*
|
|
10265
|
-
* @see AiSearchChatCompletionsRequest
|
|
10530
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10531
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10266
10532
|
*/
|
|
10267
10533
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10268
10534
|
AutoRagAiSearchRequest,
|
|
@@ -10271,9 +10537,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10271
10537
|
stream: true;
|
|
10272
10538
|
};
|
|
10273
10539
|
/**
|
|
10274
|
-
* @deprecated
|
|
10275
|
-
*
|
|
10276
|
-
* @see AiSearchSearchResponse
|
|
10540
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10541
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10277
10542
|
*/
|
|
10278
10543
|
export type AutoRagSearchResponse = {
|
|
10279
10544
|
object: "vector_store.search_results.page";
|
|
@@ -10292,9 +10557,8 @@ export type AutoRagSearchResponse = {
|
|
|
10292
10557
|
next_page: string | null;
|
|
10293
10558
|
};
|
|
10294
10559
|
/**
|
|
10295
|
-
* @deprecated
|
|
10296
|
-
*
|
|
10297
|
-
* @see AiSearchListResponse
|
|
10560
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10561
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10298
10562
|
*/
|
|
10299
10563
|
export type AutoRagListResponse = {
|
|
10300
10564
|
id: string;
|
|
@@ -10306,49 +10570,40 @@ export type AutoRagListResponse = {
|
|
|
10306
10570
|
status: string;
|
|
10307
10571
|
}[];
|
|
10308
10572
|
/**
|
|
10309
|
-
* @deprecated
|
|
10310
|
-
*
|
|
10573
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10574
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10311
10575
|
*/
|
|
10312
10576
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10313
10577
|
response: string;
|
|
10314
10578
|
};
|
|
10315
10579
|
/**
|
|
10316
|
-
* @deprecated
|
|
10317
|
-
*
|
|
10318
|
-
*
|
|
10319
|
-
* Migration guide:
|
|
10320
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10321
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10322
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10323
|
-
*
|
|
10324
|
-
* @see AiSearchAccountService
|
|
10325
|
-
* @see AiSearchInstanceService
|
|
10580
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10581
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10326
10582
|
*/
|
|
10327
10583
|
export declare abstract class AutoRAG {
|
|
10328
10584
|
/**
|
|
10329
|
-
* @deprecated Use
|
|
10330
|
-
*
|
|
10585
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10586
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10331
10587
|
*/
|
|
10332
10588
|
list(): Promise<AutoRagListResponse>;
|
|
10333
10589
|
/**
|
|
10334
|
-
* @deprecated Use
|
|
10335
|
-
*
|
|
10336
|
-
* @see AiSearchInstanceService.search
|
|
10590
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10591
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10337
10592
|
*/
|
|
10338
10593
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10339
10594
|
/**
|
|
10340
|
-
* @deprecated Use
|
|
10341
|
-
*
|
|
10595
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10596
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10342
10597
|
*/
|
|
10343
10598
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10344
10599
|
/**
|
|
10345
|
-
* @deprecated Use
|
|
10346
|
-
*
|
|
10600
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10601
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10347
10602
|
*/
|
|
10348
10603
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10349
10604
|
/**
|
|
10350
|
-
* @deprecated Use
|
|
10351
|
-
*
|
|
10605
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10606
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10352
10607
|
*/
|
|
10353
10608
|
aiSearch(
|
|
10354
10609
|
params: AutoRagAiSearchRequest,
|