@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.d.ts
CHANGED
|
@@ -635,10 +635,16 @@ type DurableObjectRoutingMode = "primary-only";
|
|
|
635
635
|
interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
636
636
|
locationHint?: DurableObjectLocationHint;
|
|
637
637
|
routingMode?: DurableObjectRoutingMode;
|
|
638
|
+
version?: {
|
|
639
|
+
cohort?: string;
|
|
640
|
+
};
|
|
638
641
|
}
|
|
639
642
|
interface DurableObjectClass<
|
|
640
643
|
_T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
641
644
|
> {}
|
|
645
|
+
interface DurableObjectNamespaceGetDurableObjectOptionsVersionOptions {
|
|
646
|
+
cohort?: string;
|
|
647
|
+
}
|
|
642
648
|
interface DurableObjectState<Props = unknown> {
|
|
643
649
|
waitUntil(promise: Promise<any>): void;
|
|
644
650
|
readonly exports: Cloudflare.Exports;
|
|
@@ -647,6 +653,7 @@ interface DurableObjectState<Props = unknown> {
|
|
|
647
653
|
readonly storage: DurableObjectStorage;
|
|
648
654
|
container?: Container;
|
|
649
655
|
facets: DurableObjectFacets;
|
|
656
|
+
version?: DurableObjectStateVersion;
|
|
650
657
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
651
658
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
652
659
|
getWebSockets(tag?: string): WebSocket[];
|
|
@@ -781,6 +788,9 @@ interface FacetStartupOptions<
|
|
|
781
788
|
id?: DurableObjectId | string;
|
|
782
789
|
class: DurableObjectClass<T>;
|
|
783
790
|
}
|
|
791
|
+
interface DurableObjectStateVersion {
|
|
792
|
+
cohort?: string;
|
|
793
|
+
}
|
|
784
794
|
interface AnalyticsEngineDataset {
|
|
785
795
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
786
796
|
}
|
|
@@ -3841,6 +3851,8 @@ interface Container {
|
|
|
3841
3851
|
signal(signo: number): void;
|
|
3842
3852
|
getTcpPort(port: number): Fetcher;
|
|
3843
3853
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3854
|
+
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3855
|
+
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3844
3856
|
}
|
|
3845
3857
|
interface ContainerStartupOptions {
|
|
3846
3858
|
entrypoint?: string[];
|
|
@@ -4087,8 +4099,18 @@ type LoopbackServiceStub<
|
|
|
4087
4099
|
T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
|
|
4088
4100
|
> = Fetcher<T> &
|
|
4089
4101
|
(T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props>
|
|
4090
|
-
? (opts: {
|
|
4091
|
-
|
|
4102
|
+
? (opts: {
|
|
4103
|
+
props?: Props;
|
|
4104
|
+
version?: {
|
|
4105
|
+
cohort?: string | null;
|
|
4106
|
+
};
|
|
4107
|
+
}) => Fetcher<T>
|
|
4108
|
+
: (opts: {
|
|
4109
|
+
props?: any;
|
|
4110
|
+
version?: {
|
|
4111
|
+
cohort?: string | null;
|
|
4112
|
+
};
|
|
4113
|
+
}) => Fetcher<T>);
|
|
4092
4114
|
type LoopbackDurableObjectClass<
|
|
4093
4115
|
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
4094
4116
|
> = DurableObjectClass<T> &
|
|
@@ -4220,10 +4242,32 @@ declare abstract class Performance extends EventTarget {
|
|
|
4220
4242
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize)
|
|
4221
4243
|
*/
|
|
4222
4244
|
setResourceTimingBufferSize(size: number): void;
|
|
4223
|
-
|
|
4245
|
+
get nodeTiming(): PerformanceNodeTiming;
|
|
4246
|
+
eventLoopUtilization(): PerformanceEventLoopUtilization;
|
|
4224
4247
|
markResourceTiming(): void;
|
|
4225
4248
|
timerify(fn: () => void): () => void;
|
|
4226
4249
|
}
|
|
4250
|
+
interface PerformanceEventLoopUtilization {
|
|
4251
|
+
idle: number;
|
|
4252
|
+
active: number;
|
|
4253
|
+
utilization: number;
|
|
4254
|
+
}
|
|
4255
|
+
interface PerformanceNodeTiming extends PerformanceEntry {
|
|
4256
|
+
readonly nodeStart: number;
|
|
4257
|
+
readonly v8Start: number;
|
|
4258
|
+
readonly bootstrapComplete: number;
|
|
4259
|
+
readonly environment: number;
|
|
4260
|
+
readonly loopStart: number;
|
|
4261
|
+
readonly loopExit: number;
|
|
4262
|
+
readonly idleTime: number;
|
|
4263
|
+
readonly uvMetricsInfo: UvMetricsInfo;
|
|
4264
|
+
toJSON(): any;
|
|
4265
|
+
}
|
|
4266
|
+
interface UvMetricsInfo {
|
|
4267
|
+
loopCount: number;
|
|
4268
|
+
events: number;
|
|
4269
|
+
eventsWaiting: number;
|
|
4270
|
+
}
|
|
4227
4271
|
/**
|
|
4228
4272
|
* **`PerformanceMark`** is an interface for PerformanceEntry objects with an PerformanceEntry.entryType of `'mark'`.
|
|
4229
4273
|
*
|
|
@@ -4486,6 +4530,184 @@ interface EventCounts {
|
|
|
4486
4530
|
): void;
|
|
4487
4531
|
[Symbol.iterator](): IterableIterator<string[]>;
|
|
4488
4532
|
}
|
|
4533
|
+
// AI Search V2 API Error Interfaces
|
|
4534
|
+
interface AiSearchInternalError extends Error {}
|
|
4535
|
+
interface AiSearchNotFoundError extends Error {}
|
|
4536
|
+
interface AiSearchNameNotSetError extends Error {}
|
|
4537
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
4538
|
+
type ComparisonFilter = {
|
|
4539
|
+
key: string;
|
|
4540
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
4541
|
+
value: string | number | boolean;
|
|
4542
|
+
};
|
|
4543
|
+
type CompoundFilter = {
|
|
4544
|
+
type: "and" | "or";
|
|
4545
|
+
filters: ComparisonFilter[];
|
|
4546
|
+
};
|
|
4547
|
+
// AI Search V2 Request Types
|
|
4548
|
+
type AiSearchSearchRequest = {
|
|
4549
|
+
messages: Array<{
|
|
4550
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4551
|
+
content: string | null;
|
|
4552
|
+
}>;
|
|
4553
|
+
ai_search_options?: {
|
|
4554
|
+
retrieval?: {
|
|
4555
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
4556
|
+
/** Match threshold (0-1, default 0.4) */
|
|
4557
|
+
match_threshold?: number;
|
|
4558
|
+
/** Maximum number of results (1-50, default 10) */
|
|
4559
|
+
max_num_results?: number;
|
|
4560
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
4561
|
+
/** Context expansion (0-3, default 0) */
|
|
4562
|
+
context_expansion?: number;
|
|
4563
|
+
[key: string]: unknown;
|
|
4564
|
+
};
|
|
4565
|
+
query_rewrite?: {
|
|
4566
|
+
enabled?: boolean;
|
|
4567
|
+
model?: string;
|
|
4568
|
+
rewrite_prompt?: string;
|
|
4569
|
+
[key: string]: unknown;
|
|
4570
|
+
};
|
|
4571
|
+
reranking?: {
|
|
4572
|
+
/** Enable reranking (default false) */
|
|
4573
|
+
enabled?: boolean;
|
|
4574
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
4575
|
+
/** Match threshold (0-1, default 0.4) */
|
|
4576
|
+
match_threshold?: number;
|
|
4577
|
+
[key: string]: unknown;
|
|
4578
|
+
};
|
|
4579
|
+
[key: string]: unknown;
|
|
4580
|
+
};
|
|
4581
|
+
};
|
|
4582
|
+
type AiSearchChatCompletionsRequest = {
|
|
4583
|
+
messages: Array<{
|
|
4584
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4585
|
+
content: string | null;
|
|
4586
|
+
}>;
|
|
4587
|
+
model?: string;
|
|
4588
|
+
stream?: boolean;
|
|
4589
|
+
ai_search_options?: {
|
|
4590
|
+
retrieval?: {
|
|
4591
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
4592
|
+
match_threshold?: number;
|
|
4593
|
+
max_num_results?: number;
|
|
4594
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
4595
|
+
context_expansion?: number;
|
|
4596
|
+
[key: string]: unknown;
|
|
4597
|
+
};
|
|
4598
|
+
query_rewrite?: {
|
|
4599
|
+
enabled?: boolean;
|
|
4600
|
+
model?: string;
|
|
4601
|
+
rewrite_prompt?: string;
|
|
4602
|
+
[key: string]: unknown;
|
|
4603
|
+
};
|
|
4604
|
+
reranking?: {
|
|
4605
|
+
enabled?: boolean;
|
|
4606
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
4607
|
+
match_threshold?: number;
|
|
4608
|
+
[key: string]: unknown;
|
|
4609
|
+
};
|
|
4610
|
+
[key: string]: unknown;
|
|
4611
|
+
};
|
|
4612
|
+
[key: string]: unknown;
|
|
4613
|
+
};
|
|
4614
|
+
// AI Search V2 Response Types
|
|
4615
|
+
type AiSearchSearchResponse = {
|
|
4616
|
+
search_query: string;
|
|
4617
|
+
chunks: Array<{
|
|
4618
|
+
id: string;
|
|
4619
|
+
type: string;
|
|
4620
|
+
/** Match score (0-1) */
|
|
4621
|
+
score: number;
|
|
4622
|
+
text: string;
|
|
4623
|
+
item: {
|
|
4624
|
+
timestamp?: number;
|
|
4625
|
+
key: string;
|
|
4626
|
+
metadata?: Record<string, unknown>;
|
|
4627
|
+
};
|
|
4628
|
+
scoring_details?: {
|
|
4629
|
+
/** Keyword match score (0-1) */
|
|
4630
|
+
keyword_score?: number;
|
|
4631
|
+
/** Vector similarity score (0-1) */
|
|
4632
|
+
vector_score?: number;
|
|
4633
|
+
};
|
|
4634
|
+
}>;
|
|
4635
|
+
};
|
|
4636
|
+
type AiSearchListResponse = Array<{
|
|
4637
|
+
id: string;
|
|
4638
|
+
internal_id?: string;
|
|
4639
|
+
account_id?: string;
|
|
4640
|
+
account_tag?: string;
|
|
4641
|
+
/** Whether the instance is enabled (default true) */
|
|
4642
|
+
enable?: boolean;
|
|
4643
|
+
type?: "r2" | "web-crawler";
|
|
4644
|
+
source?: string;
|
|
4645
|
+
[key: string]: unknown;
|
|
4646
|
+
}>;
|
|
4647
|
+
type AiSearchConfig = {
|
|
4648
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4649
|
+
id: string;
|
|
4650
|
+
type: "r2" | "web-crawler";
|
|
4651
|
+
source: string;
|
|
4652
|
+
source_params?: object;
|
|
4653
|
+
/** Token ID (UUID format) */
|
|
4654
|
+
token_id?: string;
|
|
4655
|
+
ai_gateway_id?: string;
|
|
4656
|
+
/** Enable query rewriting (default false) */
|
|
4657
|
+
rewrite_query?: boolean;
|
|
4658
|
+
/** Enable reranking (default false) */
|
|
4659
|
+
reranking?: boolean;
|
|
4660
|
+
embedding_model?: string;
|
|
4661
|
+
ai_search_model?: string;
|
|
4662
|
+
};
|
|
4663
|
+
type AiSearchInstance = {
|
|
4664
|
+
id: string;
|
|
4665
|
+
enable?: boolean;
|
|
4666
|
+
type?: "r2" | "web-crawler";
|
|
4667
|
+
source?: string;
|
|
4668
|
+
[key: string]: unknown;
|
|
4669
|
+
};
|
|
4670
|
+
// AI Search Instance Service - Instance-level operations
|
|
4671
|
+
declare abstract class AiSearchInstanceService {
|
|
4672
|
+
/**
|
|
4673
|
+
* Search the AI Search instance for relevant chunks.
|
|
4674
|
+
* @param params Search request with messages and AI search options
|
|
4675
|
+
* @returns Search response with matching chunks
|
|
4676
|
+
*/
|
|
4677
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4678
|
+
/**
|
|
4679
|
+
* Generate chat completions with AI Search context.
|
|
4680
|
+
* @param params Chat completions request with optional streaming
|
|
4681
|
+
* @returns Response object (if streaming) or chat completion result
|
|
4682
|
+
*/
|
|
4683
|
+
chatCompletions(
|
|
4684
|
+
params: AiSearchChatCompletionsRequest,
|
|
4685
|
+
): Promise<Response | object>;
|
|
4686
|
+
/**
|
|
4687
|
+
* Delete this AI Search instance.
|
|
4688
|
+
*/
|
|
4689
|
+
delete(): Promise<void>;
|
|
4690
|
+
}
|
|
4691
|
+
// AI Search Account Service - Account-level operations
|
|
4692
|
+
declare abstract class AiSearchAccountService {
|
|
4693
|
+
/**
|
|
4694
|
+
* List all AI Search instances in the account.
|
|
4695
|
+
* @returns Array of AI Search instances
|
|
4696
|
+
*/
|
|
4697
|
+
list(): Promise<AiSearchListResponse>;
|
|
4698
|
+
/**
|
|
4699
|
+
* Get an AI Search instance by ID.
|
|
4700
|
+
* @param name Instance ID
|
|
4701
|
+
* @returns Instance service for performing operations
|
|
4702
|
+
*/
|
|
4703
|
+
get(name: string): AiSearchInstanceService;
|
|
4704
|
+
/**
|
|
4705
|
+
* Create a new AI Search instance.
|
|
4706
|
+
* @param config Instance configuration
|
|
4707
|
+
* @returns Instance service for performing operations
|
|
4708
|
+
*/
|
|
4709
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
4710
|
+
}
|
|
4489
4711
|
type AiImageClassificationInput = {
|
|
4490
4712
|
image: number[];
|
|
4491
4713
|
};
|
|
@@ -9983,6 +10205,48 @@ type AiModelListType = Record<string, any>;
|
|
|
9983
10205
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
9984
10206
|
aiGatewayLogId: string | null;
|
|
9985
10207
|
gateway(gatewayId: string): AiGateway;
|
|
10208
|
+
/**
|
|
10209
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
10210
|
+
*
|
|
10211
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10212
|
+
* - Account-level operations: `list()`, `create()`
|
|
10213
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10214
|
+
*
|
|
10215
|
+
* @example
|
|
10216
|
+
* ```typescript
|
|
10217
|
+
* // List all AI Search instances
|
|
10218
|
+
* const instances = await env.AI.aiSearch.list();
|
|
10219
|
+
*
|
|
10220
|
+
* // Search an instance
|
|
10221
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10222
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10223
|
+
* ai_search_options: {
|
|
10224
|
+
* retrieval: { max_num_results: 10 }
|
|
10225
|
+
* }
|
|
10226
|
+
* });
|
|
10227
|
+
*
|
|
10228
|
+
* // Generate chat completions with AI Search context
|
|
10229
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10230
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10231
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10232
|
+
* });
|
|
10233
|
+
* ```
|
|
10234
|
+
*/
|
|
10235
|
+
aiSearch(): AiSearchAccountService;
|
|
10236
|
+
/**
|
|
10237
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10238
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
10239
|
+
*
|
|
10240
|
+
* Migration guide:
|
|
10241
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10242
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10243
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10244
|
+
*
|
|
10245
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
10246
|
+
*
|
|
10247
|
+
* @see AiSearchAccountService
|
|
10248
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10249
|
+
*/
|
|
9986
10250
|
autorag(autoragId: string): AutoRAG;
|
|
9987
10251
|
run<
|
|
9988
10252
|
Name extends keyof AiModelList,
|
|
@@ -10139,19 +10403,30 @@ declare abstract class AiGateway {
|
|
|
10139
10403
|
): Promise<Response>;
|
|
10140
10404
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10141
10405
|
}
|
|
10406
|
+
/**
|
|
10407
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
10408
|
+
* @see AiSearchInternalError
|
|
10409
|
+
*/
|
|
10142
10410
|
interface AutoRAGInternalError extends Error {}
|
|
10411
|
+
/**
|
|
10412
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
10413
|
+
* @see AiSearchNotFoundError
|
|
10414
|
+
*/
|
|
10143
10415
|
interface AutoRAGNotFoundError extends Error {}
|
|
10416
|
+
/**
|
|
10417
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
10418
|
+
*/
|
|
10144
10419
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10420
|
+
/**
|
|
10421
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
10422
|
+
* @see AiSearchNameNotSetError
|
|
10423
|
+
*/
|
|
10145
10424
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
type CompoundFilter = {
|
|
10152
|
-
type: "and" | "or";
|
|
10153
|
-
filters: ComparisonFilter[];
|
|
10154
|
-
};
|
|
10425
|
+
/**
|
|
10426
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10427
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
10428
|
+
* @see AiSearchSearchRequest
|
|
10429
|
+
*/
|
|
10155
10430
|
type AutoRagSearchRequest = {
|
|
10156
10431
|
query: string;
|
|
10157
10432
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -10166,16 +10441,31 @@ type AutoRagSearchRequest = {
|
|
|
10166
10441
|
};
|
|
10167
10442
|
rewrite_query?: boolean;
|
|
10168
10443
|
};
|
|
10444
|
+
/**
|
|
10445
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10446
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
10447
|
+
* @see AiSearchChatCompletionsRequest
|
|
10448
|
+
*/
|
|
10169
10449
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10170
10450
|
stream?: boolean;
|
|
10171
10451
|
system_prompt?: string;
|
|
10172
10452
|
};
|
|
10453
|
+
/**
|
|
10454
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10455
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
10456
|
+
* @see AiSearchChatCompletionsRequest
|
|
10457
|
+
*/
|
|
10173
10458
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10174
10459
|
AutoRagAiSearchRequest,
|
|
10175
10460
|
"stream"
|
|
10176
10461
|
> & {
|
|
10177
10462
|
stream: true;
|
|
10178
10463
|
};
|
|
10464
|
+
/**
|
|
10465
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10466
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
10467
|
+
* @see AiSearchSearchResponse
|
|
10468
|
+
*/
|
|
10179
10469
|
type AutoRagSearchResponse = {
|
|
10180
10470
|
object: "vector_store.search_results.page";
|
|
10181
10471
|
search_query: string;
|
|
@@ -10192,6 +10482,11 @@ type AutoRagSearchResponse = {
|
|
|
10192
10482
|
has_more: boolean;
|
|
10193
10483
|
next_page: string | null;
|
|
10194
10484
|
};
|
|
10485
|
+
/**
|
|
10486
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10487
|
+
* Use AiSearchListResponse with the new API instead.
|
|
10488
|
+
* @see AiSearchListResponse
|
|
10489
|
+
*/
|
|
10195
10490
|
type AutoRagListResponse = {
|
|
10196
10491
|
id: string;
|
|
10197
10492
|
enable: boolean;
|
|
@@ -10201,14 +10496,51 @@ type AutoRagListResponse = {
|
|
|
10201
10496
|
paused: boolean;
|
|
10202
10497
|
status: string;
|
|
10203
10498
|
}[];
|
|
10499
|
+
/**
|
|
10500
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10501
|
+
* The new API returns different response formats for chat completions.
|
|
10502
|
+
*/
|
|
10204
10503
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10205
10504
|
response: string;
|
|
10206
10505
|
};
|
|
10506
|
+
/**
|
|
10507
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10508
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
10509
|
+
*
|
|
10510
|
+
* Migration guide:
|
|
10511
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10512
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10513
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10514
|
+
*
|
|
10515
|
+
* @see AiSearchAccountService
|
|
10516
|
+
* @see AiSearchInstanceService
|
|
10517
|
+
*/
|
|
10207
10518
|
declare abstract class AutoRAG {
|
|
10519
|
+
/**
|
|
10520
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
10521
|
+
* @see AiSearchAccountService.list
|
|
10522
|
+
*/
|
|
10208
10523
|
list(): Promise<AutoRagListResponse>;
|
|
10524
|
+
/**
|
|
10525
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
10526
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
10527
|
+
* @see AiSearchInstanceService.search
|
|
10528
|
+
*/
|
|
10209
10529
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10530
|
+
/**
|
|
10531
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
10532
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
10533
|
+
*/
|
|
10210
10534
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10535
|
+
/**
|
|
10536
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
10537
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
10538
|
+
*/
|
|
10211
10539
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10540
|
+
/**
|
|
10541
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
10542
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
10543
|
+
*/
|
|
10212
10544
|
aiSearch(
|
|
10213
10545
|
params: AutoRagAiSearchRequest,
|
|
10214
10546
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -11605,6 +11937,86 @@ type ImageOutputOptions = {
|
|
|
11605
11937
|
background?: string;
|
|
11606
11938
|
anim?: boolean;
|
|
11607
11939
|
};
|
|
11940
|
+
interface ImageMetadata {
|
|
11941
|
+
id: string;
|
|
11942
|
+
filename?: string;
|
|
11943
|
+
uploaded?: string;
|
|
11944
|
+
requireSignedURLs: boolean;
|
|
11945
|
+
meta?: Record<string, unknown>;
|
|
11946
|
+
variants: string[];
|
|
11947
|
+
draft?: boolean;
|
|
11948
|
+
creator?: string;
|
|
11949
|
+
}
|
|
11950
|
+
interface ImageUploadOptions {
|
|
11951
|
+
id?: string;
|
|
11952
|
+
filename?: string;
|
|
11953
|
+
requireSignedURLs?: boolean;
|
|
11954
|
+
metadata?: Record<string, unknown>;
|
|
11955
|
+
creator?: string;
|
|
11956
|
+
encoding?: "base64";
|
|
11957
|
+
}
|
|
11958
|
+
interface ImageUpdateOptions {
|
|
11959
|
+
requireSignedURLs?: boolean;
|
|
11960
|
+
metadata?: Record<string, unknown>;
|
|
11961
|
+
creator?: string;
|
|
11962
|
+
}
|
|
11963
|
+
interface ImageListOptions {
|
|
11964
|
+
limit?: number;
|
|
11965
|
+
cursor?: string;
|
|
11966
|
+
sortOrder?: "asc" | "desc";
|
|
11967
|
+
creator?: string;
|
|
11968
|
+
}
|
|
11969
|
+
interface ImageList {
|
|
11970
|
+
images: ImageMetadata[];
|
|
11971
|
+
cursor?: string;
|
|
11972
|
+
listComplete: boolean;
|
|
11973
|
+
}
|
|
11974
|
+
interface HostedImagesBinding {
|
|
11975
|
+
/**
|
|
11976
|
+
* Get detailed metadata for a hosted image
|
|
11977
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11978
|
+
* @returns Image metadata, or null if not found
|
|
11979
|
+
*/
|
|
11980
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11981
|
+
/**
|
|
11982
|
+
* Get the raw image data for a hosted image
|
|
11983
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11984
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11985
|
+
*/
|
|
11986
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11987
|
+
/**
|
|
11988
|
+
* Upload a new hosted image
|
|
11989
|
+
* @param image The image file to upload
|
|
11990
|
+
* @param options Upload configuration
|
|
11991
|
+
* @returns Metadata for the uploaded image
|
|
11992
|
+
* @throws {@link ImagesError} if upload fails
|
|
11993
|
+
*/
|
|
11994
|
+
upload(
|
|
11995
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11996
|
+
options?: ImageUploadOptions,
|
|
11997
|
+
): Promise<ImageMetadata>;
|
|
11998
|
+
/**
|
|
11999
|
+
* Update hosted image metadata
|
|
12000
|
+
* @param imageId The ID of the image
|
|
12001
|
+
* @param options Properties to update
|
|
12002
|
+
* @returns Updated image metadata
|
|
12003
|
+
* @throws {@link ImagesError} if update fails
|
|
12004
|
+
*/
|
|
12005
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
12006
|
+
/**
|
|
12007
|
+
* Delete a hosted image
|
|
12008
|
+
* @param imageId The ID of the image
|
|
12009
|
+
* @returns True if deleted, false if not found
|
|
12010
|
+
*/
|
|
12011
|
+
delete(imageId: string): Promise<boolean>;
|
|
12012
|
+
/**
|
|
12013
|
+
* List hosted images with pagination
|
|
12014
|
+
* @param options List configuration
|
|
12015
|
+
* @returns List of images with pagination info
|
|
12016
|
+
* @throws {@link ImagesError} if list fails
|
|
12017
|
+
*/
|
|
12018
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
12019
|
+
}
|
|
11608
12020
|
interface ImagesBinding {
|
|
11609
12021
|
/**
|
|
11610
12022
|
* Get image metadata (type, width and height)
|
|
@@ -11624,6 +12036,10 @@ interface ImagesBinding {
|
|
|
11624
12036
|
stream: ReadableStream<Uint8Array>,
|
|
11625
12037
|
options?: ImageInputOptions,
|
|
11626
12038
|
): ImageTransformer;
|
|
12039
|
+
/**
|
|
12040
|
+
* Access hosted images CRUD operations
|
|
12041
|
+
*/
|
|
12042
|
+
readonly hosted: HostedImagesBinding;
|
|
11627
12043
|
}
|
|
11628
12044
|
interface ImageTransformer {
|
|
11629
12045
|
/**
|
|
@@ -11694,8 +12110,14 @@ interface MediaTransformer {
|
|
|
11694
12110
|
* @returns A generator for producing the transformed media output
|
|
11695
12111
|
*/
|
|
11696
12112
|
transform(
|
|
11697
|
-
transform
|
|
12113
|
+
transform?: MediaTransformationInputOptions,
|
|
11698
12114
|
): MediaTransformationGenerator;
|
|
12115
|
+
/**
|
|
12116
|
+
* Generates the final media output with specified options.
|
|
12117
|
+
* @param output - Configuration for the output format and parameters
|
|
12118
|
+
* @returns The final transformation result containing the transformed media
|
|
12119
|
+
*/
|
|
12120
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11699
12121
|
}
|
|
11700
12122
|
/**
|
|
11701
12123
|
* Generator for producing media transformation results.
|
|
@@ -11707,7 +12129,7 @@ interface MediaTransformationGenerator {
|
|
|
11707
12129
|
* @param output - Configuration for the output format and parameters
|
|
11708
12130
|
* @returns The final transformation result containing the transformed media
|
|
11709
12131
|
*/
|
|
11710
|
-
output(output
|
|
12132
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11711
12133
|
}
|
|
11712
12134
|
/**
|
|
11713
12135
|
* Result of a media transformation operation.
|
|
@@ -11716,19 +12138,19 @@ interface MediaTransformationGenerator {
|
|
|
11716
12138
|
interface MediaTransformationResult {
|
|
11717
12139
|
/**
|
|
11718
12140
|
* Returns the transformed media as a readable stream of bytes.
|
|
11719
|
-
* @returns A
|
|
12141
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11720
12142
|
*/
|
|
11721
|
-
media(): ReadableStream<Uint8Array
|
|
12143
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11722
12144
|
/**
|
|
11723
12145
|
* Returns the transformed media as an HTTP response object.
|
|
11724
|
-
* @returns The transformed media as a Response
|
|
12146
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11725
12147
|
*/
|
|
11726
|
-
response(): Response
|
|
12148
|
+
response(): Promise<Response>;
|
|
11727
12149
|
/**
|
|
11728
12150
|
* Returns the MIME type of the transformed media.
|
|
11729
|
-
* @returns
|
|
12151
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11730
12152
|
*/
|
|
11731
|
-
contentType(): string
|
|
12153
|
+
contentType(): Promise<string>;
|
|
11732
12154
|
}
|
|
11733
12155
|
/**
|
|
11734
12156
|
* Configuration options for transforming media input.
|