@cloudflare/tanstack-ai 0.1.9 → 0.1.10
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 +5 -5
- package/dist/adapters/anthropic.cjs +2 -3
- package/dist/adapters/anthropic.cjs.map +1 -1
- package/dist/adapters/anthropic.d.cts +4 -3
- package/dist/adapters/anthropic.d.mts +4 -3
- package/dist/adapters/anthropic.mjs +3 -3
- package/dist/adapters/anthropic.mjs.map +1 -1
- package/dist/adapters/gemini.cjs +2 -3
- package/dist/adapters/gemini.cjs.map +1 -1
- package/dist/adapters/gemini.d.cts +6 -6
- package/dist/adapters/gemini.d.mts +6 -6
- package/dist/adapters/gemini.mjs +4 -3
- package/dist/adapters/gemini.mjs.map +1 -1
- package/dist/adapters/grok.cjs +2 -6
- package/dist/adapters/grok.cjs.map +1 -1
- package/dist/adapters/grok.d.cts +5 -4
- package/dist/adapters/grok.d.mts +5 -4
- package/dist/adapters/grok.mjs +3 -6
- package/dist/adapters/grok.mjs.map +1 -1
- package/dist/adapters/openai.cjs +2 -3
- package/dist/adapters/openai.cjs.map +1 -1
- package/dist/adapters/openai.d.cts +6 -5
- package/dist/adapters/openai.d.mts +6 -5
- package/dist/adapters/openai.mjs +3 -3
- package/dist/adapters/openai.mjs.map +1 -1
- package/dist/adapters/openrouter.cjs +3 -17
- package/dist/adapters/openrouter.cjs.map +1 -1
- package/dist/adapters/openrouter.d.cts +4 -4
- package/dist/adapters/openrouter.d.mts +4 -4
- package/dist/adapters/openrouter.mjs +4 -17
- package/dist/adapters/openrouter.mjs.map +1 -1
- package/dist/adapters/workers-ai-image.cjs +5 -6
- package/dist/adapters/workers-ai-image.cjs.map +1 -1
- package/dist/adapters/workers-ai-image.d.cts +1 -1
- package/dist/adapters/workers-ai-image.d.mts +2 -2
- package/dist/adapters/workers-ai-image.mjs +5 -5
- package/dist/adapters/workers-ai-image.mjs.map +1 -1
- package/dist/adapters/workers-ai-summarize.cjs +3 -4
- package/dist/adapters/workers-ai-summarize.cjs.map +1 -1
- package/dist/adapters/workers-ai-summarize.d.cts +1 -1
- package/dist/adapters/workers-ai-summarize.d.mts +2 -2
- package/dist/adapters/workers-ai-summarize.mjs +3 -3
- package/dist/adapters/workers-ai-summarize.mjs.map +1 -1
- package/dist/adapters/workers-ai-transcription.cjs +5 -6
- package/dist/adapters/workers-ai-transcription.cjs.map +1 -1
- package/dist/adapters/workers-ai-transcription.d.cts +1 -1
- package/dist/adapters/workers-ai-transcription.d.mts +2 -2
- package/dist/adapters/workers-ai-transcription.mjs +5 -5
- package/dist/adapters/workers-ai-transcription.mjs.map +1 -1
- package/dist/adapters/workers-ai-tts.cjs +5 -6
- package/dist/adapters/workers-ai-tts.cjs.map +1 -1
- package/dist/adapters/workers-ai-tts.d.cts +1 -1
- package/dist/adapters/workers-ai-tts.d.mts +2 -2
- package/dist/adapters/workers-ai-tts.mjs +5 -5
- package/dist/adapters/workers-ai-tts.mjs.map +1 -1
- package/dist/adapters/workers-ai.cjs +520 -3
- package/dist/adapters/workers-ai.cjs.map +1 -0
- package/dist/adapters/workers-ai.d.cts +2 -2
- package/dist/adapters/workers-ai.d.mts +3 -3
- package/dist/adapters/workers-ai.mjs +56 -41
- package/dist/adapters/workers-ai.mjs.map +1 -1
- package/dist/{binary-p4H_N_3M.mjs → binary-B5YCVsro.mjs} +1 -1
- package/dist/{binary-C9FAYwZj.cjs.map → binary-B5YCVsro.mjs.map} +1 -1
- package/dist/{binary-C9FAYwZj.cjs → binary-CZhr1_2n.cjs} +1 -1
- package/dist/{binary-p4H_N_3M.mjs.map → binary-CZhr1_2n.cjs.map} +1 -1
- package/dist/{create-fetcher-CeUOJgrh.mjs → create-fetcher-BnSnCaHf.mjs} +1 -1
- package/dist/{create-fetcher-By-hTiT9.cjs.map → create-fetcher-BnSnCaHf.mjs.map} +1 -1
- package/dist/{create-fetcher-6p6heb85.d.mts → create-fetcher-Bp5yCNaO.d.cts} +1 -1
- package/dist/{create-fetcher-vAQ8WW-p.d.cts → create-fetcher-Bp5yCNaO.d.mts} +1 -1
- package/dist/{create-fetcher-By-hTiT9.cjs → create-fetcher-YVxWCTVL.cjs} +1 -1
- package/dist/{create-fetcher-CeUOJgrh.mjs.map → create-fetcher-YVxWCTVL.cjs.map} +1 -1
- package/dist/{defineProperty-CbyrzcbA.mjs → defineProperty-BC3bEcwq.mjs} +4 -4
- package/dist/{defineProperty-DQoAg20E.cjs → defineProperty-In8g9yAD.cjs} +4 -4
- package/dist/index.cjs +2 -3
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{workers-ai-rest-GKy2r7eG.mjs → workers-ai-rest-B6_yU35Q.mjs} +1 -1
- package/dist/{workers-ai-rest-CkNCtBwv.cjs.map → workers-ai-rest-B6_yU35Q.mjs.map} +1 -1
- package/dist/{workers-ai-rest-CkNCtBwv.cjs → workers-ai-rest-_MXOmyDs.cjs} +1 -1
- package/dist/{workers-ai-rest-GKy2r7eG.mjs.map → workers-ai-rest-_MXOmyDs.cjs.map} +1 -1
- package/package.json +9 -9
- package/dist/workers-ai-BOZ5iyhY.cjs +0 -521
- package/dist/workers-ai-BOZ5iyhY.cjs.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/moonshotai/kimi-k2.
|
|
49
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.7-code", {
|
|
50
50
|
binding: env.AI,
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -62,7 +62,7 @@ return toHttpResponse(response);
|
|
|
62
62
|
**Using REST credentials:**
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
|
-
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.
|
|
65
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.7-code", {
|
|
66
66
|
accountId: "your-account-id",
|
|
67
67
|
apiKey: "your-api-key",
|
|
68
68
|
});
|
|
@@ -102,7 +102,7 @@ See the [Workers AI docs](https://developers.cloudflare.com/workers-ai/) for per
|
|
|
102
102
|
Send images to vision-capable chat models:
|
|
103
103
|
|
|
104
104
|
```typescript
|
|
105
|
-
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.
|
|
105
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.7-code", {
|
|
106
106
|
accountId: "your-account-id",
|
|
107
107
|
apiKey: "your-api-key",
|
|
108
108
|
});
|
|
@@ -234,7 +234,7 @@ const adapter = createOpenAiChat("gpt-4o", {
|
|
|
234
234
|
### Workers AI through Gateway
|
|
235
235
|
|
|
236
236
|
```typescript
|
|
237
|
-
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.
|
|
237
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.7-code", {
|
|
238
238
|
binding: env.AI.gateway("my-gateway-id"),
|
|
239
239
|
apiKey: env.WORKERS_AI_TOKEN,
|
|
240
240
|
});
|
|
@@ -343,7 +343,7 @@ Third-party providers (OpenAI, Anthropic, Gemini, Grok, OpenRouter) only support
|
|
|
343
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:
|
|
344
344
|
|
|
345
345
|
```typescript
|
|
346
|
-
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.
|
|
346
|
+
const adapter = createWorkersAiChat("@cf/moonshotai/kimi-k2.7-code", {
|
|
347
347
|
binding: env.AI,
|
|
348
348
|
sessionAffinity: "my-unique-session-id",
|
|
349
349
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../
|
|
3
|
-
const require_create_fetcher = require("../create-fetcher-By-hTiT9.cjs");
|
|
2
|
+
const require_create_fetcher = require("../create-fetcher-YVxWCTVL.cjs");
|
|
4
3
|
let _tanstack_ai_anthropic = require("@tanstack/ai-anthropic");
|
|
5
4
|
//#region src/adapters/anthropic.ts
|
|
6
5
|
function buildAnthropicConfig(config) {
|
|
@@ -24,7 +23,7 @@ function createAnthropicChat(model, config) {
|
|
|
24
23
|
* Supports both binding and credential-based configurations.
|
|
25
24
|
*/
|
|
26
25
|
function createAnthropicSummarize(model, config) {
|
|
27
|
-
return
|
|
26
|
+
return (0, _tanstack_ai_anthropic.createAnthropicSummarize)(model, config.apiKey ?? "unused", { fetch: require_create_fetcher.createGatewayFetch("anthropic", config, { "anthropic-version": config.anthropicVersion ?? "2023-06-01" }) });
|
|
28
27
|
}
|
|
29
28
|
//#endregion
|
|
30
29
|
exports.ANTHROPIC_MODELS = _tanstack_ai_anthropic.ANTHROPIC_MODELS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.cjs","names":["createGatewayFetch","AnthropicTextAdapter"
|
|
1
|
+
{"version":3,"file":"anthropic.cjs","names":["createGatewayFetch","AnthropicTextAdapter"],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":["import {\n\tAnthropicTextAdapter,\n\tcreateAnthropicSummarize as createAnthropicSummarizeAdapter,\n\tANTHROPIC_MODELS,\n\ttype AnthropicChatModel,\n} from \"@tanstack/ai-anthropic\";\nimport { createGatewayFetch, type AiGatewayAdapterConfig } from \"../utils/create-fetcher\";\nimport type { AnySummarizeAdapter } from \"@tanstack/ai\";\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): AnySummarizeAdapter {\n\treturn createAnthropicSummarizeAdapter(model, 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\nexport { ANTHROPIC_MODELS, type AnthropicChatModel };\n"],"mappings":";;;;AAWA,SAAS,qBAAqB,QAAgC;CAC7D,OAAO;EACN,QAAQ,OAAO,UAAU;EACzB,OAAOA,uBAAAA,mBAAmB,aAAa,QAAQ,EAC9C,qBAAqB,OAAO,oBAAoB,aACjD,CAAC;CACF;AACD;;;;;;;;AASA,SAAgB,oBACf,OACA,QAC2C;CAC3C,OAAO,IAAIC,uBAAAA,qBAAqB,qBAAqB,MAAM,GAAG,KAAK;AACpE;;;;;AAMA,SAAgB,yBACf,OACA,QACsB;CACtB,QAAA,GAAA,uBAAA,yBAAA,CAAuC,OAAO,OAAO,UAAU,UAAU,EACxE,OAAOD,uBAAAA,mBAAmB,aAAa,QAAQ,EAC9C,qBAAqB,OAAO,oBAAoB,aACjD,CAAC,EACF,CAAC;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as AiGatewayAdapterConfig } from "../create-fetcher-
|
|
2
|
-
import { ANTHROPIC_MODELS, AnthropicChatModel,
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-Bp5yCNaO.cjs";
|
|
2
|
+
import { ANTHROPIC_MODELS, AnthropicChatModel, AnthropicTextAdapter } from "@tanstack/ai-anthropic";
|
|
3
|
+
import { AnySummarizeAdapter } from "@tanstack/ai";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/anthropic.d.ts
|
|
5
6
|
type AnthropicGatewayConfig = AiGatewayAdapterConfig & {
|
|
@@ -17,7 +18,7 @@ declare function createAnthropicChat(model: AnthropicChatModel, config: Anthropi
|
|
|
17
18
|
* Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.
|
|
18
19
|
* Supports both binding and credential-based configurations.
|
|
19
20
|
*/
|
|
20
|
-
declare function createAnthropicSummarize(model: AnthropicChatModel, config: AnthropicGatewayConfig):
|
|
21
|
+
declare function createAnthropicSummarize(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnySummarizeAdapter;
|
|
21
22
|
//#endregion
|
|
22
23
|
export { ANTHROPIC_MODELS, type AnthropicChatModel, AnthropicGatewayConfig, createAnthropicChat, createAnthropicSummarize };
|
|
23
24
|
//# sourceMappingURL=anthropic.d.cts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as AiGatewayAdapterConfig } from "../create-fetcher-
|
|
2
|
-
import { ANTHROPIC_MODELS, AnthropicChatModel,
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-Bp5yCNaO.mjs";
|
|
2
|
+
import { ANTHROPIC_MODELS, AnthropicChatModel, AnthropicTextAdapter } from "@tanstack/ai-anthropic";
|
|
3
|
+
import { AnySummarizeAdapter } from "@tanstack/ai";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/anthropic.d.ts
|
|
5
6
|
type AnthropicGatewayConfig = AiGatewayAdapterConfig & {
|
|
@@ -17,7 +18,7 @@ declare function createAnthropicChat(model: AnthropicChatModel, config: Anthropi
|
|
|
17
18
|
* Creates an Anthropic summarize adapter which uses Cloudflare AI Gateway.
|
|
18
19
|
* Supports both binding and credential-based configurations.
|
|
19
20
|
*/
|
|
20
|
-
declare function createAnthropicSummarize(model: AnthropicChatModel, config: AnthropicGatewayConfig):
|
|
21
|
+
declare function createAnthropicSummarize(model: AnthropicChatModel, config: AnthropicGatewayConfig): AnySummarizeAdapter;
|
|
21
22
|
//#endregion
|
|
22
23
|
export { ANTHROPIC_MODELS, type AnthropicChatModel, AnthropicGatewayConfig, createAnthropicChat, createAnthropicSummarize };
|
|
23
24
|
//# sourceMappingURL=anthropic.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createGatewayFetch } from "../create-fetcher-
|
|
2
|
-
import { ANTHROPIC_MODELS,
|
|
1
|
+
import { t as createGatewayFetch } from "../create-fetcher-BnSnCaHf.mjs";
|
|
2
|
+
import { ANTHROPIC_MODELS, AnthropicTextAdapter, createAnthropicSummarize as createAnthropicSummarize$1 } from "@tanstack/ai-anthropic";
|
|
3
3
|
//#region src/adapters/anthropic.ts
|
|
4
4
|
function buildAnthropicConfig(config) {
|
|
5
5
|
return {
|
|
@@ -22,7 +22,7 @@ function createAnthropicChat(model, config) {
|
|
|
22
22
|
* Supports both binding and credential-based configurations.
|
|
23
23
|
*/
|
|
24
24
|
function createAnthropicSummarize(model, config) {
|
|
25
|
-
return
|
|
25
|
+
return createAnthropicSummarize$1(model, config.apiKey ?? "unused", { fetch: createGatewayFetch("anthropic", config, { "anthropic-version": config.anthropicVersion ?? "2023-06-01" }) });
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
28
|
export { ANTHROPIC_MODELS, createAnthropicChat, createAnthropicSummarize };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.mjs","names":[],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":["import {\n\tAnthropicTextAdapter,\n\
|
|
1
|
+
{"version":3,"file":"anthropic.mjs","names":["createAnthropicSummarizeAdapter"],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":["import {\n\tAnthropicTextAdapter,\n\tcreateAnthropicSummarize as createAnthropicSummarizeAdapter,\n\tANTHROPIC_MODELS,\n\ttype AnthropicChatModel,\n} from \"@tanstack/ai-anthropic\";\nimport { createGatewayFetch, type AiGatewayAdapterConfig } from \"../utils/create-fetcher\";\nimport type { AnySummarizeAdapter } from \"@tanstack/ai\";\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): AnySummarizeAdapter {\n\treturn createAnthropicSummarizeAdapter(model, 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\nexport { ANTHROPIC_MODELS, type AnthropicChatModel };\n"],"mappings":";;;AAWA,SAAS,qBAAqB,QAAgC;CAC7D,OAAO;EACN,QAAQ,OAAO,UAAU;EACzB,OAAO,mBAAmB,aAAa,QAAQ,EAC9C,qBAAqB,OAAO,oBAAoB,aACjD,CAAC;CACF;AACD;;;;;;;;AASA,SAAgB,oBACf,OACA,QAC2C;CAC3C,OAAO,IAAI,qBAAqB,qBAAqB,MAAM,GAAG,KAAK;AACpE;;;;;AAMA,SAAgB,yBACf,OACA,QACsB;CACtB,OAAOA,2BAAgC,OAAO,OAAO,UAAU,UAAU,EACxE,OAAO,mBAAmB,aAAa,QAAQ,EAC9C,qBAAqB,OAAO,oBAAoB,aACjD,CAAC,EACF,CAAC;AACF"}
|
package/dist/adapters/gemini.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../workers-ai-BOZ5iyhY.cjs");
|
|
3
2
|
let _tanstack_ai_gemini = require("@tanstack/ai-gemini");
|
|
4
3
|
//#region src/adapters/gemini.ts
|
|
5
4
|
/**
|
|
@@ -58,7 +57,8 @@ function createGeminiImage(model, config) {
|
|
|
58
57
|
* @param config Configuration options (credentials only)
|
|
59
58
|
*/
|
|
60
59
|
function createGeminiSummarize(model, config) {
|
|
61
|
-
|
|
60
|
+
const { apiKey, httpOptions } = buildGeminiGatewayConfig(config);
|
|
61
|
+
return (0, _tanstack_ai_gemini.createGeminiSummarize)(apiKey, model, { httpOptions });
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
@@ -74,7 +74,6 @@ function createGeminiTts(model, config) {
|
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
76
|
exports.GeminiImageModels = _tanstack_ai_gemini.GeminiImageModels;
|
|
77
|
-
exports.GeminiSummarizeModels = _tanstack_ai_gemini.GeminiSummarizeModels;
|
|
78
77
|
exports.GeminiTTSModels = _tanstack_ai_gemini.GeminiTTSModels;
|
|
79
78
|
exports.GeminiTextModels = _tanstack_ai_gemini.GeminiTextModels;
|
|
80
79
|
exports.createGeminiChat = createGeminiChat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.cjs","names":["GeminiTextAdapter","GeminiImageAdapter","
|
|
1
|
+
{"version":3,"file":"gemini.cjs","names":["GeminiTextAdapter","GeminiImageAdapter","GeminiTTSAdapter"],"sources":["../../src/adapters/gemini.ts"],"sourcesContent":["import {\n\tGeminiTextAdapter,\n\tGeminiImageAdapter,\n\tcreateGeminiSummarize as createGeminiSummarizeAdapter,\n\tGeminiTTSAdapter,\n\tGeminiTextModels,\n\tGeminiImageModels,\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 { AnySummarizeAdapter, 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(\n\tmodel: GeminiSummarizeModel,\n\tconfig: GeminiGatewayConfig,\n): AnySummarizeAdapter {\n\tconst { apiKey, httpOptions } = buildGeminiGatewayConfig(config);\n\treturn createGeminiSummarizeAdapter(apiKey, model, { httpOptions });\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\tGeminiTTSModels,\n\ttype GeminiTextModel,\n\ttype GeminiImageModel,\n\ttype GeminiSummarizeModel,\n};\n"],"mappings":";;;;;;;;;;;;;AAmCA,SAAS,yBAAyB,QAA6B;CAM9D,IAAI,aAAa,QAChB,MAAM,IAAI,MACT,4OAID;CAGD,MAAM,UAAkC,CAAC;CAEzC,IAAI,OAAO,UAAU,OAAO,UAC3B,QAAQ,0BAA0B,UAAU,OAAO;CAGpD,IAAI,OAAO,WACV,QAAQ,uBAAuB;CAEhC,IAAI,OAAO,OAAO,aAAa,UAC9B,QAAQ,sBAAsB,OAAO,OAAO,QAAQ;CAErD,IAAI,OAAO,OAAO,mBAAmB,UACpC,QAAQ,sBAAsB,OAAO;CAEtC,IAAI,OAAO,OAAO,aAAa,UAC9B,QAAQ,qBAAqB,KAAK,UAAU,OAAO,QAAQ;CAG5D,MAAM,SAAS,OAAO,UAAU,OAAO;CAEvC,IAAI,CAAC,QACJ,MAAM,IAAI,MACT,iGACD;CAGD,OAAO;EACN;EACA,aAAa;GACZ,SAAS,wCAAwC,OAAO,UAAU,GAAG,OAAO,UAAU;GACtF,SAAS,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,IAAI,UAAU,KAAA;EACtD;CACD;AACD;;;;;;;;AAYA,SAAgB,iBACf,OACA,QACiB;CACjB,OAAO,IAAIA,oBAAAA,kBAAkB,yBAAyB,MAAM,GAAG,KAAK;AACrE;;;;;;;;AASA,SAAgB,kBAAkB,OAAyB,QAA6B;CACvF,OAAO,IAAIC,oBAAAA,mBAAmB,yBAAyB,MAAM,GAAG,KAAK;AACtE;;;;;;;;AASA,SAAgB,sBACf,OACA,QACsB;CACtB,MAAM,EAAE,QAAQ,gBAAgB,yBAAyB,MAAM;CAC/D,QAAA,GAAA,oBAAA,sBAAA,CAAoC,QAAQ,OAAO,EAAE,YAAY,CAAC;AACnE;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAuB,QAA6B;CACnF,OAAO,IAAIC,oBAAAA,iBAAiB,yBAAyB,MAAM,GAAG,KAAK;AACpE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as AiGatewayConfig, r as AiGatewayCredentialsConfig } from "../create-fetcher-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { n as AiGatewayConfig, r as AiGatewayCredentialsConfig } from "../create-fetcher-Bp5yCNaO.cjs";
|
|
2
|
+
import { AnySummarizeAdapter, AnyTextAdapter } from "@tanstack/ai";
|
|
3
|
+
import { GeminiImageAdapter, GeminiImageModel, GeminiImageModels, GeminiSummarizeModel, GeminiTTSAdapter, GeminiTTSModels, GeminiTextModel, GeminiTextModels } from "@tanstack/ai-gemini";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/gemini.d.ts
|
|
6
6
|
/** Derived from GeminiTTSModels since @tanstack/ai-gemini doesn't export a GeminiTTSModel type. */
|
|
@@ -36,7 +36,7 @@ declare function createGeminiImage(model: GeminiImageModel, config: GeminiGatewa
|
|
|
36
36
|
* @param model The Gemini model to use
|
|
37
37
|
* @param config Configuration options (credentials only)
|
|
38
38
|
*/
|
|
39
|
-
declare function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig):
|
|
39
|
+
declare function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig): AnySummarizeAdapter;
|
|
40
40
|
/**
|
|
41
41
|
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
42
42
|
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
@@ -46,7 +46,7 @@ declare function createGeminiSummarize(model: GeminiSummarizeModel, config: Gemi
|
|
|
46
46
|
* @param model The Gemini TTS model to use
|
|
47
47
|
* @param config Configuration options (credentials only)
|
|
48
48
|
*/
|
|
49
|
-
declare function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig): GeminiTTSAdapter<"gemini-2.5-flash-preview-tts" | "gemini-2.5-pro-preview-tts">;
|
|
49
|
+
declare function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig): GeminiTTSAdapter<"gemini-3.1-flash-tts-preview" | "gemini-2.5-flash-preview-tts" | "gemini-2.5-pro-preview-tts">;
|
|
50
50
|
//#endregion
|
|
51
|
-
export { GeminiChatModel, GeminiGatewayConfig, type GeminiImageModel, GeminiImageModels, type GeminiSummarizeModel,
|
|
51
|
+
export { GeminiChatModel, GeminiGatewayConfig, type GeminiImageModel, GeminiImageModels, type GeminiSummarizeModel, GeminiTTSModel, GeminiTTSModels, type GeminiTextModel, GeminiTextModels, createGeminiChat, createGeminiImage, createGeminiSummarize, createGeminiTts };
|
|
52
52
|
//# sourceMappingURL=gemini.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as AiGatewayConfig, r as AiGatewayCredentialsConfig } from "../create-fetcher-
|
|
2
|
-
import { GeminiImageAdapter, GeminiImageModel, GeminiImageModels,
|
|
3
|
-
import { AnyTextAdapter } from "@tanstack/ai";
|
|
1
|
+
import { n as AiGatewayConfig, r as AiGatewayCredentialsConfig } from "../create-fetcher-Bp5yCNaO.mjs";
|
|
2
|
+
import { GeminiImageAdapter, GeminiImageModel, GeminiImageModels, GeminiSummarizeModel, GeminiTTSAdapter, GeminiTTSModels, GeminiTextModel, GeminiTextModels } from "@tanstack/ai-gemini";
|
|
3
|
+
import { AnySummarizeAdapter, AnyTextAdapter } from "@tanstack/ai";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/gemini.d.ts
|
|
6
6
|
/** Derived from GeminiTTSModels since @tanstack/ai-gemini doesn't export a GeminiTTSModel type. */
|
|
@@ -36,7 +36,7 @@ declare function createGeminiImage(model: GeminiImageModel, config: GeminiGatewa
|
|
|
36
36
|
* @param model The Gemini model to use
|
|
37
37
|
* @param config Configuration options (credentials only)
|
|
38
38
|
*/
|
|
39
|
-
declare function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig):
|
|
39
|
+
declare function createGeminiSummarize(model: GeminiSummarizeModel, config: GeminiGatewayConfig): AnySummarizeAdapter;
|
|
40
40
|
/**
|
|
41
41
|
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
42
42
|
* Does not support the AI binding (Google GenAI SDK lacks custom fetch support).
|
|
@@ -46,7 +46,7 @@ declare function createGeminiSummarize(model: GeminiSummarizeModel, config: Gemi
|
|
|
46
46
|
* @param model The Gemini TTS model to use
|
|
47
47
|
* @param config Configuration options (credentials only)
|
|
48
48
|
*/
|
|
49
|
-
declare function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig): GeminiTTSAdapter<"gemini-2.5-flash-preview-tts" | "gemini-2.5-pro-preview-tts">;
|
|
49
|
+
declare function createGeminiTts(model: GeminiTTSModel, config: GeminiGatewayConfig): GeminiTTSAdapter<"gemini-3.1-flash-tts-preview" | "gemini-2.5-flash-preview-tts" | "gemini-2.5-pro-preview-tts">;
|
|
50
50
|
//#endregion
|
|
51
|
-
export { GeminiChatModel, GeminiGatewayConfig, type GeminiImageModel, GeminiImageModels, type GeminiSummarizeModel,
|
|
51
|
+
export { GeminiChatModel, GeminiGatewayConfig, type GeminiImageModel, GeminiImageModels, type GeminiSummarizeModel, GeminiTTSModel, GeminiTTSModels, type GeminiTextModel, GeminiTextModels, createGeminiChat, createGeminiImage, createGeminiSummarize, createGeminiTts };
|
|
52
52
|
//# sourceMappingURL=gemini.d.mts.map
|
package/dist/adapters/gemini.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GeminiImageAdapter, GeminiImageModels,
|
|
1
|
+
import { GeminiImageAdapter, GeminiImageModels, GeminiTTSAdapter, GeminiTTSModels, GeminiTextAdapter, GeminiTextModels, createGeminiSummarize as createGeminiSummarize$1 } from "@tanstack/ai-gemini";
|
|
2
2
|
//#region src/adapters/gemini.ts
|
|
3
3
|
/**
|
|
4
4
|
* Build Gemini client config that routes through AI Gateway.
|
|
@@ -56,7 +56,8 @@ function createGeminiImage(model, config) {
|
|
|
56
56
|
* @param config Configuration options (credentials only)
|
|
57
57
|
*/
|
|
58
58
|
function createGeminiSummarize(model, config) {
|
|
59
|
-
|
|
59
|
+
const { apiKey, httpOptions } = buildGeminiGatewayConfig(config);
|
|
60
|
+
return createGeminiSummarize$1(apiKey, model, { httpOptions });
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Creates a Gemini TTS adapter which uses Cloudflare AI Gateway.
|
|
@@ -71,6 +72,6 @@ function createGeminiTts(model, config) {
|
|
|
71
72
|
return new GeminiTTSAdapter(buildGeminiGatewayConfig(config), model);
|
|
72
73
|
}
|
|
73
74
|
//#endregion
|
|
74
|
-
export { GeminiImageModels,
|
|
75
|
+
export { GeminiImageModels, GeminiTTSModels, GeminiTextModels, createGeminiChat, createGeminiImage, createGeminiSummarize, createGeminiTts };
|
|
75
76
|
|
|
76
77
|
//# sourceMappingURL=gemini.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.mjs","names":[],"sources":["../../src/adapters/gemini.ts"],"sourcesContent":["import {\n\tGeminiTextAdapter,\n\tGeminiImageAdapter,\n\
|
|
1
|
+
{"version":3,"file":"gemini.mjs","names":["createGeminiSummarizeAdapter"],"sources":["../../src/adapters/gemini.ts"],"sourcesContent":["import {\n\tGeminiTextAdapter,\n\tGeminiImageAdapter,\n\tcreateGeminiSummarize as createGeminiSummarizeAdapter,\n\tGeminiTTSAdapter,\n\tGeminiTextModels,\n\tGeminiImageModels,\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 { AnySummarizeAdapter, 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(\n\tmodel: GeminiSummarizeModel,\n\tconfig: GeminiGatewayConfig,\n): AnySummarizeAdapter {\n\tconst { apiKey, httpOptions } = buildGeminiGatewayConfig(config);\n\treturn createGeminiSummarizeAdapter(apiKey, model, { httpOptions });\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\tGeminiTTSModels,\n\ttype GeminiTextModel,\n\ttype GeminiImageModel,\n\ttype GeminiSummarizeModel,\n};\n"],"mappings":";;;;;;;;;;;;AAmCA,SAAS,yBAAyB,QAA6B;CAM9D,IAAI,aAAa,QAChB,MAAM,IAAI,MACT,4OAID;CAGD,MAAM,UAAkC,CAAC;CAEzC,IAAI,OAAO,UAAU,OAAO,UAC3B,QAAQ,0BAA0B,UAAU,OAAO;CAGpD,IAAI,OAAO,WACV,QAAQ,uBAAuB;CAEhC,IAAI,OAAO,OAAO,aAAa,UAC9B,QAAQ,sBAAsB,OAAO,OAAO,QAAQ;CAErD,IAAI,OAAO,OAAO,mBAAmB,UACpC,QAAQ,sBAAsB,OAAO;CAEtC,IAAI,OAAO,OAAO,aAAa,UAC9B,QAAQ,qBAAqB,KAAK,UAAU,OAAO,QAAQ;CAG5D,MAAM,SAAS,OAAO,UAAU,OAAO;CAEvC,IAAI,CAAC,QACJ,MAAM,IAAI,MACT,iGACD;CAGD,OAAO;EACN;EACA,aAAa;GACZ,SAAS,wCAAwC,OAAO,UAAU,GAAG,OAAO,UAAU;GACtF,SAAS,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,IAAI,UAAU,KAAA;EACtD;CACD;AACD;;;;;;;;AAYA,SAAgB,iBACf,OACA,QACiB;CACjB,OAAO,IAAI,kBAAkB,yBAAyB,MAAM,GAAG,KAAK;AACrE;;;;;;;;AASA,SAAgB,kBAAkB,OAAyB,QAA6B;CACvF,OAAO,IAAI,mBAAmB,yBAAyB,MAAM,GAAG,KAAK;AACtE;;;;;;;;AASA,SAAgB,sBACf,OACA,QACsB;CACtB,MAAM,EAAE,QAAQ,gBAAgB,yBAAyB,MAAM;CAC/D,OAAOA,wBAA6B,QAAQ,OAAO,EAAE,YAAY,CAAC;AACnE;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAuB,QAA6B;CACnF,OAAO,IAAI,iBAAiB,yBAAyB,MAAM,GAAG,KAAK;AACpE"}
|
package/dist/adapters/grok.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../
|
|
3
|
-
const require_create_fetcher = require("../create-fetcher-By-hTiT9.cjs");
|
|
2
|
+
const require_create_fetcher = require("../create-fetcher-YVxWCTVL.cjs");
|
|
4
3
|
let _tanstack_ai_grok = require("@tanstack/ai-grok");
|
|
5
4
|
//#region src/adapters/grok.ts
|
|
6
5
|
/**
|
|
@@ -31,10 +30,7 @@ function createGrokImage(model, config) {
|
|
|
31
30
|
* Supports both binding and credential-based configurations.
|
|
32
31
|
*/
|
|
33
32
|
function createGrokSummarize(model, config) {
|
|
34
|
-
return
|
|
35
|
-
apiKey: config.apiKey ?? "unused",
|
|
36
|
-
fetch: require_create_fetcher.createGatewayFetch("grok", config)
|
|
37
|
-
}, model);
|
|
33
|
+
return (0, _tanstack_ai_grok.createGrokSummarize)(model, config.apiKey ?? "unused", { fetch: require_create_fetcher.createGatewayFetch("grok", config) });
|
|
38
34
|
}
|
|
39
35
|
//#endregion
|
|
40
36
|
exports.GROK_CHAT_MODELS = _tanstack_ai_grok.GROK_CHAT_MODELS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grok.cjs","names":["GrokTextAdapter","createGatewayFetch","GrokImageAdapter"
|
|
1
|
+
{"version":3,"file":"grok.cjs","names":["GrokTextAdapter","createGatewayFetch","GrokImageAdapter"],"sources":["../../src/adapters/grok.ts"],"sourcesContent":["import {\n\tGrokTextAdapter,\n\tGrokImageAdapter,\n\tcreateGrokSummarize as createGrokSummarizeAdapter,\n\tGROK_CHAT_MODELS,\n\tGROK_IMAGE_MODELS,\n\ttype GrokChatModel,\n\ttype GrokImageModel,\n\ttype GrokSummarizeModel,\n} from \"@tanstack/ai-grok\";\nimport { createGatewayFetch, type AiGatewayAdapterConfig } from \"../utils/create-fetcher\";\nimport type { AnySummarizeAdapter } from \"@tanstack/ai\";\n\nexport type GrokGatewayConfig = AiGatewayAdapterConfig;\n\n/**\n * Creates a Grok chat adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n *\n * Since GrokTextConfig extends the OpenAI SDK's ClientOptions,\n * we can inject the gateway fetch directly — no subclassing needed.\n */\nexport function createGrokChat(\n\tmodel: GrokChatModel,\n\tconfig: GrokGatewayConfig,\n): GrokTextAdapter<GrokChatModel> {\n\treturn new GrokTextAdapter(\n\t\t{\n\t\t\tapiKey: config.apiKey ?? \"unused\",\n\t\t\tfetch: createGatewayFetch(\"grok\", config),\n\t\t},\n\t\tmodel,\n\t);\n}\n\n/**\n * Creates a Grok image adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n */\nexport function createGrokImage(model: GrokImageModel, config: GrokGatewayConfig) {\n\treturn new GrokImageAdapter(\n\t\t{\n\t\t\tapiKey: config.apiKey ?? \"unused\",\n\t\t\tfetch: createGatewayFetch(\"grok\", config),\n\t\t},\n\t\tmodel,\n\t);\n}\n\n/**\n * Creates a Grok summarize adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n */\nexport function createGrokSummarize(\n\tmodel: GrokSummarizeModel,\n\tconfig: GrokGatewayConfig,\n): AnySummarizeAdapter {\n\treturn createGrokSummarizeAdapter(model, config.apiKey ?? \"unused\", {\n\t\tfetch: createGatewayFetch(\"grok\", config),\n\t});\n}\n\nexport {\n\tGROK_CHAT_MODELS,\n\tGROK_IMAGE_MODELS,\n\ttype GrokChatModel,\n\ttype GrokImageModel,\n\ttype GrokSummarizeModel,\n};\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgB,eACf,OACA,QACiC;CACjC,OAAO,IAAIA,kBAAAA,gBACV;EACC,QAAQ,OAAO,UAAU;EACzB,OAAOC,uBAAAA,mBAAmB,QAAQ,MAAM;CACzC,GACA,KACD;AACD;;;;;AAMA,SAAgB,gBAAgB,OAAuB,QAA2B;CACjF,OAAO,IAAIC,kBAAAA,iBACV;EACC,QAAQ,OAAO,UAAU;EACzB,OAAOD,uBAAAA,mBAAmB,QAAQ,MAAM;CACzC,GACA,KACD;AACD;;;;;AAMA,SAAgB,oBACf,OACA,QACsB;CACtB,QAAA,GAAA,kBAAA,oBAAA,CAAkC,OAAO,OAAO,UAAU,UAAU,EACnE,OAAOA,uBAAAA,mBAAmB,QAAQ,MAAM,EACzC,CAAC;AACF"}
|
package/dist/adapters/grok.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as AiGatewayAdapterConfig } from "../create-fetcher-
|
|
2
|
-
import {
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-Bp5yCNaO.cjs";
|
|
2
|
+
import { AnySummarizeAdapter } from "@tanstack/ai";
|
|
3
|
+
import { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, GrokChatModel, GrokImageAdapter, GrokImageModel, GrokSummarizeModel, GrokTextAdapter } from "@tanstack/ai-grok";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/grok.d.ts
|
|
5
6
|
type GrokGatewayConfig = AiGatewayAdapterConfig;
|
|
@@ -10,7 +11,7 @@ type GrokGatewayConfig = AiGatewayAdapterConfig;
|
|
|
10
11
|
* Since GrokTextConfig extends the OpenAI SDK's ClientOptions,
|
|
11
12
|
* we can inject the gateway fetch directly — no subclassing needed.
|
|
12
13
|
*/
|
|
13
|
-
declare function createGrokChat(model: GrokChatModel, config: GrokGatewayConfig): GrokTextAdapter<
|
|
14
|
+
declare function createGrokChat(model: GrokChatModel, config: GrokGatewayConfig): GrokTextAdapter<GrokChatModel>;
|
|
14
15
|
/**
|
|
15
16
|
* Creates a Grok image adapter which uses Cloudflare AI Gateway.
|
|
16
17
|
* Supports both binding and credential-based configurations.
|
|
@@ -20,7 +21,7 @@ declare function createGrokImage(model: GrokImageModel, config: GrokGatewayConfi
|
|
|
20
21
|
* Creates a Grok summarize adapter which uses Cloudflare AI Gateway.
|
|
21
22
|
* Supports both binding and credential-based configurations.
|
|
22
23
|
*/
|
|
23
|
-
declare function createGrokSummarize(model: GrokSummarizeModel, config: GrokGatewayConfig):
|
|
24
|
+
declare function createGrokSummarize(model: GrokSummarizeModel, config: GrokGatewayConfig): AnySummarizeAdapter;
|
|
24
25
|
//#endregion
|
|
25
26
|
export { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, type GrokChatModel, GrokGatewayConfig, type GrokImageModel, type GrokSummarizeModel, createGrokChat, createGrokImage, createGrokSummarize };
|
|
26
27
|
//# sourceMappingURL=grok.d.cts.map
|
package/dist/adapters/grok.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as AiGatewayAdapterConfig } from "../create-fetcher-
|
|
2
|
-
import { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, GrokChatModel, GrokImageAdapter, GrokImageModel,
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-Bp5yCNaO.mjs";
|
|
2
|
+
import { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, GrokChatModel, GrokImageAdapter, GrokImageModel, GrokSummarizeModel, GrokTextAdapter } from "@tanstack/ai-grok";
|
|
3
|
+
import { AnySummarizeAdapter } from "@tanstack/ai";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/grok.d.ts
|
|
5
6
|
type GrokGatewayConfig = AiGatewayAdapterConfig;
|
|
@@ -10,7 +11,7 @@ type GrokGatewayConfig = AiGatewayAdapterConfig;
|
|
|
10
11
|
* Since GrokTextConfig extends the OpenAI SDK's ClientOptions,
|
|
11
12
|
* we can inject the gateway fetch directly — no subclassing needed.
|
|
12
13
|
*/
|
|
13
|
-
declare function createGrokChat(model: GrokChatModel, config: GrokGatewayConfig): GrokTextAdapter<
|
|
14
|
+
declare function createGrokChat(model: GrokChatModel, config: GrokGatewayConfig): GrokTextAdapter<GrokChatModel>;
|
|
14
15
|
/**
|
|
15
16
|
* Creates a Grok image adapter which uses Cloudflare AI Gateway.
|
|
16
17
|
* Supports both binding and credential-based configurations.
|
|
@@ -20,7 +21,7 @@ declare function createGrokImage(model: GrokImageModel, config: GrokGatewayConfi
|
|
|
20
21
|
* Creates a Grok summarize adapter which uses Cloudflare AI Gateway.
|
|
21
22
|
* Supports both binding and credential-based configurations.
|
|
22
23
|
*/
|
|
23
|
-
declare function createGrokSummarize(model: GrokSummarizeModel, config: GrokGatewayConfig):
|
|
24
|
+
declare function createGrokSummarize(model: GrokSummarizeModel, config: GrokGatewayConfig): AnySummarizeAdapter;
|
|
24
25
|
//#endregion
|
|
25
26
|
export { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, type GrokChatModel, GrokGatewayConfig, type GrokImageModel, type GrokSummarizeModel, createGrokChat, createGrokImage, createGrokSummarize };
|
|
26
27
|
//# sourceMappingURL=grok.d.mts.map
|
package/dist/adapters/grok.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createGatewayFetch } from "../create-fetcher-
|
|
2
|
-
import { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, GrokImageAdapter,
|
|
1
|
+
import { t as createGatewayFetch } from "../create-fetcher-BnSnCaHf.mjs";
|
|
2
|
+
import { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, GrokImageAdapter, GrokTextAdapter, createGrokSummarize as createGrokSummarize$1 } from "@tanstack/ai-grok";
|
|
3
3
|
//#region src/adapters/grok.ts
|
|
4
4
|
/**
|
|
5
5
|
* Creates a Grok chat adapter which uses Cloudflare AI Gateway.
|
|
@@ -29,10 +29,7 @@ function createGrokImage(model, config) {
|
|
|
29
29
|
* Supports both binding and credential-based configurations.
|
|
30
30
|
*/
|
|
31
31
|
function createGrokSummarize(model, config) {
|
|
32
|
-
return
|
|
33
|
-
apiKey: config.apiKey ?? "unused",
|
|
34
|
-
fetch: createGatewayFetch("grok", config)
|
|
35
|
-
}, model);
|
|
32
|
+
return createGrokSummarize$1(model, config.apiKey ?? "unused", { fetch: createGatewayFetch("grok", config) });
|
|
36
33
|
}
|
|
37
34
|
//#endregion
|
|
38
35
|
export { GROK_CHAT_MODELS, GROK_IMAGE_MODELS, createGrokChat, createGrokImage, createGrokSummarize };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grok.mjs","names":[],"sources":["../../src/adapters/grok.ts"],"sourcesContent":["import {\n\tGrokTextAdapter,\n\tGrokImageAdapter,\n\
|
|
1
|
+
{"version":3,"file":"grok.mjs","names":["createGrokSummarizeAdapter"],"sources":["../../src/adapters/grok.ts"],"sourcesContent":["import {\n\tGrokTextAdapter,\n\tGrokImageAdapter,\n\tcreateGrokSummarize as createGrokSummarizeAdapter,\n\tGROK_CHAT_MODELS,\n\tGROK_IMAGE_MODELS,\n\ttype GrokChatModel,\n\ttype GrokImageModel,\n\ttype GrokSummarizeModel,\n} from \"@tanstack/ai-grok\";\nimport { createGatewayFetch, type AiGatewayAdapterConfig } from \"../utils/create-fetcher\";\nimport type { AnySummarizeAdapter } from \"@tanstack/ai\";\n\nexport type GrokGatewayConfig = AiGatewayAdapterConfig;\n\n/**\n * Creates a Grok chat adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n *\n * Since GrokTextConfig extends the OpenAI SDK's ClientOptions,\n * we can inject the gateway fetch directly — no subclassing needed.\n */\nexport function createGrokChat(\n\tmodel: GrokChatModel,\n\tconfig: GrokGatewayConfig,\n): GrokTextAdapter<GrokChatModel> {\n\treturn new GrokTextAdapter(\n\t\t{\n\t\t\tapiKey: config.apiKey ?? \"unused\",\n\t\t\tfetch: createGatewayFetch(\"grok\", config),\n\t\t},\n\t\tmodel,\n\t);\n}\n\n/**\n * Creates a Grok image adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n */\nexport function createGrokImage(model: GrokImageModel, config: GrokGatewayConfig) {\n\treturn new GrokImageAdapter(\n\t\t{\n\t\t\tapiKey: config.apiKey ?? \"unused\",\n\t\t\tfetch: createGatewayFetch(\"grok\", config),\n\t\t},\n\t\tmodel,\n\t);\n}\n\n/**\n * Creates a Grok summarize adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n */\nexport function createGrokSummarize(\n\tmodel: GrokSummarizeModel,\n\tconfig: GrokGatewayConfig,\n): AnySummarizeAdapter {\n\treturn createGrokSummarizeAdapter(model, config.apiKey ?? \"unused\", {\n\t\tfetch: createGatewayFetch(\"grok\", config),\n\t});\n}\n\nexport {\n\tGROK_CHAT_MODELS,\n\tGROK_IMAGE_MODELS,\n\ttype GrokChatModel,\n\ttype GrokImageModel,\n\ttype GrokSummarizeModel,\n};\n"],"mappings":";;;;;;;;;;AAsBA,SAAgB,eACf,OACA,QACiC;CACjC,OAAO,IAAI,gBACV;EACC,QAAQ,OAAO,UAAU;EACzB,OAAO,mBAAmB,QAAQ,MAAM;CACzC,GACA,KACD;AACD;;;;;AAMA,SAAgB,gBAAgB,OAAuB,QAA2B;CACjF,OAAO,IAAI,iBACV;EACC,QAAQ,OAAO,UAAU;EACzB,OAAO,mBAAmB,QAAQ,MAAM;CACzC,GACA,KACD;AACD;;;;;AAMA,SAAgB,oBACf,OACA,QACsB;CACtB,OAAOA,sBAA2B,OAAO,OAAO,UAAU,UAAU,EACnE,OAAO,mBAAmB,QAAQ,MAAM,EACzC,CAAC;AACF"}
|
package/dist/adapters/openai.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../
|
|
3
|
-
const require_create_fetcher = require("../create-fetcher-By-hTiT9.cjs");
|
|
2
|
+
const require_create_fetcher = require("../create-fetcher-YVxWCTVL.cjs");
|
|
4
3
|
let _tanstack_ai_openai = require("@tanstack/ai-openai");
|
|
5
4
|
//#region src/adapters/openai.ts
|
|
6
5
|
/**
|
|
@@ -28,7 +27,7 @@ function createOpenAiChat(model, config) {
|
|
|
28
27
|
* @param config Configuration options
|
|
29
28
|
*/
|
|
30
29
|
function createOpenAiSummarize(model, config) {
|
|
31
|
-
return
|
|
30
|
+
return (0, _tanstack_ai_openai.createOpenaiSummarize)(model, config.apiKey ?? "unused", { fetch: require_create_fetcher.createGatewayFetch("openai", config) });
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
33
|
* Creates an OpenAI image adapter which uses Cloudflare AI Gateway.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.cjs","names":["createGatewayFetch","OpenAITextAdapter","
|
|
1
|
+
{"version":3,"file":"openai.cjs","names":["createGatewayFetch","OpenAITextAdapter","OpenAIImageAdapter","OpenAITranscriptionAdapter","OpenAITTSAdapter","OpenAIVideoAdapter"],"sources":["../../src/adapters/openai.ts"],"sourcesContent":["import {\n\tcreateOpenaiSummarize,\n\tOpenAIImageAdapter,\n\tOpenAITextAdapter,\n\tOpenAITranscriptionAdapter,\n\tOpenAITTSAdapter,\n\tOpenAIVideoAdapter,\n\tOPENAI_CHAT_MODELS,\n\tOPENAI_IMAGE_MODELS,\n\tOPENAI_TRANSCRIPTION_MODELS,\n\tOPENAI_TTS_MODELS,\n\tOPENAI_VIDEO_MODELS,\n\ttype OpenAIChatModel,\n\ttype OpenAIImageModel,\n\ttype OpenAITranscriptionModel,\n\ttype OpenAITTSModel,\n\ttype OpenAIVideoModel,\n} from \"@tanstack/ai-openai\";\nimport { createGatewayFetch, type AiGatewayAdapterConfig } from \"../utils/create-fetcher\";\nimport type { AnySummarizeAdapter } from \"@tanstack/ai\";\n\nexport type OpenAiGatewayConfig = AiGatewayAdapterConfig;\n\n/**\n * Builds an OpenAI-compatible config that injects the gateway fetch.\n * OpenAITextConfig extends OpenAI SDK's ClientOptions, which supports a `fetch` parameter.\n */\nfunction buildOpenAiConfig(provider: string, config: OpenAiGatewayConfig) {\n\treturn {\n\t\tapiKey: config.apiKey ?? \"unused\",\n\t\tfetch: createGatewayFetch(provider, config),\n\t};\n}\n\n/**\n * Creates an OpenAI chat adapter which uses Cloudflare AI Gateway.\n * Supports both binding and credential-based configurations.\n * @param model The OpenAI model to use\n * @param config Configuration options\n */\nexport function createOpenAiChat(\n\tmodel: OpenAIChatModel,\n\tconfig: OpenAiGatewayConfig,\n): OpenAITextAdapter<OpenAIChatModel> {\n\treturn new OpenAITextAdapter(buildOpenAiConfig(\"openai\", config), model);\n}\n\n/**\n * Creates an OpenAI summarize adapter which uses Cloudflare AI Gateway.\n * @param model The OpenAI model to use\n * @param config Configuration options\n */\nexport function createOpenAiSummarize(\n\tmodel: OpenAIChatModel,\n\tconfig: OpenAiGatewayConfig,\n): AnySummarizeAdapter {\n\treturn createOpenaiSummarize(model, config.apiKey ?? \"unused\", {\n\t\tfetch: createGatewayFetch(\"openai\", config),\n\t});\n}\n\n/**\n * Creates an OpenAI image adapter which uses Cloudflare AI Gateway.\n * @param model The OpenAI image model to use\n * @param config Configuration options\n */\nexport function createOpenAiImage(model: OpenAIImageModel, config: OpenAiGatewayConfig) {\n\treturn new OpenAIImageAdapter(buildOpenAiConfig(\"openai\", config), model);\n}\n\n/**\n * Creates an OpenAI transcription adapter which uses Cloudflare AI Gateway.\n * @param model The OpenAI transcription model to use\n * @param config Configuration options\n */\nexport function createOpenAiTranscription(\n\tmodel: OpenAITranscriptionModel,\n\tconfig: OpenAiGatewayConfig,\n) {\n\treturn new OpenAITranscriptionAdapter(buildOpenAiConfig(\"openai\", config), model);\n}\n\n/**\n * Creates an OpenAI TTS adapter which uses Cloudflare AI Gateway.\n * @param model The OpenAI TTS model to use\n * @param config Configuration options\n */\nexport function createOpenAiTts(model: OpenAITTSModel, config: OpenAiGatewayConfig) {\n\treturn new OpenAITTSAdapter(buildOpenAiConfig(\"openai\", config), model);\n}\n\n/**\n * Creates an OpenAI video adapter which uses Cloudflare AI Gateway.\n * @param model The OpenAI video model to use\n * @param config Configuration options\n */\nexport function createOpenAiVideo(model: OpenAIVideoModel, config: OpenAiGatewayConfig) {\n\treturn new OpenAIVideoAdapter(buildOpenAiConfig(\"openai\", config), model);\n}\n\nexport {\n\tOPENAI_CHAT_MODELS,\n\tOPENAI_IMAGE_MODELS,\n\tOPENAI_TRANSCRIPTION_MODELS,\n\tOPENAI_TTS_MODELS,\n\tOPENAI_VIDEO_MODELS,\n\ttype OpenAIChatModel,\n\ttype OpenAIImageModel,\n\ttype OpenAITranscriptionModel,\n\ttype OpenAITTSModel,\n\ttype OpenAIVideoModel,\n};\n"],"mappings":";;;;;;;;AA2BA,SAAS,kBAAkB,UAAkB,QAA6B;CACzE,OAAO;EACN,QAAQ,OAAO,UAAU;EACzB,OAAOA,uBAAAA,mBAAmB,UAAU,MAAM;CAC3C;AACD;;;;;;;AAQA,SAAgB,iBACf,OACA,QACqC;CACrC,OAAO,IAAIC,oBAAAA,kBAAkB,kBAAkB,UAAU,MAAM,GAAG,KAAK;AACxE;;;;;;AAOA,SAAgB,sBACf,OACA,QACsB;CACtB,QAAA,GAAA,oBAAA,sBAAA,CAA6B,OAAO,OAAO,UAAU,UAAU,EAC9D,OAAOD,uBAAAA,mBAAmB,UAAU,MAAM,EAC3C,CAAC;AACF;;;;;;AAOA,SAAgB,kBAAkB,OAAyB,QAA6B;CACvF,OAAO,IAAIE,oBAAAA,mBAAmB,kBAAkB,UAAU,MAAM,GAAG,KAAK;AACzE;;;;;;AAOA,SAAgB,0BACf,OACA,QACC;CACD,OAAO,IAAIC,oBAAAA,2BAA2B,kBAAkB,UAAU,MAAM,GAAG,KAAK;AACjF;;;;;;AAOA,SAAgB,gBAAgB,OAAuB,QAA6B;CACnF,OAAO,IAAIC,oBAAAA,iBAAiB,kBAAkB,UAAU,MAAM,GAAG,KAAK;AACvE;;;;;;AAOA,SAAgB,kBAAkB,OAAyB,QAA6B;CACvF,OAAO,IAAIC,oBAAAA,mBAAmB,kBAAkB,UAAU,MAAM,GAAG,KAAK;AACzE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as AiGatewayAdapterConfig } from "../create-fetcher-
|
|
2
|
-
import {
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-Bp5yCNaO.cjs";
|
|
2
|
+
import { AnySummarizeAdapter } from "@tanstack/ai";
|
|
3
|
+
import { OPENAI_CHAT_MODELS, OPENAI_IMAGE_MODELS, OPENAI_TRANSCRIPTION_MODELS, OPENAI_TTS_MODELS, OPENAI_VIDEO_MODELS, OpenAIChatModel, OpenAIImageAdapter, OpenAIImageModel, OpenAITTSAdapter, OpenAITTSModel, OpenAITextAdapter, OpenAITranscriptionAdapter, OpenAITranscriptionModel, OpenAIVideoAdapter, OpenAIVideoModel } from "@tanstack/ai-openai";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/openai.d.ts
|
|
5
6
|
type OpenAiGatewayConfig = AiGatewayAdapterConfig;
|
|
@@ -9,19 +10,19 @@ type OpenAiGatewayConfig = AiGatewayAdapterConfig;
|
|
|
9
10
|
* @param model The OpenAI model to use
|
|
10
11
|
* @param config Configuration options
|
|
11
12
|
*/
|
|
12
|
-
declare function createOpenAiChat(model: OpenAIChatModel, config: OpenAiGatewayConfig): OpenAITextAdapter<
|
|
13
|
+
declare function createOpenAiChat(model: OpenAIChatModel, config: OpenAiGatewayConfig): OpenAITextAdapter<OpenAIChatModel>;
|
|
13
14
|
/**
|
|
14
15
|
* Creates an OpenAI summarize adapter which uses Cloudflare AI Gateway.
|
|
15
16
|
* @param model The OpenAI model to use
|
|
16
17
|
* @param config Configuration options
|
|
17
18
|
*/
|
|
18
|
-
declare function createOpenAiSummarize(model: OpenAIChatModel, config: OpenAiGatewayConfig):
|
|
19
|
+
declare function createOpenAiSummarize(model: OpenAIChatModel, config: OpenAiGatewayConfig): AnySummarizeAdapter;
|
|
19
20
|
/**
|
|
20
21
|
* Creates an OpenAI image adapter which uses Cloudflare AI Gateway.
|
|
21
22
|
* @param model The OpenAI image model to use
|
|
22
23
|
* @param config Configuration options
|
|
23
24
|
*/
|
|
24
|
-
declare function createOpenAiImage(model: OpenAIImageModel, config: OpenAiGatewayConfig): OpenAIImageAdapter<"gpt-image-1" | "gpt-image-1-mini" | "dall-e-3" | "dall-e-2">;
|
|
25
|
+
declare function createOpenAiImage(model: OpenAIImageModel, config: OpenAiGatewayConfig): OpenAIImageAdapter<"gpt-image-2" | "gpt-image-1" | "gpt-image-1-mini" | "dall-e-3" | "dall-e-2">;
|
|
25
26
|
/**
|
|
26
27
|
* Creates an OpenAI transcription adapter which uses Cloudflare AI Gateway.
|
|
27
28
|
* @param model The OpenAI transcription model to use
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as AiGatewayAdapterConfig } from "../create-fetcher-
|
|
2
|
-
import { OPENAI_CHAT_MODELS, OPENAI_IMAGE_MODELS, OPENAI_TRANSCRIPTION_MODELS, OPENAI_TTS_MODELS, OPENAI_VIDEO_MODELS, OpenAIChatModel, OpenAIImageAdapter, OpenAIImageModel,
|
|
1
|
+
import { t as AiGatewayAdapterConfig } from "../create-fetcher-Bp5yCNaO.mjs";
|
|
2
|
+
import { OPENAI_CHAT_MODELS, OPENAI_IMAGE_MODELS, OPENAI_TRANSCRIPTION_MODELS, OPENAI_TTS_MODELS, OPENAI_VIDEO_MODELS, OpenAIChatModel, OpenAIImageAdapter, OpenAIImageModel, OpenAITTSAdapter, OpenAITTSModel, OpenAITextAdapter, OpenAITranscriptionAdapter, OpenAITranscriptionModel, OpenAIVideoAdapter, OpenAIVideoModel } from "@tanstack/ai-openai";
|
|
3
|
+
import { AnySummarizeAdapter } from "@tanstack/ai";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/openai.d.ts
|
|
5
6
|
type OpenAiGatewayConfig = AiGatewayAdapterConfig;
|
|
@@ -9,19 +10,19 @@ type OpenAiGatewayConfig = AiGatewayAdapterConfig;
|
|
|
9
10
|
* @param model The OpenAI model to use
|
|
10
11
|
* @param config Configuration options
|
|
11
12
|
*/
|
|
12
|
-
declare function createOpenAiChat(model: OpenAIChatModel, config: OpenAiGatewayConfig): OpenAITextAdapter<
|
|
13
|
+
declare function createOpenAiChat(model: OpenAIChatModel, config: OpenAiGatewayConfig): OpenAITextAdapter<OpenAIChatModel>;
|
|
13
14
|
/**
|
|
14
15
|
* Creates an OpenAI summarize adapter which uses Cloudflare AI Gateway.
|
|
15
16
|
* @param model The OpenAI model to use
|
|
16
17
|
* @param config Configuration options
|
|
17
18
|
*/
|
|
18
|
-
declare function createOpenAiSummarize(model: OpenAIChatModel, config: OpenAiGatewayConfig):
|
|
19
|
+
declare function createOpenAiSummarize(model: OpenAIChatModel, config: OpenAiGatewayConfig): AnySummarizeAdapter;
|
|
19
20
|
/**
|
|
20
21
|
* Creates an OpenAI image adapter which uses Cloudflare AI Gateway.
|
|
21
22
|
* @param model The OpenAI image model to use
|
|
22
23
|
* @param config Configuration options
|
|
23
24
|
*/
|
|
24
|
-
declare function createOpenAiImage(model: OpenAIImageModel, config: OpenAiGatewayConfig): OpenAIImageAdapter<"gpt-image-1" | "gpt-image-1-mini" | "dall-e-3" | "dall-e-2">;
|
|
25
|
+
declare function createOpenAiImage(model: OpenAIImageModel, config: OpenAiGatewayConfig): OpenAIImageAdapter<"gpt-image-2" | "gpt-image-1" | "gpt-image-1-mini" | "dall-e-3" | "dall-e-2">;
|
|
25
26
|
/**
|
|
26
27
|
* Creates an OpenAI transcription adapter which uses Cloudflare AI Gateway.
|
|
27
28
|
* @param model The OpenAI transcription model to use
|