@cloudflare/tanstack-ai 0.1.6 → 0.1.8
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 +35 -6
- package/dist/adapters/anthropic.cjs +32 -11
- package/dist/adapters/anthropic.cjs.map +1 -1
- package/dist/adapters/anthropic.d.cts +23 -5
- package/dist/adapters/anthropic.d.mts +23 -0
- package/dist/adapters/anthropic.mjs +30 -0
- package/dist/adapters/anthropic.mjs.map +1 -0
- package/dist/adapters/gemini.cjs +83 -20
- package/dist/adapters/gemini.cjs.map +1 -1
- package/dist/adapters/gemini.d.cts +52 -14
- package/dist/adapters/gemini.d.mts +52 -0
- package/dist/adapters/gemini.mjs +76 -0
- package/dist/adapters/gemini.mjs.map +1 -0
- package/dist/adapters/grok.cjs +44 -15
- package/dist/adapters/grok.cjs.map +1 -1
- package/dist/adapters/grok.d.cts +26 -9
- package/dist/adapters/grok.d.mts +26 -0
- package/dist/adapters/grok.mjs +40 -0
- package/dist/adapters/grok.mjs.map +1 -0
- package/dist/adapters/openai.cjs +76 -27
- package/dist/adapters/openai.cjs.map +1 -1
- package/dist/adapters/openai.d.cts +45 -17
- package/dist/adapters/openai.d.mts +45 -0
- package/dist/adapters/openai.mjs +66 -0
- package/dist/adapters/openai.mjs.map +1 -0
- package/dist/adapters/openrouter.cjs +83 -11
- package/dist/adapters/openrouter.cjs.map +1 -1
- package/dist/adapters/openrouter.d.cts +39 -7
- package/dist/adapters/openrouter.d.mts +39 -0
- package/dist/adapters/openrouter.mjs +81 -0
- package/dist/adapters/openrouter.mjs.map +1 -0
- package/dist/adapters/workers-ai-image.cjs +97 -11
- package/dist/adapters/workers-ai-image.cjs.map +1 -1
- package/dist/adapters/workers-ai-image.d.cts +41 -3
- package/dist/adapters/workers-ai-image.d.mts +41 -0
- package/dist/adapters/workers-ai-image.mjs +96 -0
- package/dist/adapters/workers-ai-image.mjs.map +1 -0
- package/dist/adapters/workers-ai-summarize.cjs +86 -10
- package/dist/adapters/workers-ai-summarize.cjs.map +1 -1
- package/dist/adapters/workers-ai-summarize.d.cts +42 -3
- package/dist/adapters/workers-ai-summarize.d.mts +42 -0
- package/dist/adapters/workers-ai-summarize.mjs +85 -0
- package/dist/adapters/workers-ai-summarize.mjs.map +1 -0
- package/dist/adapters/workers-ai-transcription.cjs +200 -11
- package/dist/adapters/workers-ai-transcription.cjs.map +1 -1
- package/dist/adapters/workers-ai-transcription.d.cts +74 -3
- package/dist/adapters/workers-ai-transcription.d.mts +74 -0
- package/dist/adapters/workers-ai-transcription.mjs +199 -0
- package/dist/adapters/workers-ai-transcription.mjs.map +1 -0
- package/dist/adapters/workers-ai-tts.cjs +112 -11
- package/dist/adapters/workers-ai-tts.cjs.map +1 -1
- package/dist/adapters/workers-ai-tts.d.cts +54 -3
- package/dist/adapters/workers-ai-tts.d.mts +54 -0
- package/dist/adapters/workers-ai-tts.mjs +111 -0
- package/dist/adapters/workers-ai-tts.mjs.map +1 -0
- package/dist/adapters/workers-ai.cjs +4 -11
- package/dist/adapters/workers-ai.d.cts +45 -3
- package/dist/adapters/workers-ai.d.mts +45 -0
- package/dist/adapters/workers-ai.mjs +481 -0
- package/dist/adapters/workers-ai.mjs.map +1 -0
- package/dist/binary-C9FAYwZj.cjs +70 -0
- package/dist/binary-C9FAYwZj.cjs.map +1 -0
- package/dist/binary-p4H_N_3M.mjs +59 -0
- package/dist/binary-p4H_N_3M.mjs.map +1 -0
- package/dist/create-fetcher-6p6heb85.d.mts +93 -0
- package/dist/create-fetcher-By-hTiT9.cjs +312 -0
- package/dist/create-fetcher-By-hTiT9.cjs.map +1 -0
- package/dist/create-fetcher-CeUOJgrh.mjs +283 -0
- package/dist/create-fetcher-CeUOJgrh.mjs.map +1 -0
- package/dist/create-fetcher-vAQ8WW-p.d.cts +93 -0
- package/dist/defineProperty-CbyrzcbA.mjs +39 -0
- package/dist/defineProperty-DQoAg20E.cjs +44 -0
- package/dist/index.cjs +50 -97
- package/dist/index.d.cts +12 -64
- package/dist/index.d.mts +12 -0
- package/dist/index.mjs +11 -0
- package/dist/workers-ai-BOZ5iyhY.cjs +521 -0
- package/dist/workers-ai-BOZ5iyhY.cjs.map +1 -0
- package/dist/workers-ai-rest-CkNCtBwv.cjs +85 -0
- package/dist/workers-ai-rest-CkNCtBwv.cjs.map +1 -0
- package/dist/workers-ai-rest-GKy2r7eG.mjs +74 -0
- package/dist/workers-ai-rest-GKy2r7eG.mjs.map +1 -0
- package/package.json +73 -40
- package/dist/_tsup-dts-rollup.d.cts +0 -837
- package/dist/_tsup-dts-rollup.d.ts +0 -837
- package/dist/adapters/anthropic.d.ts +0 -5
- package/dist/adapters/anthropic.js +0 -13
- package/dist/adapters/anthropic.js.map +0 -1
- package/dist/adapters/gemini.d.ts +0 -14
- package/dist/adapters/gemini.js +0 -22
- package/dist/adapters/gemini.js.map +0 -1
- package/dist/adapters/grok.d.ts +0 -9
- package/dist/adapters/grok.js +0 -17
- package/dist/adapters/grok.js.map +0 -1
- package/dist/adapters/openai.d.ts +0 -17
- package/dist/adapters/openai.js +0 -29
- package/dist/adapters/openai.js.map +0 -1
- package/dist/adapters/openrouter.d.ts +0 -7
- package/dist/adapters/openrouter.js +0 -13
- package/dist/adapters/openrouter.js.map +0 -1
- package/dist/adapters/workers-ai-image.d.ts +0 -3
- package/dist/adapters/workers-ai-image.js +0 -13
- package/dist/adapters/workers-ai-image.js.map +0 -1
- package/dist/adapters/workers-ai-summarize.d.ts +0 -3
- package/dist/adapters/workers-ai-summarize.js +0 -12
- package/dist/adapters/workers-ai-summarize.js.map +0 -1
- package/dist/adapters/workers-ai-transcription.d.ts +0 -3
- package/dist/adapters/workers-ai-transcription.js +0 -13
- package/dist/adapters/workers-ai-transcription.js.map +0 -1
- package/dist/adapters/workers-ai-tts.d.ts +0 -3
- package/dist/adapters/workers-ai-tts.js +0 -13
- package/dist/adapters/workers-ai-tts.js.map +0 -1
- package/dist/adapters/workers-ai.cjs.map +0 -1
- package/dist/adapters/workers-ai.d.ts +0 -3
- package/dist/adapters/workers-ai.js +0 -11
- package/dist/adapters/workers-ai.js.map +0 -1
- package/dist/chunk-2VII5BK2.js +0 -42
- package/dist/chunk-2VII5BK2.js.map +0 -1
- package/dist/chunk-3VQDXJLW.cjs +0 -46
- package/dist/chunk-3VQDXJLW.cjs.map +0 -1
- package/dist/chunk-3WK5ZD57.js +0 -57
- package/dist/chunk-3WK5ZD57.js.map +0 -1
- package/dist/chunk-4DE2IREA.cjs +0 -8
- package/dist/chunk-4DE2IREA.cjs.map +0 -1
- package/dist/chunk-53A2QIXV.js +0 -98
- package/dist/chunk-53A2QIXV.js.map +0 -1
- package/dist/chunk-6MEX2ZSM.cjs +0 -48
- package/dist/chunk-6MEX2ZSM.cjs.map +0 -1
- package/dist/chunk-7HSUHP63.cjs +0 -42
- package/dist/chunk-7HSUHP63.cjs.map +0 -1
- package/dist/chunk-AIAJANLC.js +0 -327
- package/dist/chunk-AIAJANLC.js.map +0 -1
- package/dist/chunk-CB3PSZY2.cjs +0 -218
- package/dist/chunk-CB3PSZY2.cjs.map +0 -1
- package/dist/chunk-FQE2UKUU.cjs +0 -57
- package/dist/chunk-FQE2UKUU.cjs.map +0 -1
- package/dist/chunk-GL3HHR4M.js +0 -523
- package/dist/chunk-GL3HHR4M.js.map +0 -1
- package/dist/chunk-J5DSSZTO.js +0 -71
- package/dist/chunk-J5DSSZTO.js.map +0 -1
- package/dist/chunk-JRFPCMSE.js +0 -57
- package/dist/chunk-JRFPCMSE.js.map +0 -1
- package/dist/chunk-KWYOUT2Y.js +0 -111
- package/dist/chunk-KWYOUT2Y.js.map +0 -1
- package/dist/chunk-MJ45L566.cjs +0 -57
- package/dist/chunk-MJ45L566.cjs.map +0 -1
- package/dist/chunk-N6U27RQW.cjs +0 -111
- package/dist/chunk-N6U27RQW.cjs.map +0 -1
- package/dist/chunk-NH3FF5JC.js +0 -86
- package/dist/chunk-NH3FF5JC.js.map +0 -1
- package/dist/chunk-OFUYHQZE.cjs +0 -31
- package/dist/chunk-OFUYHQZE.cjs.map +0 -1
- package/dist/chunk-OUEAAP25.cjs +0 -523
- package/dist/chunk-OUEAAP25.cjs.map +0 -1
- package/dist/chunk-Q33U5I5S.js +0 -31
- package/dist/chunk-Q33U5I5S.js.map +0 -1
- package/dist/chunk-V4LKHWJA.cjs +0 -71
- package/dist/chunk-V4LKHWJA.cjs.map +0 -1
- package/dist/chunk-V6TY7KAL.js +0 -8
- package/dist/chunk-V6TY7KAL.js.map +0 -1
- package/dist/chunk-WBTQKWFN.cjs +0 -327
- package/dist/chunk-WBTQKWFN.cjs.map +0 -1
- package/dist/chunk-XU7YEPML.js +0 -46
- package/dist/chunk-XU7YEPML.js.map +0 -1
- package/dist/chunk-YCGNMVQZ.js +0 -218
- package/dist/chunk-YCGNMVQZ.js.map +0 -1
- package/dist/chunk-Z5ZC5ZOQ.js +0 -48
- package/dist/chunk-Z5ZC5ZOQ.js.map +0 -1
- package/dist/chunk-ZFB72L57.cjs +0 -86
- package/dist/chunk-ZFB72L57.cjs.map +0 -1
- package/dist/chunk-ZGLSJM26.cjs +0 -98
- package/dist/chunk-ZGLSJM26.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -64
- package/dist/index.js +0 -97
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ The simplest way to use AI in a Cloudflare Worker. No API keys needed for Worker
|
|
|
46
46
|
import { createWorkersAiChat } from "@cloudflare/tanstack-ai";
|
|
47
47
|
import { chat, toHttpResponse } from "@tanstack/ai";
|
|
48
48
|
|
|
49
|
-
const adapter = createWorkersAiChat("@cf/
|
|
49
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.5", {
|
|
50
50
|
binding: env.AI,
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -62,18 +62,47 @@ return toHttpResponse(response);
|
|
|
62
62
|
**Using REST credentials:**
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
|
-
const adapter = createWorkersAiChat("@cf/
|
|
65
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.5", {
|
|
66
66
|
accountId: "your-account-id",
|
|
67
67
|
apiKey: "your-api-key",
|
|
68
68
|
});
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
### Reasoning Controls
|
|
72
|
+
|
|
73
|
+
Reasoning-capable Workers AI models (GLM-4.7-flash, Kimi K2.5/K2.6, GPT-OSS, QwQ) accept `reasoning_effort` and `chat_template_kwargs` on their inputs. Pass them per-call through `modelOptions`:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { chat } from "@tanstack/ai";
|
|
77
|
+
import { createWorkersAiChat } from "@cloudflare/tanstack-ai";
|
|
78
|
+
|
|
79
|
+
const adapter = createWorkersAiChat("@cf/zai-org/glm-4.7-flash", {
|
|
80
|
+
binding: env.AI,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const response = chat({
|
|
84
|
+
adapter,
|
|
85
|
+
stream: true,
|
|
86
|
+
messages: [{ role: "user", content: "Summarize in one sentence." }],
|
|
87
|
+
modelOptions: {
|
|
88
|
+
// "low" | "medium" | "high" | null — null disables reasoning.
|
|
89
|
+
reasoning_effort: "low",
|
|
90
|
+
// Toggle thinking on models that expose template kwargs (GLM, Kimi).
|
|
91
|
+
chat_template_kwargs: { enable_thinking: false },
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This works in all four config modes (binding, REST, gateway binding, gateway REST). `modelOptions` keys with `undefined` values are stripped; `null` values are preserved.
|
|
97
|
+
|
|
98
|
+
See the [Workers AI docs](https://developers.cloudflare.com/workers-ai/) for per-model reasoning capabilities.
|
|
99
|
+
|
|
71
100
|
### Vision (Image Inputs)
|
|
72
101
|
|
|
73
102
|
Send images to vision-capable chat models:
|
|
74
103
|
|
|
75
104
|
```typescript
|
|
76
|
-
const adapter = createWorkersAiChat("@cf/
|
|
105
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.5", {
|
|
77
106
|
accountId: "your-account-id",
|
|
78
107
|
apiKey: "your-api-key",
|
|
79
108
|
});
|
|
@@ -110,7 +139,7 @@ Works with all configuration modes (binding, REST, and AI Gateway).
|
|
|
110
139
|
import { createWorkersAiImage } from "@cloudflare/tanstack-ai";
|
|
111
140
|
import { generateImage } from "@tanstack/ai";
|
|
112
141
|
|
|
113
|
-
const adapter = createWorkersAiImage("@cf/
|
|
142
|
+
const adapter = createWorkersAiImage("@cf/black-forest-labs/flux-1-schnell", {
|
|
114
143
|
binding: env.AI,
|
|
115
144
|
});
|
|
116
145
|
|
|
@@ -205,7 +234,7 @@ const adapter = createOpenAiChat("gpt-4o", {
|
|
|
205
234
|
### Workers AI through Gateway
|
|
206
235
|
|
|
207
236
|
```typescript
|
|
208
|
-
const adapter = createWorkersAiChat("@cf/
|
|
237
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.5", {
|
|
209
238
|
binding: env.AI.gateway("my-gateway-id"),
|
|
210
239
|
apiKey: env.WORKERS_AI_TOKEN,
|
|
211
240
|
});
|
|
@@ -314,7 +343,7 @@ Third-party providers (OpenAI, Anthropic, Gemini, Grok, OpenRouter) only support
|
|
|
314
343
|
All Workers AI config modes also accept `sessionAffinity` to route requests with the same key to the same backend replica for prefix-cache optimization:
|
|
315
344
|
|
|
316
345
|
```typescript
|
|
317
|
-
const adapter = createWorkersAiChat("@cf/
|
|
346
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.5", {
|
|
318
347
|
binding: env.AI,
|
|
319
348
|
sessionAffinity: "my-unique-session-id",
|
|
320
349
|
});
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../workers-ai-BOZ5iyhY.cjs");
|
|
3
|
+
const require_create_fetcher = require("../create-fetcher-By-hTiT9.cjs");
|
|
4
|
+
let _tanstack_ai_anthropic = require("@tanstack/ai-anthropic");
|
|
5
|
+
//#region src/adapters/anthropic.ts
|
|
6
|
+
function buildAnthropicConfig(config) {
|
|
7
|
+
return {
|
|
8
|
+
apiKey: config.apiKey ?? "unused",
|
|
9
|
+
fetch: require_create_fetcher.createGatewayFetch("anthropic", config, { "anthropic-version": config.anthropicVersion ?? "2023-06-01" })
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates an Anthropic chat adapter which uses Cloudflare AI Gateway.
|
|
14
|
+
* Supports both binding and credential-based configurations.
|
|
15
|
+
*
|
|
16
|
+
* Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,
|
|
17
|
+
* we can inject the gateway fetch directly — no subclassing needed.
|
|
18
|
+
*/
|
|
19
|
+
function createAnthropicChat(model, config) {
|
|
20
|
+
return new _tanstack_ai_anthropic.AnthropicTextAdapter(buildAnthropicConfig(config), model);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.
|
|
24
|
+
* Supports both binding and credential-based configurations.
|
|
25
|
+
*/
|
|
26
|
+
function createAnthropicSummarize(model, config) {
|
|
27
|
+
return new _tanstack_ai_anthropic.AnthropicSummarizeAdapter(buildAnthropicConfig(config), model);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.ANTHROPIC_MODELS = _tanstack_ai_anthropic.ANTHROPIC_MODELS;
|
|
31
|
+
exports.createAnthropicChat = createAnthropicChat;
|
|
32
|
+
exports.createAnthropicSummarize = createAnthropicSummarize;
|
|
2
33
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkOFUYHQZEcjs = require('../chunk-OFUYHQZE.cjs');
|
|
6
|
-
require('../chunk-WBTQKWFN.cjs');
|
|
7
|
-
require('../chunk-4DE2IREA.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.ANTHROPIC_MODELS = _chunkOFUYHQZEcjs.ANTHROPIC_MODELS; exports.createAnthropicChat = _chunkOFUYHQZEcjs.createAnthropicChat; exports.createAnthropicSummarize = _chunkOFUYHQZEcjs.createAnthropicSummarize;
|
|
13
34
|
//# sourceMappingURL=anthropic.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"file":"anthropic.cjs","names":["createGatewayFetch","AnthropicTextAdapter","AnthropicSummarizeAdapter"],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":["import {\n\tAnthropicTextAdapter,\n\tAnthropicSummarizeAdapter,\n\tANTHROPIC_MODELS,\n\ttype AnthropicChatModel,\n} from \"@tanstack/ai-anthropic\";\nimport { createGatewayFetch, type AiGatewayAdapterConfig } from \"../utils/create-fetcher\";\n\nexport type AnthropicGatewayConfig = AiGatewayAdapterConfig & { anthropicVersion?: string };\n\nfunction buildAnthropicConfig(config: AnthropicGatewayConfig) {\n\treturn {\n\t\tapiKey: config.apiKey ?? \"unused\",\n\t\tfetch: createGatewayFetch(\"anthropic\", config, {\n\t\t\t\"anthropic-version\": config.anthropicVersion ?? \"2023-06-01\",\n\t\t}),\n\t};\n}\n\n/**\n * Creates an Anthropic chat adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n *\n * Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,\n * we can inject the gateway fetch directly — no subclassing needed.\n */\nexport function createAnthropicChat(\n\tmodel: AnthropicChatModel,\n\tconfig: AnthropicGatewayConfig,\n): AnthropicTextAdapter<AnthropicChatModel> {\n\treturn new AnthropicTextAdapter(buildAnthropicConfig(config), model);\n}\n\n/**\n * Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n */\nexport function createAnthropicSummarize(\n\tmodel: AnthropicChatModel,\n\tconfig: AnthropicGatewayConfig,\n) {\n\treturn new AnthropicSummarizeAdapter(buildAnthropicConfig(config), model);\n}\n\nexport { ANTHROPIC_MODELS, type AnthropicChatModel };\n"],"mappings":";;;;;AAUA,SAAS,qBAAqB,QAAgC;AAC7D,QAAO;EACN,QAAQ,OAAO,UAAU;EACzB,OAAOA,uBAAAA,mBAAmB,aAAa,QAAQ,EAC9C,qBAAqB,OAAO,oBAAoB,cAChD,CAAC;EACF;;;;;;;;;AAUF,SAAgB,oBACf,OACA,QAC2C;AAC3C,QAAO,IAAIC,uBAAAA,qBAAqB,qBAAqB,OAAO,EAAE,MAAM;;;;;;AAOrE,SAAgB,yBACf,OACA,QACC;AACD,QAAO,IAAIC,uBAAAA,0BAA0B,qBAAqB,OAAO,EAAE,MAAM"}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-vAQ8WW-p.cjs";
|
|
2
|
+
import { ANTHROPIC_MODELS, AnthropicChatModel, AnthropicSummarizeAdapter, AnthropicTextAdapter } from "@tanstack/ai-anthropic";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/anthropic.d.ts
|
|
5
|
+
type AnthropicGatewayConfig = AiGatewayAdapterConfig & {
|
|
6
|
+
anthropicVersion?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Creates an Anthropic chat adapter which uses Cloudflare AI Gateway.
|
|
10
|
+
* Supports both binding and credential-based configurations.
|
|
11
|
+
*
|
|
12
|
+
* Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,
|
|
13
|
+
* we can inject the gateway fetch directly — no subclassing needed.
|
|
14
|
+
*/
|
|
15
|
+
declare function createAnthropicChat(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnthropicTextAdapter<AnthropicChatModel>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.
|
|
18
|
+
* Supports both binding and credential-based configurations.
|
|
19
|
+
*/
|
|
20
|
+
declare function createAnthropicSummarize(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnthropicSummarizeAdapter<"claude-opus-4-6" | "claude-opus-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4-5" | "claude-haiku-4-5" | "claude-opus-4-1" | "claude-sonnet-4" | "claude-3-7-sonnet" | "claude-opus-4" | "claude-3-5-haiku" | "claude-3-haiku">;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ANTHROPIC_MODELS, type AnthropicChatModel, AnthropicGatewayConfig, createAnthropicChat, createAnthropicSummarize };
|
|
23
|
+
//# sourceMappingURL=anthropic.d.cts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-6p6heb85.mjs";
|
|
2
|
+
import { ANTHROPIC_MODELS, AnthropicChatModel, AnthropicSummarizeAdapter, AnthropicTextAdapter } from "@tanstack/ai-anthropic";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/anthropic.d.ts
|
|
5
|
+
type AnthropicGatewayConfig = AiGatewayAdapterConfig & {
|
|
6
|
+
anthropicVersion?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Creates an Anthropic chat adapter which uses Cloudflare AI Gateway.
|
|
10
|
+
* Supports both binding and credential-based configurations.
|
|
11
|
+
*
|
|
12
|
+
* Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,
|
|
13
|
+
* we can inject the gateway fetch directly — no subclassing needed.
|
|
14
|
+
*/
|
|
15
|
+
declare function createAnthropicChat(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnthropicTextAdapter<AnthropicChatModel>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.
|
|
18
|
+
* Supports both binding and credential-based configurations.
|
|
19
|
+
*/
|
|
20
|
+
declare function createAnthropicSummarize(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnthropicSummarizeAdapter<"claude-opus-4-6" | "claude-opus-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4-5" | "claude-haiku-4-5" | "claude-opus-4-1" | "claude-sonnet-4" | "claude-3-7-sonnet" | "claude-opus-4" | "claude-3-5-haiku" | "claude-3-haiku">;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ANTHROPIC_MODELS, type AnthropicChatModel, AnthropicGatewayConfig, createAnthropicChat, createAnthropicSummarize };
|
|
23
|
+
//# sourceMappingURL=anthropic.d.mts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as createGatewayFetch } from "../create-fetcher-CeUOJgrh.mjs";
|
|
2
|
+
import { ANTHROPIC_MODELS, AnthropicSummarizeAdapter, AnthropicTextAdapter } from "@tanstack/ai-anthropic";
|
|
3
|
+
//#region src/adapters/anthropic.ts
|
|
4
|
+
function buildAnthropicConfig(config) {
|
|
5
|
+
return {
|
|
6
|
+
apiKey: config.apiKey ?? "unused",
|
|
7
|
+
fetch: createGatewayFetch("anthropic", config, { "anthropic-version": config.anthropicVersion ?? "2023-06-01" })
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates an Anthropic chat adapter which uses Cloudflare AI Gateway.
|
|
12
|
+
* Supports both binding and credential-based configurations.
|
|
13
|
+
*
|
|
14
|
+
* Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,
|
|
15
|
+
* we can inject the gateway fetch directly — no subclassing needed.
|
|
16
|
+
*/
|
|
17
|
+
function createAnthropicChat(model, config) {
|
|
18
|
+
return new AnthropicTextAdapter(buildAnthropicConfig(config), model);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.
|
|
22
|
+
* Supports both binding and credential-based configurations.
|
|
23
|
+
*/
|
|
24
|
+
function createAnthropicSummarize(model, config) {
|
|
25
|
+
return new AnthropicSummarizeAdapter(buildAnthropicConfig(config), model);
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ANTHROPIC_MODELS, createAnthropicChat, createAnthropicSummarize };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=anthropic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.mjs","names":[],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":["import {\n\tAnthropicTextAdapter,\n\tAnthropicSummarizeAdapter,\n\tANTHROPIC_MODELS,\n\ttype AnthropicChatModel,\n} from \"@tanstack/ai-anthropic\";\nimport { createGatewayFetch, type AiGatewayAdapterConfig } from \"../utils/create-fetcher\";\n\nexport type AnthropicGatewayConfig = AiGatewayAdapterConfig & { anthropicVersion?: string };\n\nfunction buildAnthropicConfig(config: AnthropicGatewayConfig) {\n\treturn {\n\t\tapiKey: config.apiKey ?? \"unused\",\n\t\tfetch: createGatewayFetch(\"anthropic\", config, {\n\t\t\t\"anthropic-version\": config.anthropicVersion ?? \"2023-06-01\",\n\t\t}),\n\t};\n}\n\n/**\n * Creates an Anthropic chat adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n *\n * Since AnthropicTextConfig extends the Anthropic SDK's ClientOptions,\n * we can inject the gateway fetch directly — no subclassing needed.\n */\nexport function createAnthropicChat(\n\tmodel: AnthropicChatModel,\n\tconfig: AnthropicGatewayConfig,\n): AnthropicTextAdapter<AnthropicChatModel> {\n\treturn new AnthropicTextAdapter(buildAnthropicConfig(config), model);\n}\n\n/**\n * Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n */\nexport function createAnthropicSummarize(\n\tmodel: AnthropicChatModel,\n\tconfig: AnthropicGatewayConfig,\n) {\n\treturn new AnthropicSummarizeAdapter(buildAnthropicConfig(config), model);\n}\n\nexport { ANTHROPIC_MODELS, type AnthropicChatModel };\n"],"mappings":";;;AAUA,SAAS,qBAAqB,QAAgC;AAC7D,QAAO;EACN,QAAQ,OAAO,UAAU;EACzB,OAAO,mBAAmB,aAAa,QAAQ,EAC9C,qBAAqB,OAAO,oBAAoB,cAChD,CAAC;EACF;;;;;;;;;AAUF,SAAgB,oBACf,OACA,QAC2C;AAC3C,QAAO,IAAI,qBAAqB,qBAAqB,OAAO,EAAE,MAAM;;;;;;AAOrE,SAAgB,yBACf,OACA,QACC;AACD,QAAO,IAAI,0BAA0B,qBAAqB,OAAO,EAAE,MAAM"}
|
package/dist/adapters/gemini.cjs
CHANGED
|
@@ -1,22 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../workers-ai-BOZ5iyhY.cjs");
|
|
3
|
+
let _tanstack_ai_gemini = require("@tanstack/ai-gemini");
|
|
4
|
+
//#region src/adapters/gemini.ts
|
|
5
|
+
/**
|
|
6
|
+
* Build Gemini client config that routes through AI Gateway.
|
|
7
|
+
* Since GeminiClientConfig extends GoogleGenAIOptions, we can inject
|
|
8
|
+
* httpOptions.baseUrl directly — no subclassing needed.
|
|
9
|
+
*
|
|
10
|
+
* The Google GenAI SDK doesn't support a custom `fetch` override,
|
|
11
|
+
* so we set the baseUrl to the AI Gateway endpoint for Google AI Studio.
|
|
12
|
+
*
|
|
13
|
+
* Tracking issue: https://github.com/googleapis/js-genai/issues/999
|
|
14
|
+
*/
|
|
15
|
+
function buildGeminiGatewayConfig(config) {
|
|
16
|
+
if ("binding" in config) throw new Error("Gemini adapters do not support binding config. The Google GenAI SDK does not support a custom fetch function — only credential-based config ({ accountId, gatewayId }) is supported. See https://github.com/googleapis/js-genai/issues/999");
|
|
17
|
+
const headers = {};
|
|
18
|
+
if (config.apiKey && config.cfApiKey) headers["cf-aig-authorization"] = `Bearer ${config.cfApiKey}`;
|
|
19
|
+
if (config.skipCache) headers["cf-aig-skip-cache"] = "true";
|
|
20
|
+
if (typeof config.cacheTtl === "number") headers["cf-aig-cache-ttl"] = String(config.cacheTtl);
|
|
21
|
+
if (typeof config.customCacheKey === "string") headers["cf-aig-cache-key"] = config.customCacheKey;
|
|
22
|
+
if (typeof config.metadata === "object") headers["cf-aig-metadata"] = JSON.stringify(config.metadata);
|
|
23
|
+
const apiKey = config.apiKey ?? config.cfApiKey;
|
|
24
|
+
if (!apiKey) throw new Error("If you want to use BYOK or unified billing, you need to pass the Cloudflare AI Gateway API key.");
|
|
25
|
+
return {
|
|
26
|
+
apiKey,
|
|
27
|
+
httpOptions: {
|
|
28
|
+
baseUrl: `https://gateway.ai.cloudflare.com/v1/${config.accountId}/${config.gatewayId}/google-ai-studio`,
|
|
29
|
+
headers: Object.keys(headers).length > 0 ? headers : void 0
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a Gemini adapter which uses Cloudflare AI Gateway.
|
|
35
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
36
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
37
|
+
* @param model The Gemini model to use
|
|
38
|
+
* @param config Configuration options (credentials only)
|
|
39
|
+
*/
|
|
40
|
+
function createGeminiChat(model, config) {
|
|
41
|
+
return new _tanstack_ai_gemini.GeminiTextAdapter(buildGeminiGatewayConfig(config), model);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a Gemini Image adapter which uses Cloudflare AI Gateway.
|
|
45
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
46
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
47
|
+
* @param model The Gemini model to use
|
|
48
|
+
* @param config Configuration options (credentials only)
|
|
49
|
+
*/
|
|
50
|
+
function createGeminiImage(model, config) {
|
|
51
|
+
return new _tanstack_ai_gemini.GeminiImageAdapter(buildGeminiGatewayConfig(config), model);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a Gemini Summarize adapter which uses Cloudflare AI Gateway.
|
|
55
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
56
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
57
|
+
* @param model The Gemini model to use
|
|
58
|
+
* @param config Configuration options (credentials only)
|
|
59
|
+
*/
|
|
60
|
+
function createGeminiSummarize(model, config) {
|
|
61
|
+
return new _tanstack_ai_gemini.GeminiSummarizeAdapter(buildGeminiGatewayConfig(config), model);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
65
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
66
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
67
|
+
*
|
|
68
|
+
* @experimental Gemini TTS is an experimental feature and may change.
|
|
69
|
+
* @param model The Gemini TTS model to use
|
|
70
|
+
* @param config Configuration options (credentials only)
|
|
71
|
+
*/
|
|
72
|
+
function createGeminiTts(model, config) {
|
|
73
|
+
return new _tanstack_ai_gemini.GeminiTTSAdapter(buildGeminiGatewayConfig(config), model);
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.GeminiImageModels = _tanstack_ai_gemini.GeminiImageModels;
|
|
77
|
+
exports.GeminiSummarizeModels = _tanstack_ai_gemini.GeminiSummarizeModels;
|
|
78
|
+
exports.GeminiTTSModels = _tanstack_ai_gemini.GeminiTTSModels;
|
|
79
|
+
exports.GeminiTextModels = _tanstack_ai_gemini.GeminiTextModels;
|
|
80
|
+
exports.createGeminiChat = createGeminiChat;
|
|
81
|
+
exports.createGeminiImage = createGeminiImage;
|
|
82
|
+
exports.createGeminiSummarize = createGeminiSummarize;
|
|
83
|
+
exports.createGeminiTts = createGeminiTts;
|
|
2
84
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunkV4LKHWJAcjs = require('../chunk-V4LKHWJA.cjs');
|
|
11
|
-
require('../chunk-4DE2IREA.cjs');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
85
|
//# sourceMappingURL=gemini.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"file":"gemini.cjs","names":["GeminiTextAdapter","GeminiImageAdapter","GeminiSummarizeAdapter","GeminiTTSAdapter"],"sources":["../../src/adapters/gemini.ts"],"sourcesContent":["import {\n\tGeminiTextAdapter,\n\tGeminiImageAdapter,\n\tGeminiSummarizeAdapter,\n\tGeminiTTSAdapter,\n\tGeminiTextModels,\n\tGeminiImageModels,\n\tGeminiSummarizeModels,\n\tGeminiTTSModels,\n\ttype GeminiTextModel,\n\ttype GeminiImageModel,\n\ttype GeminiSummarizeModel,\n} from \"@tanstack/ai-gemini\";\n\n/** Derived from GeminiTTSModels since @tanstack/ai-gemini doesn't export a GeminiTTSModel type. */\nexport type GeminiTTSModel = (typeof GeminiTTSModels)[number];\nimport type { AnyTextAdapter } from \"@tanstack/ai\";\nimport type { AiGatewayCredentialsConfig, AiGatewayConfig } from \"../utils/create-fetcher\";\n\n/**\n * Gemini-specific gateway config (credentials only, no binding support).\n * Includes cache control options from AiGatewayConfig.\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n */\nexport type GeminiGatewayConfig = AiGatewayCredentialsConfig & AiGatewayConfig;\n\n/**\n * Build Gemini client config that routes through AI Gateway.\n * Since GeminiClientConfig extends GoogleGenAIOptions, we can inject\n * httpOptions.baseUrl directly — no subclassing needed.\n *\n * The Google GenAI SDK doesn't support a custom `fetch` override,\n * so we set the baseUrl to the AI Gateway endpoint for Google AI Studio.\n *\n * Tracking issue: https://github.com/googleapis/js-genai/issues/999\n */\nfunction buildGeminiGatewayConfig(config: GeminiGatewayConfig) {\n\t// Runtime guard: catch binding configs that bypass TypeScript (JS callers, `as any`, etc.)\n\t// We integrate with the Gemini SDK via `httpOptions` (baseUrl + headers), which allows\n\t// gateway routing and cache control but not request interception. A binding config\n\t// requires a custom `fetch` to route through the AI Gateway binding, and the Google\n\t// GenAI SDK doesn't support that yet.\n\tif (\"binding\" in config) {\n\t\tthrow new Error(\n\t\t\t\"Gemini adapters do not support binding config. \" +\n\t\t\t\t\"The Google GenAI SDK does not support a custom fetch function — \" +\n\t\t\t\t\"only credential-based config ({ accountId, gatewayId }) is supported. \" +\n\t\t\t\t\"See https://github.com/googleapis/js-genai/issues/999\",\n\t\t);\n\t}\n\n\tconst headers: Record<string, string> = {};\n\n\tif (config.apiKey && config.cfApiKey) {\n\t\theaders[\"cf-aig-authorization\"] = `Bearer ${config.cfApiKey}`;\n\t}\n\n\tif (config.skipCache) {\n\t\theaders[\"cf-aig-skip-cache\"] = \"true\";\n\t}\n\tif (typeof config.cacheTtl === \"number\") {\n\t\theaders[\"cf-aig-cache-ttl\"] = String(config.cacheTtl);\n\t}\n\tif (typeof config.customCacheKey === \"string\") {\n\t\theaders[\"cf-aig-cache-key\"] = config.customCacheKey;\n\t}\n\tif (typeof config.metadata === \"object\") {\n\t\theaders[\"cf-aig-metadata\"] = JSON.stringify(config.metadata);\n\t}\n\n\tconst apiKey = config.apiKey ?? config.cfApiKey;\n\n\tif (!apiKey) {\n\t\tthrow new Error(\n\t\t\t\"If you want to use BYOK or unified billing, you need to pass the Cloudflare AI Gateway API key.\",\n\t\t);\n\t}\n\n\treturn {\n\t\tapiKey,\n\t\thttpOptions: {\n\t\t\tbaseUrl: `https://gateway.ai.cloudflare.com/v1/${config.accountId}/${config.gatewayId}/google-ai-studio`,\n\t\t\theaders: Object.keys(headers).length > 0 ? headers : undefined,\n\t\t},\n\t};\n}\n\n/** Alias for consistency with other providers (AnthropicChatModel, GrokChatModel, etc.) */\nexport type GeminiChatModel = GeminiTextModel;\n\n/**\n * Creates a Gemini adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n * @param model The Gemini model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiChat(\n\tmodel: GeminiChatModel,\n\tconfig: GeminiGatewayConfig,\n): AnyTextAdapter {\n\treturn new GeminiTextAdapter(buildGeminiGatewayConfig(config), model);\n}\n\n/**\n * Creates a Gemini Image adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n * @param model The Gemini model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiImage(model: GeminiImageModel, config: GeminiGatewayConfig) {\n\treturn new GeminiImageAdapter(buildGeminiGatewayConfig(config), model);\n}\n\n/**\n * Creates a Gemini Summarize adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n * @param model The Gemini model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig) {\n\treturn new GeminiSummarizeAdapter(buildGeminiGatewayConfig(config), model);\n}\n\n/**\n * Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n *\n * @experimental Gemini TTS is an experimental feature and may change.\n * @param model The Gemini TTS model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig) {\n\treturn new GeminiTTSAdapter(buildGeminiGatewayConfig(config), model);\n}\n\nexport {\n\tGeminiTextModels,\n\tGeminiImageModels,\n\tGeminiSummarizeModels,\n\tGeminiTTSModels,\n\ttype GeminiTextModel,\n\ttype GeminiImageModel,\n\ttype GeminiSummarizeModel,\n};\n"],"mappings":";;;;;;;;;;;;;;AAoCA,SAAS,yBAAyB,QAA6B;AAM9D,KAAI,aAAa,OAChB,OAAM,IAAI,MACT,6OAIA;CAGF,MAAM,UAAkC,EAAE;AAE1C,KAAI,OAAO,UAAU,OAAO,SAC3B,SAAQ,0BAA0B,UAAU,OAAO;AAGpD,KAAI,OAAO,UACV,SAAQ,uBAAuB;AAEhC,KAAI,OAAO,OAAO,aAAa,SAC9B,SAAQ,sBAAsB,OAAO,OAAO,SAAS;AAEtD,KAAI,OAAO,OAAO,mBAAmB,SACpC,SAAQ,sBAAsB,OAAO;AAEtC,KAAI,OAAO,OAAO,aAAa,SAC9B,SAAQ,qBAAqB,KAAK,UAAU,OAAO,SAAS;CAG7D,MAAM,SAAS,OAAO,UAAU,OAAO;AAEvC,KAAI,CAAC,OACJ,OAAM,IAAI,MACT,kGACA;AAGF,QAAO;EACN;EACA,aAAa;GACZ,SAAS,wCAAwC,OAAO,UAAU,GAAG,OAAO,UAAU;GACtF,SAAS,OAAO,KAAK,QAAQ,CAAC,SAAS,IAAI,UAAU,KAAA;GACrD;EACD;;;;;;;;;AAaF,SAAgB,iBACf,OACA,QACiB;AACjB,QAAO,IAAIA,oBAAAA,kBAAkB,yBAAyB,OAAO,EAAE,MAAM;;;;;;;;;AAUtE,SAAgB,kBAAkB,OAAyB,QAA6B;AACvF,QAAO,IAAIC,oBAAAA,mBAAmB,yBAAyB,OAAO,EAAE,MAAM;;;;;;;;;AAUvE,SAAgB,sBAAsB,OAA6B,QAA6B;AAC/F,QAAO,IAAIC,oBAAAA,uBAAuB,yBAAyB,OAAO,EAAE,MAAM;;;;;;;;;;;AAY3E,SAAgB,gBAAgB,OAAuB,QAA6B;AACnF,QAAO,IAAIC,oBAAAA,iBAAiB,yBAAyB,OAAO,EAAE,MAAM"}
|
|
@@ -1,14 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { n as AiGatewayConfig, r as AiGatewayCredentialsConfig } from "../create-fetcher-vAQ8WW-p.cjs";
|
|
2
|
+
import { GeminiImageAdapter, GeminiImageModel, GeminiImageModels, GeminiSummarizeAdapter, GeminiSummarizeModel, GeminiSummarizeModels, GeminiTTSAdapter, GeminiTTSModels, GeminiTextModel, GeminiTextModels } from "@tanstack/ai-gemini";
|
|
3
|
+
import { AnyTextAdapter } from "@tanstack/ai";
|
|
4
|
+
|
|
5
|
+
//#region src/adapters/gemini.d.ts
|
|
6
|
+
/** Derived from GeminiTTSModels since @tanstack/ai-gemini doesn't export a GeminiTTSModel type. */
|
|
7
|
+
type GeminiTTSModel = (typeof GeminiTTSModels)[number];
|
|
8
|
+
/**
|
|
9
|
+
* Gemini-specific gateway config (credentials only, no binding support).
|
|
10
|
+
* Includes cache control options from AiGatewayConfig.
|
|
11
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
12
|
+
*/
|
|
13
|
+
type GeminiGatewayConfig = AiGatewayCredentialsConfig & AiGatewayConfig;
|
|
14
|
+
/** Alias for consistency with other providers (AnthropicChatModel, GrokChatModel, etc.) */
|
|
15
|
+
type GeminiChatModel = GeminiTextModel;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Gemini adapter which uses Cloudflare AI Gateway.
|
|
18
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
19
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
20
|
+
* @param model The Gemini model to use
|
|
21
|
+
* @param config Configuration options (credentials only)
|
|
22
|
+
*/
|
|
23
|
+
declare function createGeminiChat(model: GeminiChatModel, config: GeminiGatewayConfig): AnyTextAdapter;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a Gemini Image adapter which uses Cloudflare AI Gateway.
|
|
26
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
27
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
28
|
+
* @param model The Gemini model to use
|
|
29
|
+
* @param config Configuration options (credentials only)
|
|
30
|
+
*/
|
|
31
|
+
declare function createGeminiImage(model: GeminiImageModel, config: GeminiGatewayConfig): GeminiImageAdapter<"gemini-3.1-flash-image-preview" | "gemini-3-pro-image-preview" | "gemini-2.5-flash-image" | "gemini-2.0-flash-preview-image-generation" | "imagen-3.0-generate-002" | "imagen-4.0-generate-001" | "imagen-4.0-fast-generate-001" | "imagen-4.0-ultra-generate-001">;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a Gemini Summarize adapter which uses Cloudflare AI Gateway.
|
|
34
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
35
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
36
|
+
* @param model The Gemini model to use
|
|
37
|
+
* @param config Configuration options (credentials only)
|
|
38
|
+
*/
|
|
39
|
+
declare function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig): GeminiSummarizeAdapter<"gemini-3.1-flash-lite-preview" | "gemini-2.0-flash" | "gemini-1.5-flash" | "gemini-1.5-pro" | "gemini-2.0-flash-lite">;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
42
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
43
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
44
|
+
*
|
|
45
|
+
* @experimental Gemini TTS is an experimental feature and may change.
|
|
46
|
+
* @param model The Gemini TTS model to use
|
|
47
|
+
* @param config Configuration options (credentials only)
|
|
48
|
+
*/
|
|
49
|
+
declare function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig): GeminiTTSAdapter<"gemini-2.5-flash-preview-tts" | "gemini-2.5-pro-preview-tts">;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { GeminiChatModel, GeminiGatewayConfig, type GeminiImageModel, GeminiImageModels, type GeminiSummarizeModel, GeminiSummarizeModels, GeminiTTSModel, GeminiTTSModels, type GeminiTextModel, GeminiTextModels, createGeminiChat, createGeminiImage, createGeminiSummarize, createGeminiTts };
|
|
52
|
+
//# sourceMappingURL=gemini.d.cts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { n as AiGatewayConfig, r as AiGatewayCredentialsConfig } from "../create-fetcher-6p6heb85.mjs";
|
|
2
|
+
import { GeminiImageAdapter, GeminiImageModel, GeminiImageModels, GeminiSummarizeAdapter, GeminiSummarizeModel, GeminiSummarizeModels, GeminiTTSAdapter, GeminiTTSModels, GeminiTextModel, GeminiTextModels } from "@tanstack/ai-gemini";
|
|
3
|
+
import { AnyTextAdapter } from "@tanstack/ai";
|
|
4
|
+
|
|
5
|
+
//#region src/adapters/gemini.d.ts
|
|
6
|
+
/** Derived from GeminiTTSModels since @tanstack/ai-gemini doesn't export a GeminiTTSModel type. */
|
|
7
|
+
type GeminiTTSModel = (typeof GeminiTTSModels)[number];
|
|
8
|
+
/**
|
|
9
|
+
* Gemini-specific gateway config (credentials only, no binding support).
|
|
10
|
+
* Includes cache control options from AiGatewayConfig.
|
|
11
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
12
|
+
*/
|
|
13
|
+
type GeminiGatewayConfig = AiGatewayCredentialsConfig & AiGatewayConfig;
|
|
14
|
+
/** Alias for consistency with other providers (AnthropicChatModel, GrokChatModel, etc.) */
|
|
15
|
+
type GeminiChatModel = GeminiTextModel;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Gemini adapter which uses Cloudflare AI Gateway.
|
|
18
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
19
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
20
|
+
* @param model The Gemini model to use
|
|
21
|
+
* @param config Configuration options (credentials only)
|
|
22
|
+
*/
|
|
23
|
+
declare function createGeminiChat(model: GeminiChatModel, config: GeminiGatewayConfig): AnyTextAdapter;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a Gemini Image adapter which uses Cloudflare AI Gateway.
|
|
26
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
27
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
28
|
+
* @param model The Gemini model to use
|
|
29
|
+
* @param config Configuration options (credentials only)
|
|
30
|
+
*/
|
|
31
|
+
declare function createGeminiImage(model: GeminiImageModel, config: GeminiGatewayConfig): GeminiImageAdapter<"gemini-3.1-flash-image-preview" | "gemini-3-pro-image-preview" | "gemini-2.5-flash-image" | "gemini-2.0-flash-preview-image-generation" | "imagen-3.0-generate-002" | "imagen-4.0-generate-001" | "imagen-4.0-fast-generate-001" | "imagen-4.0-ultra-generate-001">;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a Gemini Summarize adapter which uses Cloudflare AI Gateway.
|
|
34
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
35
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
36
|
+
* @param model The Gemini model to use
|
|
37
|
+
* @param config Configuration options (credentials only)
|
|
38
|
+
*/
|
|
39
|
+
declare function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig): GeminiSummarizeAdapter<"gemini-3.1-flash-lite-preview" | "gemini-2.0-flash" | "gemini-1.5-flash" | "gemini-1.5-pro" | "gemini-2.0-flash-lite">;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
42
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
43
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
44
|
+
*
|
|
45
|
+
* @experimental Gemini TTS is an experimental feature and may change.
|
|
46
|
+
* @param model The Gemini TTS model to use
|
|
47
|
+
* @param config Configuration options (credentials only)
|
|
48
|
+
*/
|
|
49
|
+
declare function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig): GeminiTTSAdapter<"gemini-2.5-flash-preview-tts" | "gemini-2.5-pro-preview-tts">;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { GeminiChatModel, GeminiGatewayConfig, type GeminiImageModel, GeminiImageModels, type GeminiSummarizeModel, GeminiSummarizeModels, GeminiTTSModel, GeminiTTSModels, type GeminiTextModel, GeminiTextModels, createGeminiChat, createGeminiImage, createGeminiSummarize, createGeminiTts };
|
|
52
|
+
//# sourceMappingURL=gemini.d.mts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { GeminiImageAdapter, GeminiImageModels, GeminiSummarizeAdapter, GeminiSummarizeModels, GeminiTTSAdapter, GeminiTTSModels, GeminiTextAdapter, GeminiTextModels } from "@tanstack/ai-gemini";
|
|
2
|
+
//#region src/adapters/gemini.ts
|
|
3
|
+
/**
|
|
4
|
+
* Build Gemini client config that routes through AI Gateway.
|
|
5
|
+
* Since GeminiClientConfig extends GoogleGenAIOptions, we can inject
|
|
6
|
+
* httpOptions.baseUrl directly — no subclassing needed.
|
|
7
|
+
*
|
|
8
|
+
* The Google GenAI SDK doesn't support a custom `fetch` override,
|
|
9
|
+
* so we set the baseUrl to the AI Gateway endpoint for Google AI Studio.
|
|
10
|
+
*
|
|
11
|
+
* Tracking issue: https://github.com/googleapis/js-genai/issues/999
|
|
12
|
+
*/
|
|
13
|
+
function buildGeminiGatewayConfig(config) {
|
|
14
|
+
if ("binding" in config) throw new Error("Gemini adapters do not support binding config. The Google GenAI SDK does not support a custom fetch function — only credential-based config ({ accountId, gatewayId }) is supported. See https://github.com/googleapis/js-genai/issues/999");
|
|
15
|
+
const headers = {};
|
|
16
|
+
if (config.apiKey && config.cfApiKey) headers["cf-aig-authorization"] = `Bearer ${config.cfApiKey}`;
|
|
17
|
+
if (config.skipCache) headers["cf-aig-skip-cache"] = "true";
|
|
18
|
+
if (typeof config.cacheTtl === "number") headers["cf-aig-cache-ttl"] = String(config.cacheTtl);
|
|
19
|
+
if (typeof config.customCacheKey === "string") headers["cf-aig-cache-key"] = config.customCacheKey;
|
|
20
|
+
if (typeof config.metadata === "object") headers["cf-aig-metadata"] = JSON.stringify(config.metadata);
|
|
21
|
+
const apiKey = config.apiKey ?? config.cfApiKey;
|
|
22
|
+
if (!apiKey) throw new Error("If you want to use BYOK or unified billing, you need to pass the Cloudflare AI Gateway API key.");
|
|
23
|
+
return {
|
|
24
|
+
apiKey,
|
|
25
|
+
httpOptions: {
|
|
26
|
+
baseUrl: `https://gateway.ai.cloudflare.com/v1/${config.accountId}/${config.gatewayId}/google-ai-studio`,
|
|
27
|
+
headers: Object.keys(headers).length > 0 ? headers : void 0
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a Gemini adapter which uses Cloudflare AI Gateway.
|
|
33
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
34
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
35
|
+
* @param model The Gemini model to use
|
|
36
|
+
* @param config Configuration options (credentials only)
|
|
37
|
+
*/
|
|
38
|
+
function createGeminiChat(model, config) {
|
|
39
|
+
return new GeminiTextAdapter(buildGeminiGatewayConfig(config), model);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Creates a Gemini Image adapter which uses Cloudflare AI Gateway.
|
|
43
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
44
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
45
|
+
* @param model The Gemini model to use
|
|
46
|
+
* @param config Configuration options (credentials only)
|
|
47
|
+
*/
|
|
48
|
+
function createGeminiImage(model, config) {
|
|
49
|
+
return new GeminiImageAdapter(buildGeminiGatewayConfig(config), model);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Creates a Gemini Summarize adapter which uses Cloudflare AI Gateway.
|
|
53
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
54
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
55
|
+
* @param model The Gemini model to use
|
|
56
|
+
* @param config Configuration options (credentials only)
|
|
57
|
+
*/
|
|
58
|
+
function createGeminiSummarize(model, config) {
|
|
59
|
+
return new GeminiSummarizeAdapter(buildGeminiGatewayConfig(config), model);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
63
|
+
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
64
|
+
* See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.
|
|
65
|
+
*
|
|
66
|
+
* @experimental Gemini TTS is an experimental feature and may change.
|
|
67
|
+
* @param model The Gemini TTS model to use
|
|
68
|
+
* @param config Configuration options (credentials only)
|
|
69
|
+
*/
|
|
70
|
+
function createGeminiTts(model, config) {
|
|
71
|
+
return new GeminiTTSAdapter(buildGeminiGatewayConfig(config), model);
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { GeminiImageModels, GeminiSummarizeModels, GeminiTTSModels, GeminiTextModels, createGeminiChat, createGeminiImage, createGeminiSummarize, createGeminiTts };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=gemini.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.mjs","names":[],"sources":["../../src/adapters/gemini.ts"],"sourcesContent":["import {\n\tGeminiTextAdapter,\n\tGeminiImageAdapter,\n\tGeminiSummarizeAdapter,\n\tGeminiTTSAdapter,\n\tGeminiTextModels,\n\tGeminiImageModels,\n\tGeminiSummarizeModels,\n\tGeminiTTSModels,\n\ttype GeminiTextModel,\n\ttype GeminiImageModel,\n\ttype GeminiSummarizeModel,\n} from \"@tanstack/ai-gemini\";\n\n/** Derived from GeminiTTSModels since @tanstack/ai-gemini doesn't export a GeminiTTSModel type. */\nexport type GeminiTTSModel = (typeof GeminiTTSModels)[number];\nimport type { AnyTextAdapter } from \"@tanstack/ai\";\nimport type { AiGatewayCredentialsConfig, AiGatewayConfig } from \"../utils/create-fetcher\";\n\n/**\n * Gemini-specific gateway config (credentials only, no binding support).\n * Includes cache control options from AiGatewayConfig.\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n */\nexport type GeminiGatewayConfig = AiGatewayCredentialsConfig & AiGatewayConfig;\n\n/**\n * Build Gemini client config that routes through AI Gateway.\n * Since GeminiClientConfig extends GoogleGenAIOptions, we can inject\n * httpOptions.baseUrl directly — no subclassing needed.\n *\n * The Google GenAI SDK doesn't support a custom `fetch` override,\n * so we set the baseUrl to the AI Gateway endpoint for Google AI Studio.\n *\n * Tracking issue: https://github.com/googleapis/js-genai/issues/999\n */\nfunction buildGeminiGatewayConfig(config: GeminiGatewayConfig) {\n\t// Runtime guard: catch binding configs that bypass TypeScript (JS callers, `as any`, etc.)\n\t// We integrate with the Gemini SDK via `httpOptions` (baseUrl + headers), which allows\n\t// gateway routing and cache control but not request interception. A binding config\n\t// requires a custom `fetch` to route through the AI Gateway binding, and the Google\n\t// GenAI SDK doesn't support that yet.\n\tif (\"binding\" in config) {\n\t\tthrow new Error(\n\t\t\t\"Gemini adapters do not support binding config. \" +\n\t\t\t\t\"The Google GenAI SDK does not support a custom fetch function — \" +\n\t\t\t\t\"only credential-based config ({ accountId, gatewayId }) is supported. \" +\n\t\t\t\t\"See https://github.com/googleapis/js-genai/issues/999\",\n\t\t);\n\t}\n\n\tconst headers: Record<string, string> = {};\n\n\tif (config.apiKey && config.cfApiKey) {\n\t\theaders[\"cf-aig-authorization\"] = `Bearer ${config.cfApiKey}`;\n\t}\n\n\tif (config.skipCache) {\n\t\theaders[\"cf-aig-skip-cache\"] = \"true\";\n\t}\n\tif (typeof config.cacheTtl === \"number\") {\n\t\theaders[\"cf-aig-cache-ttl\"] = String(config.cacheTtl);\n\t}\n\tif (typeof config.customCacheKey === \"string\") {\n\t\theaders[\"cf-aig-cache-key\"] = config.customCacheKey;\n\t}\n\tif (typeof config.metadata === \"object\") {\n\t\theaders[\"cf-aig-metadata\"] = JSON.stringify(config.metadata);\n\t}\n\n\tconst apiKey = config.apiKey ?? config.cfApiKey;\n\n\tif (!apiKey) {\n\t\tthrow new Error(\n\t\t\t\"If you want to use BYOK or unified billing, you need to pass the Cloudflare AI Gateway API key.\",\n\t\t);\n\t}\n\n\treturn {\n\t\tapiKey,\n\t\thttpOptions: {\n\t\t\tbaseUrl: `https://gateway.ai.cloudflare.com/v1/${config.accountId}/${config.gatewayId}/google-ai-studio`,\n\t\t\theaders: Object.keys(headers).length > 0 ? headers : undefined,\n\t\t},\n\t};\n}\n\n/** Alias for consistency with other providers (AnthropicChatModel, GrokChatModel, etc.) */\nexport type GeminiChatModel = GeminiTextModel;\n\n/**\n * Creates a Gemini adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n * @param model The Gemini model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiChat(\n\tmodel: GeminiChatModel,\n\tconfig: GeminiGatewayConfig,\n): AnyTextAdapter {\n\treturn new GeminiTextAdapter(buildGeminiGatewayConfig(config), model);\n}\n\n/**\n * Creates a Gemini Image adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n * @param model The Gemini model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiImage(model: GeminiImageModel, config: GeminiGatewayConfig) {\n\treturn new GeminiImageAdapter(buildGeminiGatewayConfig(config), model);\n}\n\n/**\n * Creates a Gemini Summarize adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n * @param model The Gemini model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig) {\n\treturn new GeminiSummarizeAdapter(buildGeminiGatewayConfig(config), model);\n}\n\n/**\n * Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.\n * Does not support the AI binding (Google GenAI SDK lacks custom fetch support).\n * See {@link https://github.com/googleapis/js-genai/issues/999 | googleapis/js-genai#999}.\n *\n * @experimental Gemini TTS is an experimental feature and may change.\n * @param model The Gemini TTS model to use\n * @param config Configuration options (credentials only)\n */\nexport function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig) {\n\treturn new GeminiTTSAdapter(buildGeminiGatewayConfig(config), model);\n}\n\nexport {\n\tGeminiTextModels,\n\tGeminiImageModels,\n\tGeminiSummarizeModels,\n\tGeminiTTSModels,\n\ttype GeminiTextModel,\n\ttype GeminiImageModel,\n\ttype GeminiSummarizeModel,\n};\n"],"mappings":";;;;;;;;;;;;AAoCA,SAAS,yBAAyB,QAA6B;AAM9D,KAAI,aAAa,OAChB,OAAM,IAAI,MACT,6OAIA;CAGF,MAAM,UAAkC,EAAE;AAE1C,KAAI,OAAO,UAAU,OAAO,SAC3B,SAAQ,0BAA0B,UAAU,OAAO;AAGpD,KAAI,OAAO,UACV,SAAQ,uBAAuB;AAEhC,KAAI,OAAO,OAAO,aAAa,SAC9B,SAAQ,sBAAsB,OAAO,OAAO,SAAS;AAEtD,KAAI,OAAO,OAAO,mBAAmB,SACpC,SAAQ,sBAAsB,OAAO;AAEtC,KAAI,OAAO,OAAO,aAAa,SAC9B,SAAQ,qBAAqB,KAAK,UAAU,OAAO,SAAS;CAG7D,MAAM,SAAS,OAAO,UAAU,OAAO;AAEvC,KAAI,CAAC,OACJ,OAAM,IAAI,MACT,kGACA;AAGF,QAAO;EACN;EACA,aAAa;GACZ,SAAS,wCAAwC,OAAO,UAAU,GAAG,OAAO,UAAU;GACtF,SAAS,OAAO,KAAK,QAAQ,CAAC,SAAS,IAAI,UAAU,KAAA;GACrD;EACD;;;;;;;;;AAaF,SAAgB,iBACf,OACA,QACiB;AACjB,QAAO,IAAI,kBAAkB,yBAAyB,OAAO,EAAE,MAAM;;;;;;;;;AAUtE,SAAgB,kBAAkB,OAAyB,QAA6B;AACvF,QAAO,IAAI,mBAAmB,yBAAyB,OAAO,EAAE,MAAM;;;;;;;;;AAUvE,SAAgB,sBAAsB,OAA6B,QAA6B;AAC/F,QAAO,IAAI,uBAAuB,yBAAyB,OAAO,EAAE,MAAM;;;;;;;;;;;AAY3E,SAAgB,gBAAgB,OAAuB,QAA6B;AACnF,QAAO,IAAI,iBAAiB,yBAAyB,OAAO,EAAE,MAAM"}
|