@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/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;
|
|
@@ -3662,12 +3668,42 @@ export interface Container {
|
|
|
3662
3668
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3663
3669
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3664
3670
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3671
|
+
snapshotDirectory(
|
|
3672
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3673
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3674
|
+
snapshotContainer(
|
|
3675
|
+
options: ContainerSnapshotOptions,
|
|
3676
|
+
): Promise<ContainerSnapshot>;
|
|
3677
|
+
}
|
|
3678
|
+
export interface ContainerDirectorySnapshot {
|
|
3679
|
+
id: string;
|
|
3680
|
+
size: number;
|
|
3681
|
+
dir: string;
|
|
3682
|
+
name?: string;
|
|
3683
|
+
}
|
|
3684
|
+
export interface ContainerDirectorySnapshotOptions {
|
|
3685
|
+
dir: string;
|
|
3686
|
+
name?: string;
|
|
3687
|
+
}
|
|
3688
|
+
export interface ContainerDirectorySnapshotRestoreParams {
|
|
3689
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3690
|
+
mountPoint?: string;
|
|
3691
|
+
}
|
|
3692
|
+
export interface ContainerSnapshot {
|
|
3693
|
+
id: string;
|
|
3694
|
+
size: number;
|
|
3695
|
+
name?: string;
|
|
3696
|
+
}
|
|
3697
|
+
export interface ContainerSnapshotOptions {
|
|
3698
|
+
name?: string;
|
|
3665
3699
|
}
|
|
3666
3700
|
export interface ContainerStartupOptions {
|
|
3667
3701
|
entrypoint?: string[];
|
|
3668
3702
|
enableInternet: boolean;
|
|
3669
3703
|
env?: Record<string, string>;
|
|
3670
3704
|
labels?: Record<string, string>;
|
|
3705
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3706
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3671
3707
|
}
|
|
3672
3708
|
/**
|
|
3673
3709
|
* 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.
|
|
@@ -3794,11 +3830,10 @@ export declare abstract class Performance {
|
|
|
3794
3830
|
*/
|
|
3795
3831
|
toJSON(): object;
|
|
3796
3832
|
}
|
|
3797
|
-
// AI Search
|
|
3833
|
+
// ============ AI Search Error Interfaces ============
|
|
3798
3834
|
export interface AiSearchInternalError extends Error {}
|
|
3799
3835
|
export interface AiSearchNotFoundError extends Error {}
|
|
3800
|
-
|
|
3801
|
-
// AI Search V2 Request Types
|
|
3836
|
+
// ============ AI Search Request Types ============
|
|
3802
3837
|
export type AiSearchSearchRequest = {
|
|
3803
3838
|
messages: Array<{
|
|
3804
3839
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3823,9 +3858,8 @@ export type AiSearchSearchRequest = {
|
|
|
3823
3858
|
[key: string]: unknown;
|
|
3824
3859
|
};
|
|
3825
3860
|
reranking?: {
|
|
3826
|
-
/** Enable reranking (default false) */
|
|
3827
3861
|
enabled?: boolean;
|
|
3828
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3862
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3829
3863
|
/** Match threshold (0-1, default 0.4) */
|
|
3830
3864
|
match_threshold?: number;
|
|
3831
3865
|
[key: string]: unknown;
|
|
@@ -3837,6 +3871,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3837
3871
|
messages: Array<{
|
|
3838
3872
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3839
3873
|
content: string | null;
|
|
3874
|
+
[key: string]: unknown;
|
|
3840
3875
|
}>;
|
|
3841
3876
|
model?: string;
|
|
3842
3877
|
stream?: boolean;
|
|
@@ -3857,7 +3892,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3857
3892
|
};
|
|
3858
3893
|
reranking?: {
|
|
3859
3894
|
enabled?: boolean;
|
|
3860
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3895
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3861
3896
|
match_threshold?: number;
|
|
3862
3897
|
[key: string]: unknown;
|
|
3863
3898
|
};
|
|
@@ -3865,7 +3900,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3865
3900
|
};
|
|
3866
3901
|
[key: string]: unknown;
|
|
3867
3902
|
};
|
|
3868
|
-
// AI Search
|
|
3903
|
+
// ============ AI Search Response Types ============
|
|
3869
3904
|
export type AiSearchSearchResponse = {
|
|
3870
3905
|
search_query: string;
|
|
3871
3906
|
chunks: Array<{
|
|
@@ -3884,26 +3919,65 @@ export type AiSearchSearchResponse = {
|
|
|
3884
3919
|
keyword_score?: number;
|
|
3885
3920
|
/** Vector similarity score (0-1) */
|
|
3886
3921
|
vector_score?: number;
|
|
3922
|
+
[key: string]: unknown;
|
|
3887
3923
|
};
|
|
3888
3924
|
}>;
|
|
3889
3925
|
};
|
|
3890
|
-
export type
|
|
3926
|
+
export type AiSearchChatCompletionsResponse = {
|
|
3927
|
+
id?: string;
|
|
3928
|
+
object?: string;
|
|
3929
|
+
model?: string;
|
|
3930
|
+
choices: Array<{
|
|
3931
|
+
index?: number;
|
|
3932
|
+
message: {
|
|
3933
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3934
|
+
content: string | null;
|
|
3935
|
+
[key: string]: unknown;
|
|
3936
|
+
};
|
|
3937
|
+
[key: string]: unknown;
|
|
3938
|
+
}>;
|
|
3939
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
3940
|
+
[key: string]: unknown;
|
|
3941
|
+
};
|
|
3942
|
+
export type AiSearchStatsResponse = {
|
|
3943
|
+
queued?: number;
|
|
3944
|
+
running?: number;
|
|
3945
|
+
completed?: number;
|
|
3946
|
+
error?: number;
|
|
3947
|
+
skipped?: number;
|
|
3948
|
+
outdated?: number;
|
|
3949
|
+
last_activity?: string;
|
|
3950
|
+
};
|
|
3951
|
+
// ============ AI Search Instance Info Types ============
|
|
3952
|
+
export type AiSearchInstanceInfo = {
|
|
3891
3953
|
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";
|
|
3954
|
+
type?: "r2" | "web-crawler" | string;
|
|
3898
3955
|
source?: string;
|
|
3956
|
+
paused?: boolean;
|
|
3957
|
+
status?: string;
|
|
3958
|
+
namespace?: string;
|
|
3959
|
+
created_at?: string;
|
|
3960
|
+
modified_at?: string;
|
|
3899
3961
|
[key: string]: unknown;
|
|
3900
|
-
}
|
|
3962
|
+
};
|
|
3963
|
+
export type AiSearchListResponse = {
|
|
3964
|
+
result: AiSearchInstanceInfo[];
|
|
3965
|
+
result_info?: {
|
|
3966
|
+
count: number;
|
|
3967
|
+
page: number;
|
|
3968
|
+
per_page: number;
|
|
3969
|
+
total_count: number;
|
|
3970
|
+
};
|
|
3971
|
+
};
|
|
3972
|
+
// ============ AI Search Config Types ============
|
|
3901
3973
|
export type AiSearchConfig = {
|
|
3902
3974
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3903
3975
|
id: string;
|
|
3904
|
-
type
|
|
3905
|
-
|
|
3906
|
-
|
|
3976
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
3977
|
+
type?: "r2" | "web-crawler" | string;
|
|
3978
|
+
/** Source URL (required for web-crawler type). */
|
|
3979
|
+
source?: string;
|
|
3980
|
+
source_params?: unknown;
|
|
3907
3981
|
/** Token ID (UUID format) */
|
|
3908
3982
|
token_id?: string;
|
|
3909
3983
|
ai_gateway_id?: string;
|
|
@@ -3913,54 +3987,307 @@ export type AiSearchConfig = {
|
|
|
3913
3987
|
reranking?: boolean;
|
|
3914
3988
|
embedding_model?: string;
|
|
3915
3989
|
ai_search_model?: string;
|
|
3990
|
+
[key: string]: unknown;
|
|
3916
3991
|
};
|
|
3917
|
-
|
|
3992
|
+
// ============ AI Search Item Types ============
|
|
3993
|
+
export type AiSearchItemInfo = {
|
|
3918
3994
|
id: string;
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3995
|
+
key: string;
|
|
3996
|
+
status:
|
|
3997
|
+
| "completed"
|
|
3998
|
+
| "error"
|
|
3999
|
+
| "skipped"
|
|
4000
|
+
| "queued"
|
|
4001
|
+
| "processing"
|
|
4002
|
+
| "outdated";
|
|
4003
|
+
metadata?: Record<string, unknown>;
|
|
3922
4004
|
[key: string]: unknown;
|
|
3923
4005
|
};
|
|
3924
|
-
|
|
3925
|
-
|
|
4006
|
+
export type AiSearchItemContentResult = {
|
|
4007
|
+
body: ReadableStream;
|
|
4008
|
+
contentType: string;
|
|
4009
|
+
filename: string;
|
|
4010
|
+
size: number;
|
|
4011
|
+
};
|
|
4012
|
+
export type AiSearchUploadItemOptions = {
|
|
4013
|
+
metadata?: Record<string, unknown>;
|
|
4014
|
+
};
|
|
4015
|
+
export type AiSearchListItemsParams = {
|
|
4016
|
+
page?: number;
|
|
4017
|
+
per_page?: number;
|
|
4018
|
+
};
|
|
4019
|
+
export type AiSearchListItemsResponse = {
|
|
4020
|
+
result: AiSearchItemInfo[];
|
|
4021
|
+
result_info?: {
|
|
4022
|
+
count: number;
|
|
4023
|
+
page: number;
|
|
4024
|
+
per_page: number;
|
|
4025
|
+
total_count: number;
|
|
4026
|
+
};
|
|
4027
|
+
};
|
|
4028
|
+
// ============ AI Search Job Types ============
|
|
4029
|
+
export type AiSearchJobInfo = {
|
|
4030
|
+
id: string;
|
|
4031
|
+
source: "user" | "schedule";
|
|
4032
|
+
description?: string;
|
|
4033
|
+
last_seen_at?: string;
|
|
4034
|
+
started_at?: string;
|
|
4035
|
+
ended_at?: string;
|
|
4036
|
+
end_reason?: string;
|
|
4037
|
+
};
|
|
4038
|
+
export type AiSearchJobLog = {
|
|
4039
|
+
id: number;
|
|
4040
|
+
message: string;
|
|
4041
|
+
message_type: number;
|
|
4042
|
+
created_at: number;
|
|
4043
|
+
};
|
|
4044
|
+
export type AiSearchCreateJobParams = {
|
|
4045
|
+
description?: string;
|
|
4046
|
+
};
|
|
4047
|
+
export type AiSearchListJobsParams = {
|
|
4048
|
+
page?: number;
|
|
4049
|
+
per_page?: number;
|
|
4050
|
+
};
|
|
4051
|
+
export type AiSearchListJobsResponse = {
|
|
4052
|
+
result: AiSearchJobInfo[];
|
|
4053
|
+
result_info?: {
|
|
4054
|
+
count: number;
|
|
4055
|
+
page: number;
|
|
4056
|
+
per_page: number;
|
|
4057
|
+
total_count: number;
|
|
4058
|
+
};
|
|
4059
|
+
};
|
|
4060
|
+
export type AiSearchJobLogsParams = {
|
|
4061
|
+
page?: number;
|
|
4062
|
+
per_page?: number;
|
|
4063
|
+
};
|
|
4064
|
+
export type AiSearchJobLogsResponse = {
|
|
4065
|
+
result: AiSearchJobLog[];
|
|
4066
|
+
result_info?: {
|
|
4067
|
+
count: number;
|
|
4068
|
+
page: number;
|
|
4069
|
+
per_page: number;
|
|
4070
|
+
total_count: number;
|
|
4071
|
+
};
|
|
4072
|
+
};
|
|
4073
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4074
|
+
/**
|
|
4075
|
+
* Single item service for an AI Search instance.
|
|
4076
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4077
|
+
*/
|
|
4078
|
+
export declare abstract class AiSearchItem {
|
|
4079
|
+
/** Get metadata about this item. */
|
|
4080
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4081
|
+
/**
|
|
4082
|
+
* Download the item's content.
|
|
4083
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4084
|
+
*/
|
|
4085
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4086
|
+
}
|
|
4087
|
+
/**
|
|
4088
|
+
* Items collection service for an AI Search instance.
|
|
4089
|
+
* Provides list, upload, and access to individual items.
|
|
4090
|
+
*/
|
|
4091
|
+
export declare abstract class AiSearchItems {
|
|
4092
|
+
/** List items in this instance. */
|
|
4093
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4094
|
+
/**
|
|
4095
|
+
* Upload a file as an item.
|
|
4096
|
+
* @param name Filename for the uploaded item.
|
|
4097
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4098
|
+
* @param options Optional metadata to attach to the item.
|
|
4099
|
+
* @returns The created item info.
|
|
4100
|
+
*/
|
|
4101
|
+
upload(
|
|
4102
|
+
name: string,
|
|
4103
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4104
|
+
options?: AiSearchUploadItemOptions,
|
|
4105
|
+
): Promise<AiSearchItemInfo>;
|
|
4106
|
+
/**
|
|
4107
|
+
* Upload a file and poll until processing completes.
|
|
4108
|
+
* @param name Filename for the uploaded item.
|
|
4109
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4110
|
+
* @param options Optional metadata to attach to the item.
|
|
4111
|
+
* @returns The item info after processing completes (or timeout).
|
|
4112
|
+
*/
|
|
4113
|
+
uploadAndPoll(
|
|
4114
|
+
name: string,
|
|
4115
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4116
|
+
options?: AiSearchUploadItemOptions,
|
|
4117
|
+
): Promise<AiSearchItemInfo>;
|
|
4118
|
+
/**
|
|
4119
|
+
* Get an item by ID.
|
|
4120
|
+
* @param itemId The item identifier.
|
|
4121
|
+
* @returns Item service for info, delete, and download operations.
|
|
4122
|
+
*/
|
|
4123
|
+
get(itemId: string): AiSearchItem;
|
|
4124
|
+
/** Delete this item from the instance.
|
|
4125
|
+
* @param itemId The item identifier.
|
|
4126
|
+
*/
|
|
4127
|
+
delete(itemId: string): Promise<void>;
|
|
4128
|
+
}
|
|
4129
|
+
/**
|
|
4130
|
+
* Single job service for an AI Search instance.
|
|
4131
|
+
* Provides info and logs for a specific job.
|
|
4132
|
+
*/
|
|
4133
|
+
export declare abstract class AiSearchJob {
|
|
4134
|
+
/** Get metadata about this job. */
|
|
4135
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4136
|
+
/** Get logs for this job. */
|
|
4137
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4138
|
+
}
|
|
4139
|
+
/**
|
|
4140
|
+
* Jobs collection service for an AI Search instance.
|
|
4141
|
+
* Provides list, create, and access to individual jobs.
|
|
4142
|
+
*/
|
|
4143
|
+
export declare abstract class AiSearchJobs {
|
|
4144
|
+
/** List jobs for this instance. */
|
|
4145
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4146
|
+
/**
|
|
4147
|
+
* Create a new indexing job.
|
|
4148
|
+
* @param params Optional job parameters.
|
|
4149
|
+
* @returns The created job info.
|
|
4150
|
+
*/
|
|
4151
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4152
|
+
/**
|
|
4153
|
+
* Get a job by ID.
|
|
4154
|
+
* @param jobId The job identifier.
|
|
4155
|
+
* @returns Job service for info and logs operations.
|
|
4156
|
+
*/
|
|
4157
|
+
get(jobId: string): AiSearchJob;
|
|
4158
|
+
}
|
|
4159
|
+
// ============ AI Search Binding Classes ============
|
|
4160
|
+
/**
|
|
4161
|
+
* Instance-level AI Search service.
|
|
4162
|
+
*
|
|
4163
|
+
* Used as:
|
|
4164
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4165
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4166
|
+
*
|
|
4167
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4168
|
+
*
|
|
4169
|
+
* @example
|
|
4170
|
+
* ```ts
|
|
4171
|
+
* // Via namespace binding
|
|
4172
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4173
|
+
* const results = await instance.search({
|
|
4174
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4175
|
+
* });
|
|
4176
|
+
*
|
|
4177
|
+
* // Via single instance binding
|
|
4178
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4179
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4180
|
+
* });
|
|
4181
|
+
* ```
|
|
4182
|
+
*/
|
|
4183
|
+
export declare abstract class AiSearchInstance {
|
|
3926
4184
|
/**
|
|
3927
4185
|
* 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
|
|
4186
|
+
* @param params Search request with messages and optional AI search options.
|
|
4187
|
+
* @returns Search response with matching chunks and search query.
|
|
3930
4188
|
*/
|
|
3931
4189
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4190
|
+
/**
|
|
4191
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4192
|
+
* @param params Chat completions request with stream: true.
|
|
4193
|
+
* @returns ReadableStream of server-sent events.
|
|
4194
|
+
*/
|
|
4195
|
+
chatCompletions(
|
|
4196
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4197
|
+
stream: true;
|
|
4198
|
+
},
|
|
4199
|
+
): Promise<ReadableStream>;
|
|
3932
4200
|
/**
|
|
3933
4201
|
* Generate chat completions with AI Search context.
|
|
3934
|
-
* @param params Chat completions request
|
|
3935
|
-
* @returns
|
|
4202
|
+
* @param params Chat completions request.
|
|
4203
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
3936
4204
|
*/
|
|
3937
4205
|
chatCompletions(
|
|
3938
4206
|
params: AiSearchChatCompletionsRequest,
|
|
3939
|
-
): Promise<
|
|
4207
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
3940
4208
|
/**
|
|
3941
|
-
*
|
|
4209
|
+
* Update the instance configuration.
|
|
4210
|
+
* @param config Partial configuration to update.
|
|
4211
|
+
* @returns Updated instance info.
|
|
3942
4212
|
*/
|
|
3943
|
-
|
|
4213
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4214
|
+
/** Get metadata about this instance. */
|
|
4215
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4216
|
+
/**
|
|
4217
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4218
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4219
|
+
*/
|
|
4220
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4221
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4222
|
+
get items(): AiSearchItems;
|
|
4223
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4224
|
+
get jobs(): AiSearchJobs;
|
|
3944
4225
|
}
|
|
3945
|
-
|
|
3946
|
-
|
|
4226
|
+
/**
|
|
4227
|
+
* Namespace-level AI Search service.
|
|
4228
|
+
*
|
|
4229
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4230
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4231
|
+
*
|
|
4232
|
+
* @example
|
|
4233
|
+
* ```ts
|
|
4234
|
+
* // Access an instance within the namespace
|
|
4235
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4236
|
+
* const results = await blog.search({
|
|
4237
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4238
|
+
* });
|
|
4239
|
+
*
|
|
4240
|
+
* // List all instances in the namespace
|
|
4241
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4242
|
+
*
|
|
4243
|
+
* // Create a new instance with built-in storage
|
|
4244
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4245
|
+
* id: "tenant-123",
|
|
4246
|
+
* });
|
|
4247
|
+
*
|
|
4248
|
+
* // Upload items into the instance
|
|
4249
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4250
|
+
*
|
|
4251
|
+
* // Delete an instance
|
|
4252
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4253
|
+
* ```
|
|
4254
|
+
*/
|
|
4255
|
+
export declare abstract class AiSearchNamespace {
|
|
3947
4256
|
/**
|
|
3948
|
-
*
|
|
3949
|
-
* @
|
|
4257
|
+
* Get an instance by name within the bound namespace.
|
|
4258
|
+
* @param name Instance name.
|
|
4259
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4260
|
+
*/
|
|
4261
|
+
get(name: string): AiSearchInstance;
|
|
4262
|
+
/**
|
|
4263
|
+
* List all instances in the bound namespace.
|
|
4264
|
+
* @returns Array of instance metadata.
|
|
3950
4265
|
*/
|
|
3951
4266
|
list(): Promise<AiSearchListResponse>;
|
|
3952
4267
|
/**
|
|
3953
|
-
*
|
|
3954
|
-
* @param
|
|
3955
|
-
* @returns Instance service for
|
|
4268
|
+
* Create a new instance within the bound namespace.
|
|
4269
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4270
|
+
* @returns Instance service for the newly created instance.
|
|
4271
|
+
*
|
|
4272
|
+
* @example
|
|
4273
|
+
* ```ts
|
|
4274
|
+
* // Create with built-in storage (upload items manually)
|
|
4275
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4276
|
+
*
|
|
4277
|
+
* // Create with web crawler source
|
|
4278
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4279
|
+
* id: "docs-search",
|
|
4280
|
+
* type: "web-crawler",
|
|
4281
|
+
* source: "https://developers.cloudflare.com",
|
|
4282
|
+
* });
|
|
4283
|
+
* ```
|
|
3956
4284
|
*/
|
|
3957
|
-
|
|
4285
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
3958
4286
|
/**
|
|
3959
|
-
*
|
|
3960
|
-
* @param
|
|
3961
|
-
* @returns Instance service for performing operations
|
|
4287
|
+
* Delete an instance from the bound namespace.
|
|
4288
|
+
* @param name Instance name to delete.
|
|
3962
4289
|
*/
|
|
3963
|
-
|
|
4290
|
+
delete(name: string): Promise<void>;
|
|
3964
4291
|
}
|
|
3965
4292
|
export type AiImageClassificationInput = {
|
|
3966
4293
|
image: number[];
|
|
@@ -9961,6 +10288,7 @@ export type AiOptions = {
|
|
|
9961
10288
|
returnRawResponse?: boolean;
|
|
9962
10289
|
prefix?: string;
|
|
9963
10290
|
extraHeaders?: object;
|
|
10291
|
+
signal?: AbortSignal;
|
|
9964
10292
|
};
|
|
9965
10293
|
export type AiModelsSearchParams = {
|
|
9966
10294
|
author?: string;
|
|
@@ -10006,46 +10334,16 @@ export declare abstract class Ai<
|
|
|
10006
10334
|
aiGatewayLogId: string | null;
|
|
10007
10335
|
gateway(gatewayId: string): AiGateway;
|
|
10008
10336
|
/**
|
|
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
|
-
* ```
|
|
10337
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10338
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10034
10339
|
*/
|
|
10035
|
-
aiSearch():
|
|
10340
|
+
aiSearch(): AiSearchNamespace;
|
|
10036
10341
|
/**
|
|
10037
10342
|
* @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(...)`
|
|
10343
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10344
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10044
10345
|
*
|
|
10045
|
-
*
|
|
10046
|
-
*
|
|
10047
|
-
* @see AiSearchAccountService
|
|
10048
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10346
|
+
* @param autoragId Instance ID
|
|
10049
10347
|
*/
|
|
10050
10348
|
autorag(autoragId: string): AutoRAG;
|
|
10051
10349
|
run<
|
|
@@ -10204,22 +10502,23 @@ export declare abstract class AiGateway {
|
|
|
10204
10502
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10205
10503
|
}
|
|
10206
10504
|
/**
|
|
10207
|
-
* @deprecated
|
|
10208
|
-
*
|
|
10505
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10506
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10209
10507
|
*/
|
|
10210
10508
|
export interface AutoRAGInternalError extends Error {}
|
|
10211
10509
|
/**
|
|
10212
|
-
* @deprecated
|
|
10213
|
-
*
|
|
10510
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10511
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10214
10512
|
*/
|
|
10215
10513
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10216
10514
|
/**
|
|
10217
|
-
* @deprecated
|
|
10515
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10516
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10218
10517
|
*/
|
|
10219
10518
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10220
10519
|
/**
|
|
10221
|
-
* @deprecated
|
|
10222
|
-
*
|
|
10520
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10521
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10223
10522
|
*/
|
|
10224
10523
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10225
10524
|
export type ComparisonFilter = {
|
|
@@ -10232,9 +10531,8 @@ export type CompoundFilter = {
|
|
|
10232
10531
|
filters: ComparisonFilter[];
|
|
10233
10532
|
};
|
|
10234
10533
|
/**
|
|
10235
|
-
* @deprecated
|
|
10236
|
-
*
|
|
10237
|
-
* @see AiSearchSearchRequest
|
|
10534
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10535
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10238
10536
|
*/
|
|
10239
10537
|
export type AutoRagSearchRequest = {
|
|
10240
10538
|
query: string;
|
|
@@ -10251,18 +10549,16 @@ export type AutoRagSearchRequest = {
|
|
|
10251
10549
|
rewrite_query?: boolean;
|
|
10252
10550
|
};
|
|
10253
10551
|
/**
|
|
10254
|
-
* @deprecated
|
|
10255
|
-
*
|
|
10256
|
-
* @see AiSearchChatCompletionsRequest
|
|
10552
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10553
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10257
10554
|
*/
|
|
10258
10555
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10259
10556
|
stream?: boolean;
|
|
10260
10557
|
system_prompt?: string;
|
|
10261
10558
|
};
|
|
10262
10559
|
/**
|
|
10263
|
-
* @deprecated
|
|
10264
|
-
*
|
|
10265
|
-
* @see AiSearchChatCompletionsRequest
|
|
10560
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10561
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10266
10562
|
*/
|
|
10267
10563
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10268
10564
|
AutoRagAiSearchRequest,
|
|
@@ -10271,9 +10567,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10271
10567
|
stream: true;
|
|
10272
10568
|
};
|
|
10273
10569
|
/**
|
|
10274
|
-
* @deprecated
|
|
10275
|
-
*
|
|
10276
|
-
* @see AiSearchSearchResponse
|
|
10570
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10571
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10277
10572
|
*/
|
|
10278
10573
|
export type AutoRagSearchResponse = {
|
|
10279
10574
|
object: "vector_store.search_results.page";
|
|
@@ -10292,9 +10587,8 @@ export type AutoRagSearchResponse = {
|
|
|
10292
10587
|
next_page: string | null;
|
|
10293
10588
|
};
|
|
10294
10589
|
/**
|
|
10295
|
-
* @deprecated
|
|
10296
|
-
*
|
|
10297
|
-
* @see AiSearchListResponse
|
|
10590
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10591
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10298
10592
|
*/
|
|
10299
10593
|
export type AutoRagListResponse = {
|
|
10300
10594
|
id: string;
|
|
@@ -10306,49 +10600,40 @@ export type AutoRagListResponse = {
|
|
|
10306
10600
|
status: string;
|
|
10307
10601
|
}[];
|
|
10308
10602
|
/**
|
|
10309
|
-
* @deprecated
|
|
10310
|
-
*
|
|
10603
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10604
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10311
10605
|
*/
|
|
10312
10606
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10313
10607
|
response: string;
|
|
10314
10608
|
};
|
|
10315
10609
|
/**
|
|
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
|
|
10610
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10611
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10326
10612
|
*/
|
|
10327
10613
|
export declare abstract class AutoRAG {
|
|
10328
10614
|
/**
|
|
10329
|
-
* @deprecated Use
|
|
10330
|
-
*
|
|
10615
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10616
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10331
10617
|
*/
|
|
10332
10618
|
list(): Promise<AutoRagListResponse>;
|
|
10333
10619
|
/**
|
|
10334
|
-
* @deprecated Use
|
|
10335
|
-
*
|
|
10336
|
-
* @see AiSearchInstanceService.search
|
|
10620
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10621
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10337
10622
|
*/
|
|
10338
10623
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10339
10624
|
/**
|
|
10340
|
-
* @deprecated Use
|
|
10341
|
-
*
|
|
10625
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10626
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10342
10627
|
*/
|
|
10343
10628
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10344
10629
|
/**
|
|
10345
|
-
* @deprecated Use
|
|
10346
|
-
*
|
|
10630
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10631
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10347
10632
|
*/
|
|
10348
10633
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10349
10634
|
/**
|
|
10350
|
-
* @deprecated Use
|
|
10351
|
-
*
|
|
10635
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10636
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10352
10637
|
*/
|
|
10353
10638
|
aiSearch(
|
|
10354
10639
|
params: AutoRagAiSearchRequest,
|
|
@@ -12874,14 +13159,13 @@ export interface StreamScopedCaptions {
|
|
|
12874
13159
|
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
|
|
12875
13160
|
* One caption or subtitle file per language is allowed.
|
|
12876
13161
|
* @param language The BCP 47 language tag for the caption or subtitle.
|
|
12877
|
-
* @param
|
|
13162
|
+
* @param input The caption or subtitle stream to upload.
|
|
12878
13163
|
* @returns The created caption entry.
|
|
12879
13164
|
* @throws {NotFoundError} if the video is not found
|
|
12880
13165
|
* @throws {BadRequestError} if the language or file is invalid
|
|
12881
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12882
13166
|
* @throws {InternalError} if an unexpected error occurs
|
|
12883
13167
|
*/
|
|
12884
|
-
upload(language: string,
|
|
13168
|
+
upload(language: string, input: ReadableStream): Promise<StreamCaption>;
|
|
12885
13169
|
/**
|
|
12886
13170
|
* Generate captions or subtitles for the provided language via AI.
|
|
12887
13171
|
* @param language The BCP 47 language tag to generate.
|
|
@@ -12957,17 +13241,16 @@ export interface StreamVideos {
|
|
|
12957
13241
|
export interface StreamWatermarks {
|
|
12958
13242
|
/**
|
|
12959
13243
|
* Generate a new watermark profile
|
|
12960
|
-
* @param
|
|
13244
|
+
* @param input The image stream to upload
|
|
12961
13245
|
* @param params The watermark creation parameters.
|
|
12962
13246
|
* @returns The created watermark profile.
|
|
12963
13247
|
* @throws {BadRequestError} if the parameters are invalid
|
|
12964
13248
|
* @throws {InvalidURLError} if the URL is invalid
|
|
12965
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12966
13249
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
12967
13250
|
* @throws {InternalError} if an unexpected error occurs
|
|
12968
13251
|
*/
|
|
12969
13252
|
generate(
|
|
12970
|
-
|
|
13253
|
+
input: ReadableStream,
|
|
12971
13254
|
params: StreamWatermarkCreateParams,
|
|
12972
13255
|
): Promise<StreamWatermark>;
|
|
12973
13256
|
/**
|
|
@@ -12977,7 +13260,6 @@ export interface StreamWatermarks {
|
|
|
12977
13260
|
* @returns The created watermark profile.
|
|
12978
13261
|
* @throws {BadRequestError} if the parameters are invalid
|
|
12979
13262
|
* @throws {InvalidURLError} if the URL is invalid
|
|
12980
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12981
13263
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
12982
13264
|
* @throws {InternalError} if an unexpected error occurs
|
|
12983
13265
|
*/
|