workers-ai-provider 3.3.1 → 4.0.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.
Files changed (38) hide show
  1. package/README.md +23 -2
  2. package/dist/anthropic.d.mts +5 -1
  3. package/dist/anthropic.mjs +4 -0
  4. package/dist/anthropic.mjs.map +1 -1
  5. package/dist/{gateway-delegate-D_zkIp5r.d.mts → gateway-delegate-DYjgGAa-.d.mts} +9 -6
  6. package/dist/{gateway-provider-CQU-v2IO.mjs → gateway-provider-BQj8ZnKv.mjs} +14 -2
  7. package/dist/{gateway-provider-CQU-v2IO.mjs.map → gateway-provider-BQj8ZnKv.mjs.map} +1 -1
  8. package/dist/gateway-provider.d.mts +12 -0
  9. package/dist/gateway-provider.mjs +1 -1
  10. package/dist/google.d.mts +5 -1
  11. package/dist/google.mjs +6 -2
  12. package/dist/google.mjs.map +1 -1
  13. package/dist/index.d.mts +70 -31
  14. package/dist/index.mjs +113 -41
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/openai.d.mts +8 -3
  17. package/dist/openai.mjs +7 -2
  18. package/dist/openai.mjs.map +1 -1
  19. package/package.json +11 -11
  20. package/src/aisearch-chat-language-model.ts +10 -10
  21. package/src/anthropic.ts +4 -0
  22. package/src/client-fallback.ts +14 -11
  23. package/src/convert-to-workersai-chat-messages.ts +69 -30
  24. package/src/gateway-delegate.ts +12 -12
  25. package/src/gateway-provider.ts +12 -0
  26. package/src/google.ts +6 -4
  27. package/src/index.ts +38 -4
  28. package/src/map-workersai-finish-reason.ts +2 -2
  29. package/src/map-workersai-usage.ts +4 -4
  30. package/src/openai.ts +7 -2
  31. package/src/streaming.ts +18 -18
  32. package/src/utils.ts +8 -8
  33. package/src/workersai-chat-language-model.ts +64 -14
  34. package/src/workersai-embedding-model.ts +6 -6
  35. package/src/workersai-image-model.ts +6 -6
  36. package/src/workersai-reranking-model.ts +9 -9
  37. package/src/workersai-speech-model.ts +7 -7
  38. package/src/workersai-transcription-model.ts +11 -11
