@workers-community/workers-types 4.20250313.0 → 4.20250317.0

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.
Files changed (3) hide show
  1. package/index.d.ts +39 -1
  2. package/index.ts +39 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4341,6 +4341,7 @@ type AiModelListType = Record<string, any>;
4341
4341
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4342
4342
  aiGatewayLogId: string | null;
4343
4343
  gateway(gatewayId: string): AiGateway;
4344
+ autorag(autoragId: string): AutoRAG;
4344
4345
  run<Name extends keyof AiModelList, Options extends AiOptions>(
4345
4346
  model: Name,
4346
4347
  inputs: AiModelList[Name]["inputs"],
@@ -4360,6 +4361,7 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4360
4361
  }[],
4361
4362
  options?: {
4362
4363
  gateway?: GatewayOptions;
4364
+ extraHeaders?: object;
4363
4365
  },
4364
4366
  ): Promise<ConversionResponse[]>;
4365
4367
  public toMarkdown(
@@ -4369,6 +4371,7 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4369
4371
  },
4370
4372
  options?: {
4371
4373
  gateway?: GatewayOptions;
4374
+ extraHeaders?: object;
4372
4375
  },
4373
4376
  ): Promise<ConversionResponse>;
4374
4377
  }
@@ -4468,7 +4471,42 @@ declare abstract class AiGateway {
4468
4471
  run(
4469
4472
  data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
4470
4473
  ): Promise<Response>;
4471
- getUrl(provider: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4474
+ getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4475
+ }
4476
+ interface AutoRAGInternalError extends Error {}
4477
+ interface AutoRAGNotFoundError extends Error {}
4478
+ interface AutoRAGUnauthorizedError extends Error {}
4479
+ type AutoRagSearchRequest = {
4480
+ query: string;
4481
+ max_num_results?: number;
4482
+ ranking_options?: {
4483
+ ranker?: string;
4484
+ score_threshold?: number;
4485
+ };
4486
+ rewrite_query?: boolean;
4487
+ };
4488
+ type AutoRagSearchResponse = {
4489
+ object: "vector_store.search_results.page";
4490
+ search_query: string;
4491
+ data: {
4492
+ file_id: string;
4493
+ filename: string;
4494
+ score: number;
4495
+ attributes: Record<string, string | number | boolean | null>;
4496
+ content: {
4497
+ type: "text";
4498
+ text: string;
4499
+ }[];
4500
+ }[];
4501
+ has_more: boolean;
4502
+ next_page: string | null;
4503
+ };
4504
+ type AutoRagAiSearchResponse = AutoRagSearchResponse & {
4505
+ response: string;
4506
+ };
4507
+ declare abstract class AutoRAG {
4508
+ search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
4509
+ aiSearch(params: AutoRagSearchRequest): Promise<AutoRagAiSearchResponse>;
4472
4510
  }
4473
4511
  interface BasicImageTransformations {
4474
4512
  /**
package/index.ts CHANGED
@@ -4355,6 +4355,7 @@ export declare abstract class Ai<
4355
4355
  > {
4356
4356
  aiGatewayLogId: string | null;
4357
4357
  gateway(gatewayId: string): AiGateway;
4358
+ autorag(autoragId: string): AutoRAG;
4358
4359
  run<Name extends keyof AiModelList, Options extends AiOptions>(
4359
4360
  model: Name,
4360
4361
  inputs: AiModelList[Name]["inputs"],
@@ -4374,6 +4375,7 @@ export declare abstract class Ai<
4374
4375
  }[],
4375
4376
  options?: {
4376
4377
  gateway?: GatewayOptions;
4378
+ extraHeaders?: object;
4377
4379
  },
4378
4380
  ): Promise<ConversionResponse[]>;
4379
4381
  public toMarkdown(
@@ -4383,6 +4385,7 @@ export declare abstract class Ai<
4383
4385
  },
4384
4386
  options?: {
4385
4387
  gateway?: GatewayOptions;
4388
+ extraHeaders?: object;
4386
4389
  },
4387
4390
  ): Promise<ConversionResponse>;
4388
4391
  }
@@ -4482,7 +4485,42 @@ export declare abstract class AiGateway {
4482
4485
  run(
4483
4486
  data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
4484
4487
  ): Promise<Response>;
4485
- getUrl(provider: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4488
+ getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
4489
+ }
4490
+ export interface AutoRAGInternalError extends Error {}
4491
+ export interface AutoRAGNotFoundError extends Error {}
4492
+ export interface AutoRAGUnauthorizedError extends Error {}
4493
+ export type AutoRagSearchRequest = {
4494
+ query: string;
4495
+ max_num_results?: number;
4496
+ ranking_options?: {
4497
+ ranker?: string;
4498
+ score_threshold?: number;
4499
+ };
4500
+ rewrite_query?: boolean;
4501
+ };
4502
+ export type AutoRagSearchResponse = {
4503
+ object: "vector_store.search_results.page";
4504
+ search_query: string;
4505
+ data: {
4506
+ file_id: string;
4507
+ filename: string;
4508
+ score: number;
4509
+ attributes: Record<string, string | number | boolean | null>;
4510
+ content: {
4511
+ type: "text";
4512
+ text: string;
4513
+ }[];
4514
+ }[];
4515
+ has_more: boolean;
4516
+ next_page: string | null;
4517
+ };
4518
+ export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
4519
+ response: string;
4520
+ };
4521
+ export declare abstract class AutoRAG {
4522
+ search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
4523
+ aiSearch(params: AutoRagSearchRequest): Promise<AutoRagAiSearchResponse>;
4486
4524
  }
4487
4525
  export interface BasicImageTransformations {
4488
4526
  /**
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "author": "Workers Community",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20250313.0",
10
+ "version": "4.20250317.0",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./index.d.ts",