@cloudflare/tanstack-ai 0.1.1 → 0.1.3
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/README.md +9 -0
- package/dist/_tsup-dts-rollup.d.cts +35 -18
- package/dist/_tsup-dts-rollup.d.ts +35 -18
- package/dist/adapters/anthropic.cjs +3 -3
- package/dist/adapters/anthropic.js +2 -2
- package/dist/adapters/gemini.cjs +2 -2
- package/dist/adapters/gemini.js +1 -1
- package/dist/adapters/grok.cjs +3 -3
- package/dist/adapters/grok.js +2 -2
- package/dist/adapters/openai.cjs +3 -3
- package/dist/adapters/openai.js +2 -2
- package/dist/adapters/openrouter.cjs +3 -3
- package/dist/adapters/openrouter.js +2 -2
- package/dist/adapters/workers-ai-image.cjs +3 -3
- package/dist/adapters/workers-ai-image.js +2 -2
- package/dist/adapters/workers-ai-summarize.cjs +3 -3
- package/dist/adapters/workers-ai-summarize.js +2 -2
- package/dist/adapters/workers-ai-transcription.cjs +3 -3
- package/dist/adapters/workers-ai-transcription.js +2 -2
- package/dist/adapters/workers-ai-tts.cjs +3 -3
- package/dist/adapters/workers-ai-tts.js +2 -2
- package/dist/adapters/workers-ai.cjs +3 -3
- package/dist/adapters/workers-ai.js +2 -2
- package/dist/{chunk-4ACSLQDI.cjs → chunk-45DEJBFY.cjs} +7 -5
- package/dist/chunk-45DEJBFY.cjs.map +1 -0
- package/dist/{chunk-S3ALRROX.js → chunk-4HOZDNW6.js} +2 -2
- package/dist/{chunk-6FBIXTAL.cjs → chunk-53RO5I22.cjs} +46 -37
- package/dist/chunk-53RO5I22.cjs.map +1 -0
- package/dist/{chunk-VV3JFKAN.js → chunk-627RVSSB.js} +5 -3
- package/dist/chunk-627RVSSB.js.map +1 -0
- package/dist/{chunk-UUFEOQ6B.js → chunk-727MRLUF.js} +38 -29
- package/dist/chunk-727MRLUF.js.map +1 -0
- package/dist/{chunk-AHXFO2BB.cjs → chunk-7YINQQCY.cjs} +3 -3
- package/dist/chunk-7YINQQCY.cjs.map +1 -0
- package/dist/{chunk-SIOQQHXS.js → chunk-AJMCHPPR.js} +2 -2
- package/dist/chunk-AJMCHPPR.js.map +1 -0
- package/dist/{chunk-GL2EQLMI.cjs → chunk-CPOXZIMA.cjs} +7 -5
- package/dist/chunk-CPOXZIMA.cjs.map +1 -0
- package/dist/{chunk-SFZAUNHJ.cjs → chunk-DQGO754X.cjs} +5 -5
- package/dist/{chunk-SFZAUNHJ.cjs.map → chunk-DQGO754X.cjs.map} +1 -1
- package/dist/{chunk-VZJHRPOT.cjs → chunk-DTGQYEJ2.cjs} +50 -32
- package/dist/chunk-DTGQYEJ2.cjs.map +1 -0
- package/dist/{chunk-ALUCJNDE.js → chunk-GST6AT3R.js} +5 -3
- package/dist/chunk-GST6AT3R.js.map +1 -0
- package/dist/{chunk-5YEJ5ZRQ.js → chunk-HDDZEGLC.js} +49 -31
- package/dist/chunk-HDDZEGLC.js.map +1 -0
- package/dist/{chunk-F75IZQCM.js → chunk-HFZK4C5B.js} +2 -2
- package/dist/{chunk-AN23SOZX.cjs → chunk-IL6PTKJE.cjs} +7 -5
- package/dist/chunk-IL6PTKJE.cjs.map +1 -0
- package/dist/{chunk-7AEFXYJG.js → chunk-J5DSSZTO.js} +9 -3
- package/dist/chunk-J5DSSZTO.js.map +1 -0
- package/dist/{chunk-OV65IEEY.cjs → chunk-MPVUETJY.cjs} +3 -3
- package/dist/{chunk-OV65IEEY.cjs.map → chunk-MPVUETJY.cjs.map} +1 -1
- package/dist/{chunk-R2MRGLZ4.js → chunk-PMPGIUVA.js} +5 -3
- package/dist/chunk-PMPGIUVA.js.map +1 -0
- package/dist/{chunk-6OXP4IVS.cjs → chunk-QUS7INYA.cjs} +5 -5
- package/dist/{chunk-6OXP4IVS.cjs.map → chunk-QUS7INYA.cjs.map} +1 -1
- package/dist/{chunk-PAVBM57P.js → chunk-RKBJLYVO.js} +2 -2
- package/dist/{chunk-RGDUK5KX.cjs → chunk-V4LKHWJA.cjs} +9 -3
- package/dist/chunk-V4LKHWJA.cjs.map +1 -0
- package/dist/{chunk-2RO3A3R4.js → chunk-XCLZJGUI.js} +5 -3
- package/dist/chunk-XCLZJGUI.js.map +1 -0
- package/dist/{chunk-M64PETK7.cjs → chunk-Y2PUBTP5.cjs} +7 -5
- package/dist/chunk-Y2PUBTP5.cjs.map +1 -0
- package/dist/index.cjs +12 -12
- package/dist/index.js +11 -11
- package/package.json +11 -10
- package/dist/chunk-2RO3A3R4.js.map +0 -1
- package/dist/chunk-4ACSLQDI.cjs.map +0 -1
- package/dist/chunk-5YEJ5ZRQ.js.map +0 -1
- package/dist/chunk-6FBIXTAL.cjs.map +0 -1
- package/dist/chunk-7AEFXYJG.js.map +0 -1
- package/dist/chunk-AHXFO2BB.cjs.map +0 -1
- package/dist/chunk-ALUCJNDE.js.map +0 -1
- package/dist/chunk-AN23SOZX.cjs.map +0 -1
- package/dist/chunk-GL2EQLMI.cjs.map +0 -1
- package/dist/chunk-M64PETK7.cjs.map +0 -1
- package/dist/chunk-R2MRGLZ4.js.map +0 -1
- package/dist/chunk-RGDUK5KX.cjs.map +0 -1
- package/dist/chunk-SIOQQHXS.js.map +0 -1
- package/dist/chunk-UUFEOQ6B.js.map +0 -1
- package/dist/chunk-VV3JFKAN.js.map +0 -1
- package/dist/chunk-VZJHRPOT.cjs.map +0 -1
- /package/dist/{chunk-S3ALRROX.js.map → chunk-4HOZDNW6.js.map} +0 -0
- /package/dist/{chunk-F75IZQCM.js.map → chunk-HFZK4C5B.js.map} +0 -0
- /package/dist/{chunk-PAVBM57P.js.map → chunk-RKBJLYVO.js.map} +0 -0
package/README.md
CHANGED
|
@@ -275,6 +275,15 @@ Workers AI supports four configuration modes:
|
|
|
275
275
|
|
|
276
276
|
Third-party providers (OpenAI, Anthropic, Gemini, Grok, OpenRouter) only support the gateway modes.
|
|
277
277
|
|
|
278
|
+
All Workers AI config modes also accept `sessionAffinity` to route requests with the same key to the same backend replica for prefix-cache optimization:
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
const adapter = createWorkersAiChat("@cf/meta/llama-3.3-70b-instruct-fp8-fast", {
|
|
282
|
+
binding: env.AI,
|
|
283
|
+
sessionAffinity: "my-unique-session-id",
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
|
|
278
287
|
## Links
|
|
279
288
|
|
|
280
289
|
- [TanStack AI Documentation](https://tanstack.com/ai)
|
|
@@ -2,6 +2,7 @@ import type { AiModels as AiModels_2 } from '@cloudflare/workers-types';
|
|
|
2
2
|
import { ANTHROPIC_MODELS } from '@tanstack/ai-anthropic';
|
|
3
3
|
import { AnthropicChatModel } from '@tanstack/ai-anthropic';
|
|
4
4
|
import { AnthropicSummarizeAdapter } from '@tanstack/ai-anthropic';
|
|
5
|
+
import { AnthropicTextAdapter } from '@tanstack/ai-anthropic';
|
|
5
6
|
import type { AnyTextAdapter } from '@tanstack/ai';
|
|
6
7
|
import type { BaseAiTextEmbeddings as BaseAiTextEmbeddings_2 } from '@cloudflare/workers-types';
|
|
7
8
|
import type { BaseAiTextGeneration as BaseAiTextGeneration_2 } from '@cloudflare/workers-types';
|
|
@@ -84,7 +85,7 @@ export declare interface AiGatewayConfig {
|
|
|
84
85
|
metadata?: Record<string, unknown>;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
export declare
|
|
88
|
+
export declare type AiGatewayCredentialsConfig = {
|
|
88
89
|
/**
|
|
89
90
|
* The Cloudflare account ID
|
|
90
91
|
*/
|
|
@@ -93,15 +94,16 @@ export declare interface AiGatewayCredentialsConfig {
|
|
|
93
94
|
* The AI Gateway ID
|
|
94
95
|
*/
|
|
95
96
|
gatewayId: string;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
} & ({
|
|
98
|
+
/** Cloudflare API Key for AI Gateway */
|
|
99
|
+
cfApiKey: string;
|
|
99
100
|
apiKey?: string;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
} | {
|
|
102
|
+
/** Provider API Key */
|
|
103
|
+
apiKey: string;
|
|
104
|
+
/** Cloudflare API Key for AI Gateway */
|
|
103
105
|
cfApiKey?: string;
|
|
104
|
-
}
|
|
106
|
+
});
|
|
105
107
|
|
|
106
108
|
export { ANTHROPIC_MODELS }
|
|
107
109
|
export { ANTHROPIC_MODELS as ANTHROPIC_MODELS_alias_1 }
|
|
@@ -145,7 +147,7 @@ export declare function collectStream(stream: ReadableStream<Uint8Array>): Promi
|
|
|
145
147
|
* Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,
|
|
146
148
|
* we can inject the gateway fetch directly — no subclassing needed.
|
|
147
149
|
*/
|
|
148
|
-
declare function createAnthropicChat(model: AnthropicChatModel, config: AnthropicGatewayConfig):
|
|
150
|
+
declare function createAnthropicChat(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnthropicTextAdapter<AnthropicChatModel>;
|
|
149
151
|
export { createAnthropicChat }
|
|
150
152
|
export { createAnthropicChat as createAnthropicChat_alias_1 }
|
|
151
153
|
|
|
@@ -329,7 +331,9 @@ export { createOpenRouterSummarize as createOpenRouterSummarize_alias_1 }
|
|
|
329
331
|
* request parameters are extracted from the JSON body, matching Workers AI's
|
|
330
332
|
* `binding.run(model, inputs)` calling convention.
|
|
331
333
|
*/
|
|
332
|
-
export declare function createWorkersAiBindingFetch(binding: WorkersAiBinding
|
|
334
|
+
export declare function createWorkersAiBindingFetch(binding: WorkersAiBinding, options?: {
|
|
335
|
+
extraHeaders?: Record<string, string>;
|
|
336
|
+
}): typeof fetch;
|
|
333
337
|
|
|
334
338
|
declare function createWorkersAiChat(model: WorkersAiTextModel, config: WorkersAiAdapterConfig): WorkersAiTextAdapter<WorkersAiTextModel>;
|
|
335
339
|
export { createWorkersAiChat }
|
|
@@ -579,6 +583,13 @@ export { OpenRouterSummarizeModel as OpenRouterSummarizeModel_alias_1 }
|
|
|
579
583
|
*/
|
|
580
584
|
export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
|
|
581
585
|
|
|
586
|
+
/**
|
|
587
|
+
* Validates that a WorkersAiAdapterConfig contains a valid configuration.
|
|
588
|
+
* Throws an error if neither a binding, credentials (accountId + apiKey),
|
|
589
|
+
* nor a gateway configuration is provided.
|
|
590
|
+
*/
|
|
591
|
+
export declare function validateWorkersAiConfig(config: WorkersAiAdapterConfig): void;
|
|
592
|
+
|
|
582
593
|
/**
|
|
583
594
|
* Config for Workers AI adapters. Supports four modes:
|
|
584
595
|
* - Plain binding: `{ binding: env.AI }`
|
|
@@ -593,9 +604,15 @@ export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
|
|
|
593
604
|
* upstream provider), distinct from `cfApiKey` (used in the `cf-aig-authorization`
|
|
594
605
|
* header for authenticated gateways).
|
|
595
606
|
*/
|
|
596
|
-
declare type WorkersAiAdapterConfig = WorkersAiDirectBindingConfig | WorkersAiDirectCredentialsConfig | (AiGatewayAdapterConfig & {
|
|
607
|
+
declare type WorkersAiAdapterConfig = (WorkersAiDirectBindingConfig | WorkersAiDirectCredentialsConfig | (AiGatewayAdapterConfig & {
|
|
597
608
|
apiKey?: string;
|
|
598
|
-
})
|
|
609
|
+
})) & {
|
|
610
|
+
/**
|
|
611
|
+
* Session affinity key for prefix-cache optimization.
|
|
612
|
+
* Routes requests with the same key to the same backend replica.
|
|
613
|
+
*/
|
|
614
|
+
sessionAffinity?: string;
|
|
615
|
+
};
|
|
599
616
|
export { WorkersAiAdapterConfig }
|
|
600
617
|
export { WorkersAiAdapterConfig as WorkersAiAdapterConfig_alias_1 }
|
|
601
618
|
|
|
@@ -643,7 +660,7 @@ export declare class WorkersAiEmbeddingAdapter {
|
|
|
643
660
|
|
|
644
661
|
export declare type WorkersAiEmbeddingModel = {
|
|
645
662
|
[K in keyof AiModels_2]: AiModels_2[K] extends BaseAiTextEmbeddings_2 ? K : never;
|
|
646
|
-
}[keyof AiModels_2];
|
|
663
|
+
}[keyof AiModels_2] | (string & {});
|
|
647
664
|
|
|
648
665
|
export declare interface WorkersAiEmbeddingResult {
|
|
649
666
|
embeddings: number[][];
|
|
@@ -663,7 +680,7 @@ export declare class WorkersAiImageAdapter extends BaseImageAdapter<WorkersAiIma
|
|
|
663
680
|
|
|
664
681
|
declare type WorkersAiImageModel = {
|
|
665
682
|
[K in keyof AiModels_2]: AiModels_2[K] extends BaseAiTextToImage_2 ? K : never;
|
|
666
|
-
}[keyof AiModels_2];
|
|
683
|
+
}[keyof AiModels_2] | (string & {});
|
|
667
684
|
export { WorkersAiImageModel }
|
|
668
685
|
export { WorkersAiImageModel as WorkersAiImageModel_alias_1 }
|
|
669
686
|
|
|
@@ -721,7 +738,7 @@ export declare class WorkersAiSummarizeAdapter extends BaseSummarizeAdapter<Work
|
|
|
721
738
|
/**
|
|
722
739
|
* Workers AI models that support summarization.
|
|
723
740
|
*/
|
|
724
|
-
declare type WorkersAiSummarizeModel = "@cf/facebook/bart-large-cnn";
|
|
741
|
+
declare type WorkersAiSummarizeModel = "@cf/facebook/bart-large-cnn" | (string & {});
|
|
725
742
|
export { WorkersAiSummarizeModel }
|
|
726
743
|
export { WorkersAiSummarizeModel as WorkersAiSummarizeModel_alias_1 }
|
|
727
744
|
|
|
@@ -735,7 +752,7 @@ export declare class WorkersAiTextAdapter<TModel extends WorkersAiTextModel> ext
|
|
|
735
752
|
|
|
736
753
|
declare type WorkersAiTextModel = {
|
|
737
754
|
[K in keyof AiModels_2]: AiModels_2[K] extends BaseAiTextGeneration_2 ? K : never;
|
|
738
|
-
}[keyof AiModels_2];
|
|
755
|
+
}[keyof AiModels_2] | (string & {});
|
|
739
756
|
export { WorkersAiTextModel }
|
|
740
757
|
export { WorkersAiTextModel as WorkersAiTextModel_alias_1 }
|
|
741
758
|
|
|
@@ -784,7 +801,7 @@ export declare class WorkersAiTranscriptionAdapter extends BaseTranscriptionAdap
|
|
|
784
801
|
* Whisper models. Via binding it accepts `{ audio: { body: base64, contentType } }`.
|
|
785
802
|
* Via REST it requires multipart form data (not JSON). The adapter handles both.
|
|
786
803
|
*/
|
|
787
|
-
declare type WorkersAiTranscriptionModel = "@cf/openai/whisper" | "@cf/openai/whisper-tiny-en" | "@cf/openai/whisper-large-v3-turbo" | "@cf/deepgram/nova-3";
|
|
804
|
+
declare type WorkersAiTranscriptionModel = "@cf/openai/whisper" | "@cf/openai/whisper-tiny-en" | "@cf/openai/whisper-large-v3-turbo" | "@cf/deepgram/nova-3" | (string & {});
|
|
788
805
|
export { WorkersAiTranscriptionModel }
|
|
789
806
|
export { WorkersAiTranscriptionModel as WorkersAiTranscriptionModel_alias_1 }
|
|
790
807
|
|
|
@@ -813,7 +830,7 @@ export declare class WorkersAiTTSAdapter extends BaseTTSAdapter<WorkersAiTTSMode
|
|
|
813
830
|
* behind what's deployed. We use a string union here that matches the known
|
|
814
831
|
* models including Deepgram partner models.
|
|
815
832
|
*/
|
|
816
|
-
declare type WorkersAiTTSModel = "@cf/deepgram/aura-1" | "@cf/deepgram/aura-2-en" | "@cf/deepgram/aura-2-es";
|
|
833
|
+
declare type WorkersAiTTSModel = "@cf/deepgram/aura-1" | "@cf/deepgram/aura-2-en" | "@cf/deepgram/aura-2-es" | (string & {});
|
|
817
834
|
export { WorkersAiTTSModel }
|
|
818
835
|
export { WorkersAiTTSModel as WorkersAiTTSModel_alias_1 }
|
|
819
836
|
|
|
@@ -2,6 +2,7 @@ import type { AiModels as AiModels_2 } from '@cloudflare/workers-types';
|
|
|
2
2
|
import { ANTHROPIC_MODELS } from '@tanstack/ai-anthropic';
|
|
3
3
|
import { AnthropicChatModel } from '@tanstack/ai-anthropic';
|
|
4
4
|
import { AnthropicSummarizeAdapter } from '@tanstack/ai-anthropic';
|
|
5
|
+
import { AnthropicTextAdapter } from '@tanstack/ai-anthropic';
|
|
5
6
|
import type { AnyTextAdapter } from '@tanstack/ai';
|
|
6
7
|
import type { BaseAiTextEmbeddings as BaseAiTextEmbeddings_2 } from '@cloudflare/workers-types';
|
|
7
8
|
import type { BaseAiTextGeneration as BaseAiTextGeneration_2 } from '@cloudflare/workers-types';
|
|
@@ -84,7 +85,7 @@ export declare interface AiGatewayConfig {
|
|
|
84
85
|
metadata?: Record<string, unknown>;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
export declare
|
|
88
|
+
export declare type AiGatewayCredentialsConfig = {
|
|
88
89
|
/**
|
|
89
90
|
* The Cloudflare account ID
|
|
90
91
|
*/
|
|
@@ -93,15 +94,16 @@ export declare interface AiGatewayCredentialsConfig {
|
|
|
93
94
|
* The AI Gateway ID
|
|
94
95
|
*/
|
|
95
96
|
gatewayId: string;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
} & ({
|
|
98
|
+
/** Cloudflare API Key for AI Gateway */
|
|
99
|
+
cfApiKey: string;
|
|
99
100
|
apiKey?: string;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
} | {
|
|
102
|
+
/** Provider API Key */
|
|
103
|
+
apiKey: string;
|
|
104
|
+
/** Cloudflare API Key for AI Gateway */
|
|
103
105
|
cfApiKey?: string;
|
|
104
|
-
}
|
|
106
|
+
});
|
|
105
107
|
|
|
106
108
|
export { ANTHROPIC_MODELS }
|
|
107
109
|
export { ANTHROPIC_MODELS as ANTHROPIC_MODELS_alias_1 }
|
|
@@ -145,7 +147,7 @@ export declare function collectStream(stream: ReadableStream<Uint8Array>): Promi
|
|
|
145
147
|
* Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,
|
|
146
148
|
* we can inject the gateway fetch directly — no subclassing needed.
|
|
147
149
|
*/
|
|
148
|
-
declare function createAnthropicChat(model: AnthropicChatModel, config: AnthropicGatewayConfig):
|
|
150
|
+
declare function createAnthropicChat(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnthropicTextAdapter<AnthropicChatModel>;
|
|
149
151
|
export { createAnthropicChat }
|
|
150
152
|
export { createAnthropicChat as createAnthropicChat_alias_1 }
|
|
151
153
|
|
|
@@ -329,7 +331,9 @@ export { createOpenRouterSummarize as createOpenRouterSummarize_alias_1 }
|
|
|
329
331
|
* request parameters are extracted from the JSON body, matching Workers AI's
|
|
330
332
|
* `binding.run(model, inputs)` calling convention.
|
|
331
333
|
*/
|
|
332
|
-
export declare function createWorkersAiBindingFetch(binding: WorkersAiBinding
|
|
334
|
+
export declare function createWorkersAiBindingFetch(binding: WorkersAiBinding, options?: {
|
|
335
|
+
extraHeaders?: Record<string, string>;
|
|
336
|
+
}): typeof fetch;
|
|
333
337
|
|
|
334
338
|
declare function createWorkersAiChat(model: WorkersAiTextModel, config: WorkersAiAdapterConfig): WorkersAiTextAdapter<WorkersAiTextModel>;
|
|
335
339
|
export { createWorkersAiChat }
|
|
@@ -579,6 +583,13 @@ export { OpenRouterSummarizeModel as OpenRouterSummarizeModel_alias_1 }
|
|
|
579
583
|
*/
|
|
580
584
|
export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
|
|
581
585
|
|
|
586
|
+
/**
|
|
587
|
+
* Validates that a WorkersAiAdapterConfig contains a valid configuration.
|
|
588
|
+
* Throws an error if neither a binding, credentials (accountId + apiKey),
|
|
589
|
+
* nor a gateway configuration is provided.
|
|
590
|
+
*/
|
|
591
|
+
export declare function validateWorkersAiConfig(config: WorkersAiAdapterConfig): void;
|
|
592
|
+
|
|
582
593
|
/**
|
|
583
594
|
* Config for Workers AI adapters. Supports four modes:
|
|
584
595
|
* - Plain binding: `{ binding: env.AI }`
|
|
@@ -593,9 +604,15 @@ export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
|
|
|
593
604
|
* upstream provider), distinct from `cfApiKey` (used in the `cf-aig-authorization`
|
|
594
605
|
* header for authenticated gateways).
|
|
595
606
|
*/
|
|
596
|
-
declare type WorkersAiAdapterConfig = WorkersAiDirectBindingConfig | WorkersAiDirectCredentialsConfig | (AiGatewayAdapterConfig & {
|
|
607
|
+
declare type WorkersAiAdapterConfig = (WorkersAiDirectBindingConfig | WorkersAiDirectCredentialsConfig | (AiGatewayAdapterConfig & {
|
|
597
608
|
apiKey?: string;
|
|
598
|
-
})
|
|
609
|
+
})) & {
|
|
610
|
+
/**
|
|
611
|
+
* Session affinity key for prefix-cache optimization.
|
|
612
|
+
* Routes requests with the same key to the same backend replica.
|
|
613
|
+
*/
|
|
614
|
+
sessionAffinity?: string;
|
|
615
|
+
};
|
|
599
616
|
export { WorkersAiAdapterConfig }
|
|
600
617
|
export { WorkersAiAdapterConfig as WorkersAiAdapterConfig_alias_1 }
|
|
601
618
|
|
|
@@ -643,7 +660,7 @@ export declare class WorkersAiEmbeddingAdapter {
|
|
|
643
660
|
|
|
644
661
|
export declare type WorkersAiEmbeddingModel = {
|
|
645
662
|
[K in keyof AiModels_2]: AiModels_2[K] extends BaseAiTextEmbeddings_2 ? K : never;
|
|
646
|
-
}[keyof AiModels_2];
|
|
663
|
+
}[keyof AiModels_2] | (string & {});
|
|
647
664
|
|
|
648
665
|
export declare interface WorkersAiEmbeddingResult {
|
|
649
666
|
embeddings: number[][];
|
|
@@ -663,7 +680,7 @@ export declare class WorkersAiImageAdapter extends BaseImageAdapter<WorkersAiIma
|
|
|
663
680
|
|
|
664
681
|
declare type WorkersAiImageModel = {
|
|
665
682
|
[K in keyof AiModels_2]: AiModels_2[K] extends BaseAiTextToImage_2 ? K : never;
|
|
666
|
-
}[keyof AiModels_2];
|
|
683
|
+
}[keyof AiModels_2] | (string & {});
|
|
667
684
|
export { WorkersAiImageModel }
|
|
668
685
|
export { WorkersAiImageModel as WorkersAiImageModel_alias_1 }
|
|
669
686
|
|
|
@@ -721,7 +738,7 @@ export declare class WorkersAiSummarizeAdapter extends BaseSummarizeAdapter<Work
|
|
|
721
738
|
/**
|
|
722
739
|
* Workers AI models that support summarization.
|
|
723
740
|
*/
|
|
724
|
-
declare type WorkersAiSummarizeModel = "@cf/facebook/bart-large-cnn";
|
|
741
|
+
declare type WorkersAiSummarizeModel = "@cf/facebook/bart-large-cnn" | (string & {});
|
|
725
742
|
export { WorkersAiSummarizeModel }
|
|
726
743
|
export { WorkersAiSummarizeModel as WorkersAiSummarizeModel_alias_1 }
|
|
727
744
|
|
|
@@ -735,7 +752,7 @@ export declare class WorkersAiTextAdapter<TModel extends WorkersAiTextModel> ext
|
|
|
735
752
|
|
|
736
753
|
declare type WorkersAiTextModel = {
|
|
737
754
|
[K in keyof AiModels_2]: AiModels_2[K] extends BaseAiTextGeneration_2 ? K : never;
|
|
738
|
-
}[keyof AiModels_2];
|
|
755
|
+
}[keyof AiModels_2] | (string & {});
|
|
739
756
|
export { WorkersAiTextModel }
|
|
740
757
|
export { WorkersAiTextModel as WorkersAiTextModel_alias_1 }
|
|
741
758
|
|
|
@@ -784,7 +801,7 @@ export declare class WorkersAiTranscriptionAdapter extends BaseTranscriptionAdap
|
|
|
784
801
|
* Whisper models. Via binding it accepts `{ audio: { body: base64, contentType } }`.
|
|
785
802
|
* Via REST it requires multipart form data (not JSON). The adapter handles both.
|
|
786
803
|
*/
|
|
787
|
-
declare type WorkersAiTranscriptionModel = "@cf/openai/whisper" | "@cf/openai/whisper-tiny-en" | "@cf/openai/whisper-large-v3-turbo" | "@cf/deepgram/nova-3";
|
|
804
|
+
declare type WorkersAiTranscriptionModel = "@cf/openai/whisper" | "@cf/openai/whisper-tiny-en" | "@cf/openai/whisper-large-v3-turbo" | "@cf/deepgram/nova-3" | (string & {});
|
|
788
805
|
export { WorkersAiTranscriptionModel }
|
|
789
806
|
export { WorkersAiTranscriptionModel as WorkersAiTranscriptionModel_alias_1 }
|
|
790
807
|
|
|
@@ -813,7 +830,7 @@ export declare class WorkersAiTTSAdapter extends BaseTTSAdapter<WorkersAiTTSMode
|
|
|
813
830
|
* behind what's deployed. We use a string union here that matches the known
|
|
814
831
|
* models including Deepgram partner models.
|
|
815
832
|
*/
|
|
816
|
-
declare type WorkersAiTTSModel = "@cf/deepgram/aura-1" | "@cf/deepgram/aura-2-en" | "@cf/deepgram/aura-2-es";
|
|
833
|
+
declare type WorkersAiTTSModel = "@cf/deepgram/aura-1" | "@cf/deepgram/aura-2-en" | "@cf/deepgram/aura-2-es" | (string & {});
|
|
817
834
|
export { WorkersAiTTSModel }
|
|
818
835
|
export { WorkersAiTTSModel as WorkersAiTTSModel_alias_1 }
|
|
819
836
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
5
|
+
var _chunk7YINQQCYcjs = require('../chunk-7YINQQCY.cjs');
|
|
6
|
+
require('../chunk-53RO5I22.cjs');
|
|
7
7
|
require('../chunk-4DE2IREA.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.ANTHROPIC_MODELS =
|
|
12
|
+
exports.ANTHROPIC_MODELS = _chunk7YINQQCYcjs.ANTHROPIC_MODELS; exports.createAnthropicChat = _chunk7YINQQCYcjs.createAnthropicChat; exports.createAnthropicSummarize = _chunk7YINQQCYcjs.createAnthropicSummarize;
|
|
13
13
|
//# sourceMappingURL=anthropic.cjs.map
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
ANTHROPIC_MODELS,
|
|
3
3
|
createAnthropicChat,
|
|
4
4
|
createAnthropicSummarize
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-AJMCHPPR.js";
|
|
6
|
+
import "../chunk-727MRLUF.js";
|
|
7
7
|
import "../chunk-V6TY7KAL.js";
|
|
8
8
|
export {
|
|
9
9
|
ANTHROPIC_MODELS,
|
package/dist/adapters/gemini.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkV4LKHWJAcjs = require('../chunk-V4LKHWJA.cjs');
|
|
11
11
|
require('../chunk-4DE2IREA.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
@@ -18,5 +18,5 @@ require('../chunk-4DE2IREA.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
exports.GeminiImageModels =
|
|
21
|
+
exports.GeminiImageModels = _chunkV4LKHWJAcjs.GeminiImageModels; exports.GeminiSummarizeModels = _chunkV4LKHWJAcjs.GeminiSummarizeModels; exports.GeminiTTSModels = _chunkV4LKHWJAcjs.GeminiTTSModels; exports.GeminiTextModels = _chunkV4LKHWJAcjs.GeminiTextModels; exports.createGeminiChat = _chunkV4LKHWJAcjs.createGeminiChat; exports.createGeminiImage = _chunkV4LKHWJAcjs.createGeminiImage; exports.createGeminiSummarize = _chunkV4LKHWJAcjs.createGeminiSummarize; exports.createGeminiTts = _chunkV4LKHWJAcjs.createGeminiTts;
|
|
22
22
|
//# sourceMappingURL=gemini.cjs.map
|
package/dist/adapters/gemini.js
CHANGED
package/dist/adapters/grok.cjs
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('../chunk-
|
|
7
|
+
var _chunkQUS7INYAcjs = require('../chunk-QUS7INYA.cjs');
|
|
8
|
+
require('../chunk-53RO5I22.cjs');
|
|
9
9
|
require('../chunk-4DE2IREA.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,5 +13,5 @@ require('../chunk-4DE2IREA.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.GROK_CHAT_MODELS =
|
|
16
|
+
exports.GROK_CHAT_MODELS = _chunkQUS7INYAcjs.GROK_CHAT_MODELS; exports.GROK_IMAGE_MODELS = _chunkQUS7INYAcjs.GROK_IMAGE_MODELS; exports.createGrokChat = _chunkQUS7INYAcjs.createGrokChat; exports.createGrokImage = _chunkQUS7INYAcjs.createGrokImage; exports.createGrokSummarize = _chunkQUS7INYAcjs.createGrokSummarize;
|
|
17
17
|
//# sourceMappingURL=grok.cjs.map
|
package/dist/adapters/grok.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
createGrokChat,
|
|
5
5
|
createGrokImage,
|
|
6
6
|
createGrokSummarize
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-HFZK4C5B.js";
|
|
8
|
+
import "../chunk-727MRLUF.js";
|
|
9
9
|
import "../chunk-V6TY7KAL.js";
|
|
10
10
|
export {
|
|
11
11
|
GROK_CHAT_MODELS,
|
package/dist/adapters/openai.cjs
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
require('../chunk-
|
|
13
|
+
var _chunkMPVUETJYcjs = require('../chunk-MPVUETJY.cjs');
|
|
14
|
+
require('../chunk-53RO5I22.cjs');
|
|
15
15
|
require('../chunk-4DE2IREA.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
@@ -25,5 +25,5 @@ require('../chunk-4DE2IREA.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
exports.OPENAI_CHAT_MODELS =
|
|
28
|
+
exports.OPENAI_CHAT_MODELS = _chunkMPVUETJYcjs.OPENAI_CHAT_MODELS; exports.OPENAI_IMAGE_MODELS = _chunkMPVUETJYcjs.OPENAI_IMAGE_MODELS; exports.OPENAI_TRANSCRIPTION_MODELS = _chunkMPVUETJYcjs.OPENAI_TRANSCRIPTION_MODELS; exports.OPENAI_TTS_MODELS = _chunkMPVUETJYcjs.OPENAI_TTS_MODELS; exports.OPENAI_VIDEO_MODELS = _chunkMPVUETJYcjs.OPENAI_VIDEO_MODELS; exports.createOpenAiChat = _chunkMPVUETJYcjs.createOpenAiChat; exports.createOpenAiImage = _chunkMPVUETJYcjs.createOpenAiImage; exports.createOpenAiSummarize = _chunkMPVUETJYcjs.createOpenAiSummarize; exports.createOpenAiTranscription = _chunkMPVUETJYcjs.createOpenAiTranscription; exports.createOpenAiTts = _chunkMPVUETJYcjs.createOpenAiTts; exports.createOpenAiVideo = _chunkMPVUETJYcjs.createOpenAiVideo;
|
|
29
29
|
//# sourceMappingURL=openai.cjs.map
|
package/dist/adapters/openai.js
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
createOpenAiTranscription,
|
|
11
11
|
createOpenAiTts,
|
|
12
12
|
createOpenAiVideo
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
} from "../chunk-RKBJLYVO.js";
|
|
14
|
+
import "../chunk-727MRLUF.js";
|
|
15
15
|
import "../chunk-V6TY7KAL.js";
|
|
16
16
|
export {
|
|
17
17
|
OPENAI_CHAT_MODELS,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
5
|
+
var _chunkDQGO754Xcjs = require('../chunk-DQGO754X.cjs');
|
|
6
|
+
require('../chunk-53RO5I22.cjs');
|
|
7
7
|
require('../chunk-4DE2IREA.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.createOpenRouterChat =
|
|
12
|
+
exports.createOpenRouterChat = _chunkDQGO754Xcjs.createOpenRouterChat; exports.createOpenRouterImage = _chunkDQGO754Xcjs.createOpenRouterImage; exports.createOpenRouterSummarize = _chunkDQGO754Xcjs.createOpenRouterSummarize;
|
|
13
13
|
//# sourceMappingURL=openrouter.cjs.map
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
createOpenRouterChat,
|
|
3
3
|
createOpenRouterImage,
|
|
4
4
|
createOpenRouterSummarize
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-4HOZDNW6.js";
|
|
6
|
+
import "../chunk-727MRLUF.js";
|
|
7
7
|
import "../chunk-V6TY7KAL.js";
|
|
8
8
|
export {
|
|
9
9
|
createOpenRouterChat,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkIL6PTKJEcjs = require('../chunk-IL6PTKJE.cjs');
|
|
5
5
|
require('../chunk-3VQDXJLW.cjs');
|
|
6
6
|
require('../chunk-7HSUHP63.cjs');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-53RO5I22.cjs');
|
|
8
8
|
require('../chunk-4DE2IREA.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.WorkersAiImageAdapter =
|
|
12
|
+
exports.WorkersAiImageAdapter = _chunkIL6PTKJEcjs.WorkersAiImageAdapter; exports.createWorkersAiImage = _chunkIL6PTKJEcjs.createWorkersAiImage;
|
|
13
13
|
//# sourceMappingURL=workers-ai-image.cjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkersAiImageAdapter,
|
|
3
3
|
createWorkersAiImage
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XCLZJGUI.js";
|
|
5
5
|
import "../chunk-XU7YEPML.js";
|
|
6
6
|
import "../chunk-2VII5BK2.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-727MRLUF.js";
|
|
8
8
|
import "../chunk-V6TY7KAL.js";
|
|
9
9
|
export {
|
|
10
10
|
WorkersAiImageAdapter,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkY2PUBTP5cjs = require('../chunk-Y2PUBTP5.cjs');
|
|
5
5
|
require('../chunk-7HSUHP63.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-53RO5I22.cjs');
|
|
7
7
|
require('../chunk-4DE2IREA.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.WorkersAiSummarizeAdapter =
|
|
11
|
+
exports.WorkersAiSummarizeAdapter = _chunkY2PUBTP5cjs.WorkersAiSummarizeAdapter; exports.createWorkersAiSummarize = _chunkY2PUBTP5cjs.createWorkersAiSummarize;
|
|
12
12
|
//# sourceMappingURL=workers-ai-summarize.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkersAiSummarizeAdapter,
|
|
3
3
|
createWorkersAiSummarize
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-PMPGIUVA.js";
|
|
5
5
|
import "../chunk-2VII5BK2.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-727MRLUF.js";
|
|
7
7
|
import "../chunk-V6TY7KAL.js";
|
|
8
8
|
export {
|
|
9
9
|
WorkersAiSummarizeAdapter,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk45DEJBFYcjs = require('../chunk-45DEJBFY.cjs');
|
|
5
5
|
require('../chunk-3VQDXJLW.cjs');
|
|
6
6
|
require('../chunk-7HSUHP63.cjs');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-53RO5I22.cjs');
|
|
8
8
|
require('../chunk-4DE2IREA.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.WorkersAiTranscriptionAdapter =
|
|
12
|
+
exports.WorkersAiTranscriptionAdapter = _chunk45DEJBFYcjs.WorkersAiTranscriptionAdapter; exports.createWorkersAiTranscription = _chunk45DEJBFYcjs.createWorkersAiTranscription;
|
|
13
13
|
//# sourceMappingURL=workers-ai-transcription.cjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkersAiTranscriptionAdapter,
|
|
3
3
|
createWorkersAiTranscription
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-627RVSSB.js";
|
|
5
5
|
import "../chunk-XU7YEPML.js";
|
|
6
6
|
import "../chunk-2VII5BK2.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-727MRLUF.js";
|
|
8
8
|
import "../chunk-V6TY7KAL.js";
|
|
9
9
|
export {
|
|
10
10
|
WorkersAiTranscriptionAdapter,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkCPOXZIMAcjs = require('../chunk-CPOXZIMA.cjs');
|
|
5
5
|
require('../chunk-3VQDXJLW.cjs');
|
|
6
6
|
require('../chunk-7HSUHP63.cjs');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-53RO5I22.cjs');
|
|
8
8
|
require('../chunk-4DE2IREA.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.WorkersAiTTSAdapter =
|
|
12
|
+
exports.WorkersAiTTSAdapter = _chunkCPOXZIMAcjs.WorkersAiTTSAdapter; exports.createWorkersAiTts = _chunkCPOXZIMAcjs.createWorkersAiTts;
|
|
13
13
|
//# sourceMappingURL=workers-ai-tts.cjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkersAiTTSAdapter,
|
|
3
3
|
createWorkersAiTts
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-GST6AT3R.js";
|
|
5
5
|
import "../chunk-XU7YEPML.js";
|
|
6
6
|
import "../chunk-2VII5BK2.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-727MRLUF.js";
|
|
8
8
|
import "../chunk-V6TY7KAL.js";
|
|
9
9
|
export {
|
|
10
10
|
WorkersAiTTSAdapter,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
4
|
+
var _chunkDTGQYEJ2cjs = require('../chunk-DTGQYEJ2.cjs');
|
|
5
|
+
require('../chunk-53RO5I22.cjs');
|
|
6
6
|
require('../chunk-4DE2IREA.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.WorkersAiTextAdapter =
|
|
10
|
+
exports.WorkersAiTextAdapter = _chunkDTGQYEJ2cjs.WorkersAiTextAdapter; exports.createWorkersAiChat = _chunkDTGQYEJ2cjs.createWorkersAiChat;
|
|
11
11
|
//# sourceMappingURL=workers-ai.cjs.map
|