@@ -48,6 +48,12 @@ interface GatewayFetchConfig {
48
48
  * A `fetch` that dispatches the wrapped provider's request through AI Gateway.
49
49
  * Detects the gateway provider id from the request URL (or uses `config.provider`),
50
50
  * strips the provider host to the endpoint path, and forwards the body verbatim.
51
+ *
52
+ * @deprecated Route the vendor's model with `createAI` from
53
+ * `agents/models/ai-sdk`: `ai(model)` for language models, `ai.routed(model)`
54
+ * for embedding, image, speech and transcription models, on AI Gateway's
55
+ * provider-native path. `vendorKey: "request"` forwards the vendor key, as
56
+ * `byok: true` does here.
51
57
  */
52
58
  declare function createGatewayFetch(config: GatewayFetchConfig): typeof globalThis.fetch;
53
59
  /**
@@ -66,6 +72,12 @@ declare function createGatewayFetch(config: GatewayFetchConfig): typeof globalTh
66
72
  * });
67
73
  * const model = openai("gpt-5");
68
74
  * ```
75
+ *
76
+ * @deprecated Route the vendor's model with `createAI` from
77
+ * `agents/models/ai-sdk`: `ai(model)` for language models, `ai.routed(model)`
78
+ * for embedding, image, speech and transcription models, on AI Gateway's
79
+ * provider-native path. `vendorKey: "request"` forwards the vendor key, as
80
+ * `byok: true` does here.
69
81
  */
70
82
  declare function createGatewayProvider<T>(factory: (opts: {
71
83
  apiKey?: string;
@@ -1,2 +1,2 @@
1
- import { n as createGatewayProvider, t as createGatewayFetch } from "./gateway-provider-CQU-v2IO.mjs";
1
+ import { n as createGatewayProvider, t as createGatewayFetch } from "./gateway-provider-BQj8ZnKv.mjs";
2
2
  export { createGatewayFetch, createGatewayProvider };
package/dist/google.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ProviderPlugin } from "./gateway-delegate-D_zkIp5r.mjs";
1
+ import { a as ProviderPlugin } from "./gateway-delegate-DYjgGAa-.mjs";
2
2
 
3
3
  //#region src/google.d.ts
4
4
  /**
@@ -7,6 +7,10 @@ import { a as ProviderPlugin } from "./gateway-delegate-D_zkIp5r.mjs";
7
7
  * (Google AI Studio) and `"google-vertex/<model>"` slugs.
8
8
  *
9
9
  * Requires `@ai-sdk/google` (an optional peer dependency — install it yourself).
10
+ *
11
+ * @deprecated Pass the vendor's own model to `createAI` from
12
+ * `agents/models/ai-sdk` instead of a plugin plus a slug:
13
+ * `ai(createGoogle({ apiKey: "cloudflare" })("gemini-2.5-flash"))`.
10
14
  */
11
15
  declare const google: ProviderPlugin;
12
16
  //#endregion
package/dist/google.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createGoogleGenerativeAI } from "@ai-sdk/google";
1
+ import { createGoogle } from "@ai-sdk/google";
2
2
  //#region src/google.ts
3
3
  /**
4
4
  * Google (Gemini) provider plugin for the gateway delegate. Pass to
@@ -6,10 +6,14 @@ import { createGoogleGenerativeAI } from "@ai-sdk/google";
6
6
  * (Google AI Studio) and `"google-vertex/<model>"` slugs.
7
7
  *
8
8
  * Requires `@ai-sdk/google` (an optional peer dependency — install it yourself).
9
+ *
10
+ * @deprecated Pass the vendor's own model to `createAI` from
11
+ * `agents/models/ai-sdk` instead of a plugin plus a slug:
12
+ * `ai(createGoogle({ apiKey: "cloudflare" })("gemini-2.5-flash"))`.
9
13
  */
10
14
  const google = {
11
15
  wireFormat: "google",
12
- create: ({ modelId, fetch, baseURL }) => createGoogleGenerativeAI({
16
+ create: ({ modelId, fetch, baseURL }) => createGoogle({
13
17
  apiKey: "unused",
14
18
  fetch,
15
19
  ...baseURL ? { baseURL } : {}
@@ -1 +1 @@
1
- {"version":3,"file":"google.mjs","names":[],"sources":["../src/google.ts"],"sourcesContent":["import { createGoogleGenerativeAI } from \"@ai-sdk/google\";\nimport type { ProviderPlugin } from \"./gateway-delegate\";\n\n/**\n * Google (Gemini) provider plugin for the gateway delegate. Pass to\n * `createGatewayDelegate({ providers: [google] })` to handle `\"google/<model>\"`\n * (Google AI Studio) and `\"google-vertex/<model>\"` slugs.\n *\n * Requires `@ai-sdk/google` (an optional peer dependency — install it yourself).\n */\nexport const google: ProviderPlugin = {\n\twireFormat: \"google\",\n\tcreate: ({ modelId, fetch, baseURL }) =>\n\t\t// apiKey is a placeholder — the gateway handles auth (unified billing / BYOK)\n\t\t// and the delegate strips the x-goog-api-key header on the gateway path.\n\t\tcreateGoogleGenerativeAI({ apiKey: \"unused\", fetch, ...(baseURL ? { baseURL } : {}) })(\n\t\t\tmodelId,\n\t\t),\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,SAAyB;CACrC,YAAY;CACZ,SAAS,EAAE,SAAS,OAAO,cAG1B,yBAAyB;EAAE,QAAQ;EAAU;EAAO,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;CAAG,CAAC,CAAC,CACrF,OACD;AACF"}
1
+ {"version":3,"file":"google.mjs","names":[],"sources":["../src/google.ts"],"sourcesContent":["import { createGoogle } from \"@ai-sdk/google\";\nimport type { ProviderPlugin } from \"./gateway-delegate\";\n\n/**\n * Google (Gemini) provider plugin for the gateway delegate. Pass to\n * `createGatewayDelegate({ providers: [google] })` to handle `\"google/<model>\"`\n * (Google AI Studio) and `\"google-vertex/<model>\"` slugs.\n *\n * Requires `@ai-sdk/google` (an optional peer dependency — install it yourself).\n *\n * @deprecated Pass the vendor's own model to `createAI` from\n * `agents/models/ai-sdk` instead of a plugin plus a slug:\n * `ai(createGoogle({ apiKey: \"cloudflare\" })(\"gemini-2.5-flash\"))`.\n */\nexport const google: ProviderPlugin = {\n\twireFormat: \"google\",\n\tcreate: ({ modelId, fetch, baseURL }) =>\n\t\t// apiKey is a placeholder — the gateway handles auth (unified billing / BYOK)\n\t\t// and the delegate strips the x-goog-api-key header on the gateway path.\n\t\tcreateGoogle({ apiKey: \"unused\", fetch, ...(baseURL ? { baseURL } : {}) })(modelId),\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,SAAyB;CACrC,YAAY;CACZ,SAAS,EAAE,SAAS,OAAO,cAG1B,aAAa;EAAE,QAAQ;EAAU;EAAO,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;CAAG,CAAC,CAAC,CAAC,OAAO;AACpF"}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { C as createResumableStream, E as wireableProviders, S as WireFormat, T as findProviderBySlug, _ as GATEWAY_PROVIDERS, a as ProviderPlugin, b as ResumableStreamOptions, c as selectTransport, d as FallbackAttempt, f as GatewayErrorCode, g as Billing, h as WorkersAIGatewayError, i as ParsedSlug, l as FallbackLeg, m as WorkersAIFallbackError, n as DispatchInfo, o as Transport, p as GatewayErrorContext, r as FallbackOptions, s as parseSlug, t as DelegateCallOptions, u as createClientFallbackModel, v as GatewayDelegateError, w as detectProviderByUrl, x as ResumeExpiredPolicy, y as GatewayProviderInfo } from "./gateway-delegate-D_zkIp5r.mjs";
1
+ import { C as createResumableStream, E as wireableProviders, S as WireFormat, T as findProviderBySlug, _ as GATEWAY_PROVIDERS, a as ProviderPlugin, b as ResumableStreamOptions, c as selectTransport, d as FallbackAttempt, f as GatewayErrorCode, g as Billing, h as WorkersAIGatewayError, i as ParsedSlug, l as FallbackLeg, m as WorkersAIFallbackError, n as DispatchInfo, o as Transport, p as GatewayErrorContext, r as FallbackOptions, s as parseSlug, t as DelegateCallOptions, u as createClientFallbackModel, v as GatewayDelegateError, w as detectProviderByUrl, x as ResumeExpiredPolicy, y as GatewayProviderInfo } from "./gateway-delegate-DYjgGAa-.mjs";
2
2
  import { GatewayFetchConfig, createGatewayFetch, createGatewayProvider } from "./gateway-provider.mjs";
3
- import { EmbeddingModelV3, EmbeddingModelV3CallOptions, EmbeddingModelV3Result, ImageModelV3, LanguageModelV3, RerankingModelV3, SpeechModelV3, TranscriptionModelV3 } from "@ai-sdk/provider";
3
+ import { EmbeddingModelV4, EmbeddingModelV4CallOptions, EmbeddingModelV4Result, ImageModelV4, LanguageModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4 } from "@ai-sdk/provider";
4
4
 
5
5
  //#region src/aisearch-chat-settings.d.ts
6
6
  type AISearchChatSettings = {
@@ -65,8 +65,8 @@ type AISearchChatConfig = {
65
65
  binding: AutoRAG;
66
66
  gateway?: GatewayOptions;
67
67
  };
68
- declare class AISearchChatLanguageModel implements LanguageModelV3 {
69
- readonly specificationVersion = "v3";
68
+ declare class AISearchChatLanguageModel implements LanguageModelV4 {
69
+ readonly specificationVersion = "v4";
70
70
  readonly defaultObjectGenerationMode = "json";
71
71
  readonly supportedUrls: Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
72
72
  readonly modelId: TextGenerationModels;
@@ -80,8 +80,8 @@ declare class AISearchChatLanguageModel implements LanguageModelV3 {
80
80
  * Flattens the conversation into a single string for aiSearch.
81
81
  */
82
82
  private buildQuery;
83
- doGenerate(options: Parameters<LanguageModelV3["doGenerate"]>[0]): Promise<Awaited<ReturnType<LanguageModelV3["doGenerate"]>>>;
84
- doStream(options: Parameters<LanguageModelV3["doStream"]>[0]): Promise<Awaited<ReturnType<LanguageModelV3["doStream"]>>>;
83
+ doGenerate(options: Parameters<LanguageModelV4["doGenerate"]>[0]): Promise<Awaited<ReturnType<LanguageModelV4["doGenerate"]>>>;
84
+ doStream(options: Parameters<LanguageModelV4["doStream"]>[0]): Promise<Awaited<ReturnType<LanguageModelV4["doStream"]>>>;
85
85
  }
86
86
  //#endregion
87
87
  //#region src/workersai-embedding-model.d.ts
@@ -99,8 +99,8 @@ type WorkersAIEmbeddingSettings = {
99
99
  */
100
100
  [key: string]: unknown;
101
101
  };
102
- declare class WorkersAIEmbeddingModel implements EmbeddingModelV3 {
103
- readonly specificationVersion = "v3";
102
+ declare class WorkersAIEmbeddingModel implements EmbeddingModelV4 {
103
+ readonly specificationVersion = "v4";
104
104
  readonly modelId: EmbeddingModels;
105
105
  private readonly config;
106
106
  private readonly settings;
@@ -111,7 +111,7 @@ declare class WorkersAIEmbeddingModel implements EmbeddingModelV3 {
111
111
  doEmbed({
112
112
  values,
113
113
  abortSignal
114
- }: EmbeddingModelV3CallOptions): Promise<EmbeddingModelV3Result>;
114
+ }: EmbeddingModelV4CallOptions): Promise<EmbeddingModelV4Result>;
115
115
  }
116
116
  //#endregion
117
117
  //#region src/workersai-chat-settings.d.ts
@@ -163,8 +163,8 @@ type WorkersAIChatConfig = {
163
163
  gateway?: GatewayOptions; /** True when using a real Workers AI binding (not the REST shim). */
164
164
  isBinding: boolean;
165
165
  };
166
- declare class WorkersAIChatLanguageModel implements LanguageModelV3 {
167
- readonly specificationVersion = "v3";
166
+ declare class WorkersAIChatLanguageModel implements LanguageModelV4 {
167
+ readonly specificationVersion = "v4";
168
168
  readonly defaultObjectGenerationMode = "json";
169
169
  readonly supportedUrls: Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
170
170
  readonly modelId: TextGenerationModels;
@@ -190,6 +190,11 @@ declare class WorkersAIChatLanguageModel implements LanguageModelV3 {
190
190
  *
191
191
  * `reasoning_effort: null` is a valid value ("disable reasoning"), so we
192
192
  * check `!== undefined` rather than truthiness.
193
+ *
194
+ * The unified `reasoning` call option (spec v4) is mapped onto
195
+ * `reasoning_effort` between the two: an explicit per-call
196
+ * `providerOptions["workers-ai"].reasoning_effort` wins, then the unified
197
+ * option, then settings.
193
198
  */
194
199
  private buildRunInputs;
195
200
  /**
@@ -211,8 +216,8 @@ declare class WorkersAIChatLanguageModel implements LanguageModelV3 {
211
216
  * place so callers can observe the reinterpretation.
212
217
  */
213
218
  private extractContent;
214
- doGenerate(options: Parameters<LanguageModelV3["doGenerate"]>[0]): Promise<Awaited<ReturnType<LanguageModelV3["doGenerate"]>>>;
215
- doStream(options: Parameters<LanguageModelV3["doStream"]>[0]): Promise<Awaited<ReturnType<LanguageModelV3["doStream"]>>>;
219
+ doGenerate(options: Parameters<LanguageModelV4["doGenerate"]>[0]): Promise<Awaited<ReturnType<LanguageModelV4["doGenerate"]>>>;
220
+ doStream(options: Parameters<LanguageModelV4["doStream"]>[0]): Promise<Awaited<ReturnType<LanguageModelV4["doStream"]>>>;
216
221
  }
217
222
  //#endregion
218
223
  //#region src/workersai-image-settings.d.ts
@@ -226,11 +231,11 @@ type WorkersAIImageConfig = {
226
231
  binding: Ai;
227
232
  gateway?: GatewayOptions;
228
233
  };
229
- declare class WorkersAIImageModel implements ImageModelV3 {
234
+ declare class WorkersAIImageModel implements ImageModelV4 {
230
235
  readonly modelId: ImageGenerationModels;
231
236
  readonly settings: WorkersAIImageSettings;
232
237
  readonly config: WorkersAIImageConfig;
233
- readonly specificationVersion = "v3";
238
+ readonly specificationVersion = "v4";
234
239
  get maxImagesPerCall(): number;
235
240
  get provider(): string;
236
241
  constructor(modelId: ImageGenerationModels, settings: WorkersAIImageSettings, config: WorkersAIImageConfig);
@@ -241,7 +246,7 @@ declare class WorkersAIImageModel implements ImageModelV3 {
241
246
  aspectRatio,
242
247
  seed,
243
248
  abortSignal
244
- }: Parameters<ImageModelV3["doGenerate"]>[0]): Promise<Awaited<ReturnType<ImageModelV3["doGenerate"]>>>;
249
+ }: Parameters<ImageModelV4["doGenerate"]>[0]): Promise<Awaited<ReturnType<ImageModelV4["doGenerate"]>>>;
245
250
  }
246
251
  //#endregion
247
252
  //#region src/workersai-transcription-settings.d.ts
@@ -288,20 +293,20 @@ type WorkersAITranscriptionConfig = {
288
293
  credentials?: CreateRunConfig;
289
294
  };
290
295
  /**
291
- * Workers AI transcription model implementing the AI SDK's `TranscriptionModelV3` interface.
296
+ * Workers AI transcription model implementing the AI SDK's `TranscriptionModelV4` interface.
292
297
  *
293
298
  * Supports:
294
299
  * - Whisper models (`@cf/openai/whisper`, `whisper-tiny-en`, `whisper-large-v3-turbo`)
295
300
  * - Deepgram Nova-3 (`@cf/deepgram/nova-3`) — uses a different input/output format
296
301
  */
297
- declare class WorkersAITranscriptionModel implements TranscriptionModelV3 {
302
+ declare class WorkersAITranscriptionModel implements TranscriptionModelV4 {
298
303
  readonly modelId: TranscriptionModels;
299
304
  readonly settings: WorkersAITranscriptionSettings;
300
305
  readonly config: WorkersAITranscriptionConfig;
301
- readonly specificationVersion = "v3";
306
+ readonly specificationVersion = "v4";
302
307
  get provider(): string;
303
308
  constructor(modelId: TranscriptionModels, settings: WorkersAITranscriptionSettings, config: WorkersAITranscriptionConfig);
304
- doGenerate(options: Parameters<TranscriptionModelV3["doGenerate"]>[0]): Promise<Awaited<ReturnType<TranscriptionModelV3["doGenerate"]>>>;
309
+ doGenerate(options: Parameters<TranscriptionModelV4["doGenerate"]>[0]): Promise<Awaited<ReturnType<TranscriptionModelV4["doGenerate"]>>>;
305
310
  private runWhisper;
306
311
  private normalizeWhisperResponse;
307
312
  private runNova3;
@@ -318,19 +323,19 @@ type WorkersAISpeechConfig = {
318
323
  gateway?: GatewayOptions;
319
324
  };
320
325
  /**
321
- * Workers AI speech (text-to-speech) model implementing the AI SDK's `SpeechModelV3` interface.
326
+ * Workers AI speech (text-to-speech) model implementing the AI SDK's `SpeechModelV4` interface.
322
327
  *
323
328
  * Currently supports Deepgram Aura-1 (`@cf/deepgram/aura-1`).
324
329
  * The model accepts `{ text, voice?, speed? }` and returns raw audio bytes.
325
330
  */
326
- declare class WorkersAISpeechModel implements SpeechModelV3 {
331
+ declare class WorkersAISpeechModel implements SpeechModelV4 {
327
332
  readonly modelId: SpeechModels;
328
333
  readonly settings: WorkersAISpeechSettings;
329
334
  readonly config: WorkersAISpeechConfig;
330
- readonly specificationVersion = "v3";
335
+ readonly specificationVersion = "v4";
331
336
  get provider(): string;
332
337
  constructor(modelId: SpeechModels, settings: WorkersAISpeechSettings, config: WorkersAISpeechConfig);
333
- doGenerate(options: Parameters<SpeechModelV3["doGenerate"]>[0]): Promise<Awaited<ReturnType<SpeechModelV3["doGenerate"]>>>;
338
+ doGenerate(options: Parameters<SpeechModelV4["doGenerate"]>[0]): Promise<Awaited<ReturnType<SpeechModelV4["doGenerate"]>>>;
334
339
  }
335
340
  //#endregion
336
341
  //#region src/workersai-reranking-settings.d.ts
@@ -343,7 +348,7 @@ type WorkersAIRerankingConfig = {
343
348
  gateway?: GatewayOptions;
344
349
  };
345
350
  /**
346
- * Workers AI reranking model implementing the AI SDK's `RerankingModelV3` interface.
351
+ * Workers AI reranking model implementing the AI SDK's `RerankingModelV4` interface.
347
352
  *
348
353
  * Supports BGE reranker models (`@cf/baai/bge-reranker-base`, `bge-reranker-v2-m3`).
349
354
  *
@@ -351,14 +356,14 @@ type WorkersAIRerankingConfig = {
351
356
  * - Input: `{ query, contexts: [{ text }], top_k? }`
352
357
  * - Output: `{ response: [{ id, score }] }`
353
358
  */
354
- declare class WorkersAIRerankingModel implements RerankingModelV3 {
359
+ declare class WorkersAIRerankingModel implements RerankingModelV4 {
355
360
  readonly modelId: RerankingModels;
356
361
  readonly settings: WorkersAIRerankingSettings;
357
362
  readonly config: WorkersAIRerankingConfig;
358
- readonly specificationVersion = "v3";
363
+ readonly specificationVersion = "v4";
359
364
  get provider(): string;
360
365
  constructor(modelId: RerankingModels, settings: WorkersAIRerankingSettings, config: WorkersAIRerankingConfig);
361
- doRerank(options: Parameters<RerankingModelV3["doRerank"]>[0]): Promise<Awaited<ReturnType<RerankingModelV3["doRerank"]>>>;
366
+ doRerank(options: Parameters<RerankingModelV4["doRerank"]>[0]): Promise<Awaited<ReturnType<RerankingModelV4["doRerank"]>>>;
362
367
  }
363
368
  //#endregion
364
369
  //#region src/autorag-chat-language-model.d.ts
@@ -479,11 +484,40 @@ interface WorkersAI {
479
484
  }
480
485
  /**
481
486
  * Create a Workers AI provider instance.
487
+ *
488
+ * @deprecated Use `createAI` from `agents/models/ai-sdk`, with the binding or
489
+ * with an account id and API token (credentials mode's `apiKey`):
490
+ *
491
+ * ```ts
492
+ * import { createAI } from "agents/models/ai-sdk";
493
+ * const ai = createAI({ binding: env.AI }); // or { accountId, apiToken }
494
+ * ai("@cf/zai-org/glm-4.7-flash"); // was workersai("@cf/…")
495
+ * ai("anthropic/claude-opus-4.8"); // was "anthropic/…" + providers; the catalog's spelling
496
+ * ai("dynamic/support"); // dynamic routes, as before
497
+ * ai(createAnthropic({ apiKey: "cloudflare" })("claude-opus-4-8")); // a vendor's own model
498
+ * ai.embedding("@cf/baai/bge-base-en-v1.5"); // .image/.speech/.transcription/.reranking alike
499
+ * ```
500
+ *
501
+ * `vendorKey`, `byokAlias` and `zdr` cover BYOK, and through the binding a
502
+ * catalog stream resumes after a dropped connection. For AI Search, use
503
+ * `ai-search-provider`.
482
504
  */
483
505
  declare function createWorkersAI(options: WorkersAISettings): WorkersAI;
506
+ /**
507
+ * @deprecated Use `createAISearchNamespace` from `ai-search-provider`, over the
508
+ * `ai_search_namespaces` binding that replaces `env.AI.autorag()`:
509
+ * `createAISearchNamespace({ binding: env.AI_SEARCH }).get("my-instance").chat()`.
510
+ * @see https://developers.cloudflare.com/ai-search/api/migration/workers-binding/
511
+ */
484
512
  type AISearchSettings = {
485
513
  binding: AutoRAG;
486
514
  };
515
+ /**
516
+ * @deprecated Use `createAISearchNamespace` from `ai-search-provider`, over the
517
+ * `ai_search_namespaces` binding that replaces `env.AI.autorag()`:
518
+ * `createAISearchNamespace({ binding: env.AI_SEARCH }).get("my-instance").chat()`.
519
+ * @see https://developers.cloudflare.com/ai-search/api/migration/workers-binding/
520
+ */
487
521
  interface AISearchProvider {
488
522
  (settings?: AISearchChatSettings): AISearchChatLanguageModel;
489
523
  /**
@@ -495,7 +529,11 @@ interface AISearchProvider {
495
529
  * Create an AI Search provider instance.
496
530
  *
497
531
  * AI Search (formerly AutoRAG) is Cloudflare's managed search service.
498
- * @see https://developers.cloudflare.com/ai-search/
532
+ *
533
+ * @deprecated Use `createAISearchNamespace` from `ai-search-provider`, over the
534
+ * `ai_search_namespaces` binding that replaces `env.AI.autorag()`:
535
+ * `createAISearchNamespace({ binding: env.AI_SEARCH }).get("my-instance").chat()`.
536
+ * @see https://developers.cloudflare.com/ai-search/api/migration/workers-binding/
499
537
  */
500
538
  declare function createAISearch(options: AISearchSettings, /** @internal */
501
539
 
@@ -511,8 +549,9 @@ type AutoRAGSettings = AISearchSettings;
511
549
  */
512
550
  type AutoRAGProvider = AISearchProvider;
513
551
  /**
514
- * @deprecated Use `createAISearch` instead. AutoRAG has been renamed to AI Search.
515
- * @see https://developers.cloudflare.com/ai-search/
552
+ * @deprecated Use `createAISearchNamespace` from `ai-search-provider`. AutoRAG
553
+ * has been renamed to AI Search.
554
+ * @see https://developers.cloudflare.com/ai-search/api/migration/workers-binding/
516
555
  */
517
556
  declare function createAutoRAG(options: AISearchSettings): AISearchProvider;
518
557
  //#endregion