@cloudflare/workers-types 4.20260219.0 → 4.20260226.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 +395 -17
- package/2021-11-03/index.ts +395 -17
- package/2022-01-31/index.d.ts +395 -17
- package/2022-01-31/index.ts +395 -17
- package/2022-03-21/index.d.ts +395 -17
- package/2022-03-21/index.ts +395 -17
- package/2022-08-04/index.d.ts +395 -17
- package/2022-08-04/index.ts +395 -17
- package/2022-10-31/index.d.ts +395 -17
- package/2022-10-31/index.ts +395 -17
- package/2022-11-30/index.d.ts +395 -17
- package/2022-11-30/index.ts +395 -17
- package/2023-03-01/index.d.ts +395 -17
- package/2023-03-01/index.ts +395 -17
- package/2023-07-01/index.d.ts +395 -17
- package/2023-07-01/index.ts +395 -17
- package/experimental/index.d.ts +442 -20
- package/experimental/index.ts +442 -20
- package/index.d.ts +395 -17
- package/index.ts +395 -17
- package/latest/index.d.ts +395 -17
- package/latest/index.ts +395 -17
- package/oldest/index.d.ts +395 -17
- package/oldest/index.ts +395 -17
- package/package.json +1 -1
package/experimental/index.ts
CHANGED
|
@@ -640,10 +640,16 @@ export type DurableObjectRoutingMode = "primary-only";
|
|
|
640
640
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
641
641
|
locationHint?: DurableObjectLocationHint;
|
|
642
642
|
routingMode?: DurableObjectRoutingMode;
|
|
643
|
+
version?: {
|
|
644
|
+
cohort?: string;
|
|
645
|
+
};
|
|
643
646
|
}
|
|
644
647
|
export interface DurableObjectClass<
|
|
645
648
|
_T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
646
649
|
> {}
|
|
650
|
+
export interface DurableObjectNamespaceGetDurableObjectOptionsVersionOptions {
|
|
651
|
+
cohort?: string;
|
|
652
|
+
}
|
|
647
653
|
export interface DurableObjectState<Props = unknown> {
|
|
648
654
|
waitUntil(promise: Promise<any>): void;
|
|
649
655
|
readonly exports: Cloudflare.Exports;
|
|
@@ -652,6 +658,7 @@ export interface DurableObjectState<Props = unknown> {
|
|
|
652
658
|
readonly storage: DurableObjectStorage;
|
|
653
659
|
container?: Container;
|
|
654
660
|
facets: DurableObjectFacets;
|
|
661
|
+
version?: DurableObjectStateVersion;
|
|
655
662
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
656
663
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
657
664
|
getWebSockets(tag?: string): WebSocket[];
|
|
@@ -786,6 +793,9 @@ export interface FacetStartupOptions<
|
|
|
786
793
|
id?: DurableObjectId | string;
|
|
787
794
|
class: DurableObjectClass<T>;
|
|
788
795
|
}
|
|
796
|
+
export interface DurableObjectStateVersion {
|
|
797
|
+
cohort?: string;
|
|
798
|
+
}
|
|
789
799
|
export interface AnalyticsEngineDataset {
|
|
790
800
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
791
801
|
}
|
|
@@ -3850,6 +3860,8 @@ export interface Container {
|
|
|
3850
3860
|
signal(signo: number): void;
|
|
3851
3861
|
getTcpPort(port: number): Fetcher;
|
|
3852
3862
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3863
|
+
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3864
|
+
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3853
3865
|
}
|
|
3854
3866
|
export interface ContainerStartupOptions {
|
|
3855
3867
|
entrypoint?: string[];
|
|
@@ -4096,8 +4108,18 @@ export type LoopbackServiceStub<
|
|
|
4096
4108
|
T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
|
|
4097
4109
|
> = Fetcher<T> &
|
|
4098
4110
|
(T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props>
|
|
4099
|
-
? (opts: {
|
|
4100
|
-
|
|
4111
|
+
? (opts: {
|
|
4112
|
+
props?: Props;
|
|
4113
|
+
version?: {
|
|
4114
|
+
cohort?: string | null;
|
|
4115
|
+
};
|
|
4116
|
+
}) => Fetcher<T>
|
|
4117
|
+
: (opts: {
|
|
4118
|
+
props?: any;
|
|
4119
|
+
version?: {
|
|
4120
|
+
cohort?: string | null;
|
|
4121
|
+
};
|
|
4122
|
+
}) => Fetcher<T>);
|
|
4101
4123
|
export type LoopbackDurableObjectClass<
|
|
4102
4124
|
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
4103
4125
|
> = DurableObjectClass<T> &
|
|
@@ -4229,10 +4251,32 @@ export declare abstract class Performance extends EventTarget {
|
|
|
4229
4251
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize)
|
|
4230
4252
|
*/
|
|
4231
4253
|
setResourceTimingBufferSize(size: number): void;
|
|
4232
|
-
|
|
4254
|
+
get nodeTiming(): PerformanceNodeTiming;
|
|
4255
|
+
eventLoopUtilization(): PerformanceEventLoopUtilization;
|
|
4233
4256
|
markResourceTiming(): void;
|
|
4234
4257
|
timerify(fn: () => void): () => void;
|
|
4235
4258
|
}
|
|
4259
|
+
export interface PerformanceEventLoopUtilization {
|
|
4260
|
+
idle: number;
|
|
4261
|
+
active: number;
|
|
4262
|
+
utilization: number;
|
|
4263
|
+
}
|
|
4264
|
+
export interface PerformanceNodeTiming extends PerformanceEntry {
|
|
4265
|
+
readonly nodeStart: number;
|
|
4266
|
+
readonly v8Start: number;
|
|
4267
|
+
readonly bootstrapComplete: number;
|
|
4268
|
+
readonly environment: number;
|
|
4269
|
+
readonly loopStart: number;
|
|
4270
|
+
readonly loopExit: number;
|
|
4271
|
+
readonly idleTime: number;
|
|
4272
|
+
readonly uvMetricsInfo: UvMetricsInfo;
|
|
4273
|
+
toJSON(): any;
|
|
4274
|
+
}
|
|
4275
|
+
export interface UvMetricsInfo {
|
|
4276
|
+
loopCount: number;
|
|
4277
|
+
events: number;
|
|
4278
|
+
eventsWaiting: number;
|
|
4279
|
+
}
|
|
4236
4280
|
/**
|
|
4237
4281
|
* **`PerformanceMark`** is an interface for PerformanceEntry objects with an PerformanceEntry.entryType of `'mark'`.
|
|
4238
4282
|
*
|
|
@@ -4495,6 +4539,184 @@ export interface EventCounts {
|
|
|
4495
4539
|
): void;
|
|
4496
4540
|
[Symbol.iterator](): IterableIterator<string[]>;
|
|
4497
4541
|
}
|
|
4542
|
+
// AI Search V2 API Error Interfaces
|
|
4543
|
+
export interface AiSearchInternalError extends Error {}
|
|
4544
|
+
export interface AiSearchNotFoundError extends Error {}
|
|
4545
|
+
export interface AiSearchNameNotSetError extends Error {}
|
|
4546
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
4547
|
+
export type ComparisonFilter = {
|
|
4548
|
+
key: string;
|
|
4549
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
4550
|
+
value: string | number | boolean;
|
|
4551
|
+
};
|
|
4552
|
+
export type CompoundFilter = {
|
|
4553
|
+
type: "and" | "or";
|
|
4554
|
+
filters: ComparisonFilter[];
|
|
4555
|
+
};
|
|
4556
|
+
// AI Search V2 Request Types
|
|
4557
|
+
export type AiSearchSearchRequest = {
|
|
4558
|
+
messages: Array<{
|
|
4559
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4560
|
+
content: string | null;
|
|
4561
|
+
}>;
|
|
4562
|
+
ai_search_options?: {
|
|
4563
|
+
retrieval?: {
|
|
4564
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
4565
|
+
/** Match threshold (0-1, default 0.4) */
|
|
4566
|
+
match_threshold?: number;
|
|
4567
|
+
/** Maximum number of results (1-50, default 10) */
|
|
4568
|
+
max_num_results?: number;
|
|
4569
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
4570
|
+
/** Context expansion (0-3, default 0) */
|
|
4571
|
+
context_expansion?: number;
|
|
4572
|
+
[key: string]: unknown;
|
|
4573
|
+
};
|
|
4574
|
+
query_rewrite?: {
|
|
4575
|
+
enabled?: boolean;
|
|
4576
|
+
model?: string;
|
|
4577
|
+
rewrite_prompt?: string;
|
|
4578
|
+
[key: string]: unknown;
|
|
4579
|
+
};
|
|
4580
|
+
reranking?: {
|
|
4581
|
+
/** Enable reranking (default false) */
|
|
4582
|
+
enabled?: boolean;
|
|
4583
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
4584
|
+
/** Match threshold (0-1, default 0.4) */
|
|
4585
|
+
match_threshold?: number;
|
|
4586
|
+
[key: string]: unknown;
|
|
4587
|
+
};
|
|
4588
|
+
[key: string]: unknown;
|
|
4589
|
+
};
|
|
4590
|
+
};
|
|
4591
|
+
export type AiSearchChatCompletionsRequest = {
|
|
4592
|
+
messages: Array<{
|
|
4593
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4594
|
+
content: string | null;
|
|
4595
|
+
}>;
|
|
4596
|
+
model?: string;
|
|
4597
|
+
stream?: boolean;
|
|
4598
|
+
ai_search_options?: {
|
|
4599
|
+
retrieval?: {
|
|
4600
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
4601
|
+
match_threshold?: number;
|
|
4602
|
+
max_num_results?: number;
|
|
4603
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
4604
|
+
context_expansion?: number;
|
|
4605
|
+
[key: string]: unknown;
|
|
4606
|
+
};
|
|
4607
|
+
query_rewrite?: {
|
|
4608
|
+
enabled?: boolean;
|
|
4609
|
+
model?: string;
|
|
4610
|
+
rewrite_prompt?: string;
|
|
4611
|
+
[key: string]: unknown;
|
|
4612
|
+
};
|
|
4613
|
+
reranking?: {
|
|
4614
|
+
enabled?: boolean;
|
|
4615
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
4616
|
+
match_threshold?: number;
|
|
4617
|
+
[key: string]: unknown;
|
|
4618
|
+
};
|
|
4619
|
+
[key: string]: unknown;
|
|
4620
|
+
};
|
|
4621
|
+
[key: string]: unknown;
|
|
4622
|
+
};
|
|
4623
|
+
// AI Search V2 Response Types
|
|
4624
|
+
export type AiSearchSearchResponse = {
|
|
4625
|
+
search_query: string;
|
|
4626
|
+
chunks: Array<{
|
|
4627
|
+
id: string;
|
|
4628
|
+
type: string;
|
|
4629
|
+
/** Match score (0-1) */
|
|
4630
|
+
score: number;
|
|
4631
|
+
text: string;
|
|
4632
|
+
item: {
|
|
4633
|
+
timestamp?: number;
|
|
4634
|
+
key: string;
|
|
4635
|
+
metadata?: Record<string, unknown>;
|
|
4636
|
+
};
|
|
4637
|
+
scoring_details?: {
|
|
4638
|
+
/** Keyword match score (0-1) */
|
|
4639
|
+
keyword_score?: number;
|
|
4640
|
+
/** Vector similarity score (0-1) */
|
|
4641
|
+
vector_score?: number;
|
|
4642
|
+
};
|
|
4643
|
+
}>;
|
|
4644
|
+
};
|
|
4645
|
+
export type AiSearchListResponse = Array<{
|
|
4646
|
+
id: string;
|
|
4647
|
+
internal_id?: string;
|
|
4648
|
+
account_id?: string;
|
|
4649
|
+
account_tag?: string;
|
|
4650
|
+
/** Whether the instance is enabled (default true) */
|
|
4651
|
+
enable?: boolean;
|
|
4652
|
+
type?: "r2" | "web-crawler";
|
|
4653
|
+
source?: string;
|
|
4654
|
+
[key: string]: unknown;
|
|
4655
|
+
}>;
|
|
4656
|
+
export type AiSearchConfig = {
|
|
4657
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4658
|
+
id: string;
|
|
4659
|
+
type: "r2" | "web-crawler";
|
|
4660
|
+
source: string;
|
|
4661
|
+
source_params?: object;
|
|
4662
|
+
/** Token ID (UUID format) */
|
|
4663
|
+
token_id?: string;
|
|
4664
|
+
ai_gateway_id?: string;
|
|
4665
|
+
/** Enable query rewriting (default false) */
|
|
4666
|
+
rewrite_query?: boolean;
|
|
4667
|
+
/** Enable reranking (default false) */
|
|
4668
|
+
reranking?: boolean;
|
|
4669
|
+
embedding_model?: string;
|
|
4670
|
+
ai_search_model?: string;
|
|
4671
|
+
};
|
|
4672
|
+
export type AiSearchInstance = {
|
|
4673
|
+
id: string;
|
|
4674
|
+
enable?: boolean;
|
|
4675
|
+
type?: "r2" | "web-crawler";
|
|
4676
|
+
source?: string;
|
|
4677
|
+
[key: string]: unknown;
|
|
4678
|
+
};
|
|
4679
|
+
// AI Search Instance Service - Instance-level operations
|
|
4680
|
+
export declare abstract class AiSearchInstanceService {
|
|
4681
|
+
/**
|
|
4682
|
+
* Search the AI Search instance for relevant chunks.
|
|
4683
|
+
* @param params Search request with messages and AI search options
|
|
4684
|
+
* @returns Search response with matching chunks
|
|
4685
|
+
*/
|
|
4686
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4687
|
+
/**
|
|
4688
|
+
* Generate chat completions with AI Search context.
|
|
4689
|
+
* @param params Chat completions request with optional streaming
|
|
4690
|
+
* @returns Response object (if streaming) or chat completion result
|
|
4691
|
+
*/
|
|
4692
|
+
chatCompletions(
|
|
4693
|
+
params: AiSearchChatCompletionsRequest,
|
|
4694
|
+
): Promise<Response | object>;
|
|
4695
|
+
/**
|
|
4696
|
+
* Delete this AI Search instance.
|
|
4697
|
+
*/
|
|
4698
|
+
delete(): Promise<void>;
|
|
4699
|
+
}
|
|
4700
|
+
// AI Search Account Service - Account-level operations
|
|
4701
|
+
export declare abstract class AiSearchAccountService {
|
|
4702
|
+
/**
|
|
4703
|
+
* List all AI Search instances in the account.
|
|
4704
|
+
* @returns Array of AI Search instances
|
|
4705
|
+
*/
|
|
4706
|
+
list(): Promise<AiSearchListResponse>;
|
|
4707
|
+
/**
|
|
4708
|
+
* Get an AI Search instance by ID.
|
|
4709
|
+
* @param name Instance ID
|
|
4710
|
+
* @returns Instance service for performing operations
|
|
4711
|
+
*/
|
|
4712
|
+
get(name: string): AiSearchInstanceService;
|
|
4713
|
+
/**
|
|
4714
|
+
* Create a new AI Search instance.
|
|
4715
|
+
* @param config Instance configuration
|
|
4716
|
+
* @returns Instance service for performing operations
|
|
4717
|
+
*/
|
|
4718
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
4719
|
+
}
|
|
4498
4720
|
export type AiImageClassificationInput = {
|
|
4499
4721
|
image: number[];
|
|
4500
4722
|
};
|
|
@@ -9995,6 +10217,48 @@ export declare abstract class Ai<
|
|
|
9995
10217
|
> {
|
|
9996
10218
|
aiGatewayLogId: string | null;
|
|
9997
10219
|
gateway(gatewayId: string): AiGateway;
|
|
10220
|
+
/**
|
|
10221
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
10222
|
+
*
|
|
10223
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10224
|
+
* - Account-level operations: `list()`, `create()`
|
|
10225
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10226
|
+
*
|
|
10227
|
+
* @example
|
|
10228
|
+
* ```typescript
|
|
10229
|
+
* // List all AI Search instances
|
|
10230
|
+
* const instances = await env.AI.aiSearch.list();
|
|
10231
|
+
*
|
|
10232
|
+
* // Search an instance
|
|
10233
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10234
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10235
|
+
* ai_search_options: {
|
|
10236
|
+
* retrieval: { max_num_results: 10 }
|
|
10237
|
+
* }
|
|
10238
|
+
* });
|
|
10239
|
+
*
|
|
10240
|
+
* // Generate chat completions with AI Search context
|
|
10241
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10242
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10243
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10244
|
+
* });
|
|
10245
|
+
* ```
|
|
10246
|
+
*/
|
|
10247
|
+
aiSearch(): AiSearchAccountService;
|
|
10248
|
+
/**
|
|
10249
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10250
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
10251
|
+
*
|
|
10252
|
+
* Migration guide:
|
|
10253
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10254
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10255
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10256
|
+
*
|
|
10257
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
10258
|
+
*
|
|
10259
|
+
* @see AiSearchAccountService
|
|
10260
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10261
|
+
*/
|
|
9998
10262
|
autorag(autoragId: string): AutoRAG;
|
|
9999
10263
|
run<
|
|
10000
10264
|
Name extends keyof AiModelList,
|
|
@@ -10151,19 +10415,30 @@ export declare abstract class AiGateway {
|
|
|
10151
10415
|
): Promise<Response>;
|
|
10152
10416
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10153
10417
|
}
|
|
10418
|
+
/**
|
|
10419
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
10420
|
+
* @see AiSearchInternalError
|
|
10421
|
+
*/
|
|
10154
10422
|
export interface AutoRAGInternalError extends Error {}
|
|
10423
|
+
/**
|
|
10424
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
10425
|
+
* @see AiSearchNotFoundError
|
|
10426
|
+
*/
|
|
10155
10427
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10428
|
+
/**
|
|
10429
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
10430
|
+
*/
|
|
10156
10431
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10432
|
+
/**
|
|
10433
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
10434
|
+
* @see AiSearchNameNotSetError
|
|
10435
|
+
*/
|
|
10157
10436
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
export type CompoundFilter = {
|
|
10164
|
-
type: "and" | "or";
|
|
10165
|
-
filters: ComparisonFilter[];
|
|
10166
|
-
};
|
|
10437
|
+
/**
|
|
10438
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10439
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
10440
|
+
* @see AiSearchSearchRequest
|
|
10441
|
+
*/
|
|
10167
10442
|
export type AutoRagSearchRequest = {
|
|
10168
10443
|
query: string;
|
|
10169
10444
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -10178,16 +10453,31 @@ export type AutoRagSearchRequest = {
|
|
|
10178
10453
|
};
|
|
10179
10454
|
rewrite_query?: boolean;
|
|
10180
10455
|
};
|
|
10456
|
+
/**
|
|
10457
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10458
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
10459
|
+
* @see AiSearchChatCompletionsRequest
|
|
10460
|
+
*/
|
|
10181
10461
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10182
10462
|
stream?: boolean;
|
|
10183
10463
|
system_prompt?: string;
|
|
10184
10464
|
};
|
|
10465
|
+
/**
|
|
10466
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10467
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
10468
|
+
* @see AiSearchChatCompletionsRequest
|
|
10469
|
+
*/
|
|
10185
10470
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10186
10471
|
AutoRagAiSearchRequest,
|
|
10187
10472
|
"stream"
|
|
10188
10473
|
> & {
|
|
10189
10474
|
stream: true;
|
|
10190
10475
|
};
|
|
10476
|
+
/**
|
|
10477
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10478
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
10479
|
+
* @see AiSearchSearchResponse
|
|
10480
|
+
*/
|
|
10191
10481
|
export type AutoRagSearchResponse = {
|
|
10192
10482
|
object: "vector_store.search_results.page";
|
|
10193
10483
|
search_query: string;
|
|
@@ -10204,6 +10494,11 @@ export type AutoRagSearchResponse = {
|
|
|
10204
10494
|
has_more: boolean;
|
|
10205
10495
|
next_page: string | null;
|
|
10206
10496
|
};
|
|
10497
|
+
/**
|
|
10498
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10499
|
+
* Use AiSearchListResponse with the new API instead.
|
|
10500
|
+
* @see AiSearchListResponse
|
|
10501
|
+
*/
|
|
10207
10502
|
export type AutoRagListResponse = {
|
|
10208
10503
|
id: string;
|
|
10209
10504
|
enable: boolean;
|
|
@@ -10213,14 +10508,51 @@ export type AutoRagListResponse = {
|
|
|
10213
10508
|
paused: boolean;
|
|
10214
10509
|
status: string;
|
|
10215
10510
|
}[];
|
|
10511
|
+
/**
|
|
10512
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10513
|
+
* The new API returns different response formats for chat completions.
|
|
10514
|
+
*/
|
|
10216
10515
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10217
10516
|
response: string;
|
|
10218
10517
|
};
|
|
10518
|
+
/**
|
|
10519
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10520
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
10521
|
+
*
|
|
10522
|
+
* Migration guide:
|
|
10523
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10524
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10525
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10526
|
+
*
|
|
10527
|
+
* @see AiSearchAccountService
|
|
10528
|
+
* @see AiSearchInstanceService
|
|
10529
|
+
*/
|
|
10219
10530
|
export declare abstract class AutoRAG {
|
|
10531
|
+
/**
|
|
10532
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
10533
|
+
* @see AiSearchAccountService.list
|
|
10534
|
+
*/
|
|
10220
10535
|
list(): Promise<AutoRagListResponse>;
|
|
10536
|
+
/**
|
|
10537
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
10538
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
10539
|
+
* @see AiSearchInstanceService.search
|
|
10540
|
+
*/
|
|
10221
10541
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10542
|
+
/**
|
|
10543
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
10544
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
10545
|
+
*/
|
|
10222
10546
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10547
|
+
/**
|
|
10548
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
10549
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
10550
|
+
*/
|
|
10223
10551
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10552
|
+
/**
|
|
10553
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
10554
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
10555
|
+
*/
|
|
10224
10556
|
aiSearch(
|
|
10225
10557
|
params: AutoRagAiSearchRequest,
|
|
10226
10558
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -11622,6 +11954,86 @@ export type ImageOutputOptions = {
|
|
|
11622
11954
|
background?: string;
|
|
11623
11955
|
anim?: boolean;
|
|
11624
11956
|
};
|
|
11957
|
+
export interface ImageMetadata {
|
|
11958
|
+
id: string;
|
|
11959
|
+
filename?: string;
|
|
11960
|
+
uploaded?: string;
|
|
11961
|
+
requireSignedURLs: boolean;
|
|
11962
|
+
meta?: Record<string, unknown>;
|
|
11963
|
+
variants: string[];
|
|
11964
|
+
draft?: boolean;
|
|
11965
|
+
creator?: string;
|
|
11966
|
+
}
|
|
11967
|
+
export interface ImageUploadOptions {
|
|
11968
|
+
id?: string;
|
|
11969
|
+
filename?: string;
|
|
11970
|
+
requireSignedURLs?: boolean;
|
|
11971
|
+
metadata?: Record<string, unknown>;
|
|
11972
|
+
creator?: string;
|
|
11973
|
+
encoding?: "base64";
|
|
11974
|
+
}
|
|
11975
|
+
export interface ImageUpdateOptions {
|
|
11976
|
+
requireSignedURLs?: boolean;
|
|
11977
|
+
metadata?: Record<string, unknown>;
|
|
11978
|
+
creator?: string;
|
|
11979
|
+
}
|
|
11980
|
+
export interface ImageListOptions {
|
|
11981
|
+
limit?: number;
|
|
11982
|
+
cursor?: string;
|
|
11983
|
+
sortOrder?: "asc" | "desc";
|
|
11984
|
+
creator?: string;
|
|
11985
|
+
}
|
|
11986
|
+
export interface ImageList {
|
|
11987
|
+
images: ImageMetadata[];
|
|
11988
|
+
cursor?: string;
|
|
11989
|
+
listComplete: boolean;
|
|
11990
|
+
}
|
|
11991
|
+
export interface HostedImagesBinding {
|
|
11992
|
+
/**
|
|
11993
|
+
* Get detailed metadata for a hosted image
|
|
11994
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11995
|
+
* @returns Image metadata, or null if not found
|
|
11996
|
+
*/
|
|
11997
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11998
|
+
/**
|
|
11999
|
+
* Get the raw image data for a hosted image
|
|
12000
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
12001
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
12002
|
+
*/
|
|
12003
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
12004
|
+
/**
|
|
12005
|
+
* Upload a new hosted image
|
|
12006
|
+
* @param image The image file to upload
|
|
12007
|
+
* @param options Upload configuration
|
|
12008
|
+
* @returns Metadata for the uploaded image
|
|
12009
|
+
* @throws {@link ImagesError} if upload fails
|
|
12010
|
+
*/
|
|
12011
|
+
upload(
|
|
12012
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
12013
|
+
options?: ImageUploadOptions,
|
|
12014
|
+
): Promise<ImageMetadata>;
|
|
12015
|
+
/**
|
|
12016
|
+
* Update hosted image metadata
|
|
12017
|
+
* @param imageId The ID of the image
|
|
12018
|
+
* @param options Properties to update
|
|
12019
|
+
* @returns Updated image metadata
|
|
12020
|
+
* @throws {@link ImagesError} if update fails
|
|
12021
|
+
*/
|
|
12022
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
12023
|
+
/**
|
|
12024
|
+
* Delete a hosted image
|
|
12025
|
+
* @param imageId The ID of the image
|
|
12026
|
+
* @returns True if deleted, false if not found
|
|
12027
|
+
*/
|
|
12028
|
+
delete(imageId: string): Promise<boolean>;
|
|
12029
|
+
/**
|
|
12030
|
+
* List hosted images with pagination
|
|
12031
|
+
* @param options List configuration
|
|
12032
|
+
* @returns List of images with pagination info
|
|
12033
|
+
* @throws {@link ImagesError} if list fails
|
|
12034
|
+
*/
|
|
12035
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
12036
|
+
}
|
|
11625
12037
|
export interface ImagesBinding {
|
|
11626
12038
|
/**
|
|
11627
12039
|
* Get image metadata (type, width and height)
|
|
@@ -11641,6 +12053,10 @@ export interface ImagesBinding {
|
|
|
11641
12053
|
stream: ReadableStream<Uint8Array>,
|
|
11642
12054
|
options?: ImageInputOptions,
|
|
11643
12055
|
): ImageTransformer;
|
|
12056
|
+
/**
|
|
12057
|
+
* Access hosted images CRUD operations
|
|
12058
|
+
*/
|
|
12059
|
+
readonly hosted: HostedImagesBinding;
|
|
11644
12060
|
}
|
|
11645
12061
|
export interface ImageTransformer {
|
|
11646
12062
|
/**
|
|
@@ -11711,8 +12127,14 @@ export interface MediaTransformer {
|
|
|
11711
12127
|
* @returns A generator for producing the transformed media output
|
|
11712
12128
|
*/
|
|
11713
12129
|
transform(
|
|
11714
|
-
transform
|
|
12130
|
+
transform?: MediaTransformationInputOptions,
|
|
11715
12131
|
): MediaTransformationGenerator;
|
|
12132
|
+
/**
|
|
12133
|
+
* Generates the final media output with specified options.
|
|
12134
|
+
* @param output - Configuration for the output format and parameters
|
|
12135
|
+
* @returns The final transformation result containing the transformed media
|
|
12136
|
+
*/
|
|
12137
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11716
12138
|
}
|
|
11717
12139
|
/**
|
|
11718
12140
|
* Generator for producing media transformation results.
|
|
@@ -11724,7 +12146,7 @@ export interface MediaTransformationGenerator {
|
|
|
11724
12146
|
* @param output - Configuration for the output format and parameters
|
|
11725
12147
|
* @returns The final transformation result containing the transformed media
|
|
11726
12148
|
*/
|
|
11727
|
-
output(output
|
|
12149
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11728
12150
|
}
|
|
11729
12151
|
/**
|
|
11730
12152
|
* Result of a media transformation operation.
|
|
@@ -11733,19 +12155,19 @@ export interface MediaTransformationGenerator {
|
|
|
11733
12155
|
export interface MediaTransformationResult {
|
|
11734
12156
|
/**
|
|
11735
12157
|
* Returns the transformed media as a readable stream of bytes.
|
|
11736
|
-
* @returns A
|
|
12158
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11737
12159
|
*/
|
|
11738
|
-
media(): ReadableStream<Uint8Array
|
|
12160
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11739
12161
|
/**
|
|
11740
12162
|
* Returns the transformed media as an HTTP response object.
|
|
11741
|
-
* @returns The transformed media as a Response
|
|
12163
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11742
12164
|
*/
|
|
11743
|
-
response(): Response
|
|
12165
|
+
response(): Promise<Response>;
|
|
11744
12166
|
/**
|
|
11745
12167
|
* Returns the MIME type of the transformed media.
|
|
11746
|
-
* @returns
|
|
12168
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11747
12169
|
*/
|
|
11748
|
-
contentType(): string
|
|
12170
|
+
contentType(): Promise<string>;
|
|
11749
12171
|
}
|
|
11750
12172
|
/**
|
|
11751
12173
|
* Configuration options for transforming media input.
|