@gedatou/cadenza-ai 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/anthropic-DdrANeO1.mjs +236 -0
- package/dist/bedrock-534H9yfk.mjs +75 -0
- package/dist/catalog-CvvS2JaW.mjs +32 -0
- package/dist/deepseek-C1b74T2F.mjs +55 -0
- package/dist/gemini-DcJ5Kr3h.mjs +229 -0
- package/dist/grok-CffQuBd6.mjs +77 -0
- package/dist/groq-Ba6TTYLp.mjs +98 -0
- package/dist/index.d.mts +1056 -0
- package/dist/index.mjs +2809 -0
- package/dist/llmgateway-Pt5CS6aQ.mjs +211 -0
- package/dist/mistral-BGMwwbU9.mjs +107 -0
- package/dist/mock/index.d.mts +168 -0
- package/dist/mock/index.mjs +467 -0
- package/dist/ollama-BBJs-3mK.mjs +80 -0
- package/dist/openai--FIeahIH.mjs +153 -0
- package/dist/openrouter-q-lx-2Cb.mjs +167 -0
- package/dist/preset-CEyIPxfS.mjs +157 -0
- package/dist/preset-DRT0T14q.d.mts +19 -0
- package/dist/providers/anthropic.d.mts +6 -0
- package/dist/providers/anthropic.mjs +11 -0
- package/dist/providers/bedrock.d.mts +6 -0
- package/dist/providers/bedrock.mjs +11 -0
- package/dist/providers/byteplus.d.mts +6 -0
- package/dist/providers/byteplus.mjs +21 -0
- package/dist/providers/deepseek.d.mts +35 -0
- package/dist/providers/deepseek.mjs +283 -0
- package/dist/providers/gemini.d.mts +6 -0
- package/dist/providers/gemini.mjs +11 -0
- package/dist/providers/grok.d.mts +6 -0
- package/dist/providers/grok.mjs +11 -0
- package/dist/providers/groq.d.mts +6 -0
- package/dist/providers/groq.mjs +11 -0
- package/dist/providers/llmgateway.d.mts +6 -0
- package/dist/providers/llmgateway.mjs +11 -0
- package/dist/providers/mistral.d.mts +6 -0
- package/dist/providers/mistral.mjs +11 -0
- package/dist/providers/ollama.d.mts +9 -0
- package/dist/providers/ollama.mjs +28 -0
- package/dist/providers/openai-compatible.d.mts +32 -0
- package/dist/providers/openai-compatible.mjs +45 -0
- package/dist/providers/openai.d.mts +6 -0
- package/dist/providers/openai.mjs +11 -0
- package/dist/providers/openrouter.d.mts +6 -0
- package/dist/providers/openrouter.mjs +11 -0
- package/dist/providers/vercel-gateway.d.mts +6 -0
- package/dist/providers/vercel-gateway.mjs +11 -0
- package/dist/providers/vertex.d.mts +6 -0
- package/dist/providers/vertex.mjs +11 -0
- package/dist/server/index.d.mts +173 -0
- package/dist/server/index.mjs +440 -0
- package/dist/thinking-CH2uL1dr.mjs +26 -0
- package/dist/types-56Hn7Qq2.d.mts +46 -0
- package/dist/vercel-gateway-DW3Z0Os1.mjs +109 -0
- package/dist/vertex-hg4Dt54O.mjs +20 -0
- package/package.json +114 -0
- package/styles.css +3 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { defineByokProvider } from "@tanstack/ai/byok";
|
|
2
|
+
//#region src/catalog/providers/openrouter.ts
|
|
3
|
+
const openrouter = {
|
|
4
|
+
id: "openrouter",
|
|
5
|
+
label: "OpenRouter",
|
|
6
|
+
byok: defineByokProvider({
|
|
7
|
+
id: "openrouter",
|
|
8
|
+
label: "OpenRouter",
|
|
9
|
+
env: "OPENROUTER_API_KEY"
|
|
10
|
+
}),
|
|
11
|
+
keyRequired: true,
|
|
12
|
+
runtime: "node",
|
|
13
|
+
models: [
|
|
14
|
+
{
|
|
15
|
+
id: "openai/gpt-5.2",
|
|
16
|
+
name: "OpenAI: GPT-5.2",
|
|
17
|
+
provider: "openrouter",
|
|
18
|
+
input: [
|
|
19
|
+
"document",
|
|
20
|
+
"image",
|
|
21
|
+
"text"
|
|
22
|
+
],
|
|
23
|
+
reasoning: true,
|
|
24
|
+
contextWindow: 4e5,
|
|
25
|
+
maxOutputTokens: 128e3,
|
|
26
|
+
cost: {
|
|
27
|
+
input: 1.75,
|
|
28
|
+
output: 14,
|
|
29
|
+
cacheRead: .175
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "anthropic/claude-sonnet-5",
|
|
34
|
+
name: "Anthropic: Claude Sonnet 5",
|
|
35
|
+
provider: "openrouter",
|
|
36
|
+
input: [
|
|
37
|
+
"text",
|
|
38
|
+
"image",
|
|
39
|
+
"document"
|
|
40
|
+
],
|
|
41
|
+
reasoning: true,
|
|
42
|
+
contextWindow: 1e6,
|
|
43
|
+
maxOutputTokens: 128e3,
|
|
44
|
+
cost: {
|
|
45
|
+
input: 2,
|
|
46
|
+
output: 10
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "google/gemini-3.5-flash",
|
|
51
|
+
name: "Google: Gemini 3.5 Flash",
|
|
52
|
+
provider: "openrouter",
|
|
53
|
+
input: [
|
|
54
|
+
"text",
|
|
55
|
+
"image",
|
|
56
|
+
"video",
|
|
57
|
+
"document",
|
|
58
|
+
"audio"
|
|
59
|
+
],
|
|
60
|
+
reasoning: true,
|
|
61
|
+
contextWindow: 1048576,
|
|
62
|
+
maxOutputTokens: 65536,
|
|
63
|
+
cost: {
|
|
64
|
+
input: 1.5,
|
|
65
|
+
output: 9,
|
|
66
|
+
cacheRead: .2333333333
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "x-ai/grok-4.5",
|
|
71
|
+
name: "xAI: Grok 4.5",
|
|
72
|
+
provider: "openrouter",
|
|
73
|
+
input: [
|
|
74
|
+
"text",
|
|
75
|
+
"image",
|
|
76
|
+
"document"
|
|
77
|
+
],
|
|
78
|
+
reasoning: true,
|
|
79
|
+
contextWindow: 5e5,
|
|
80
|
+
cost: {
|
|
81
|
+
input: 2,
|
|
82
|
+
output: 6,
|
|
83
|
+
cacheRead: .3
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "deepseek/deepseek-v4-pro",
|
|
88
|
+
name: "DeepSeek: DeepSeek V4 Pro",
|
|
89
|
+
provider: "openrouter",
|
|
90
|
+
input: ["text"],
|
|
91
|
+
reasoning: true,
|
|
92
|
+
contextWindow: 1048576,
|
|
93
|
+
maxOutputTokens: 384e3,
|
|
94
|
+
cost: {
|
|
95
|
+
input: .790308,
|
|
96
|
+
output: 1.580616,
|
|
97
|
+
cacheRead: .065859
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "qwen/qwen3-max",
|
|
102
|
+
name: "Qwen: Qwen3 Max",
|
|
103
|
+
provider: "openrouter",
|
|
104
|
+
input: ["text"],
|
|
105
|
+
reasoning: false,
|
|
106
|
+
contextWindow: 262144,
|
|
107
|
+
maxOutputTokens: 65536,
|
|
108
|
+
cost: {
|
|
109
|
+
input: .78,
|
|
110
|
+
output: 3.9
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "meta-llama/llama-4-maverick",
|
|
115
|
+
name: "Meta: Llama 4 Maverick",
|
|
116
|
+
provider: "openrouter",
|
|
117
|
+
input: ["text", "image"],
|
|
118
|
+
reasoning: false,
|
|
119
|
+
contextWindow: 1048576,
|
|
120
|
+
maxOutputTokens: 16384,
|
|
121
|
+
cost: {
|
|
122
|
+
input: .2,
|
|
123
|
+
output: .8
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "mistralai/mistral-large",
|
|
128
|
+
name: "Mistral Large",
|
|
129
|
+
provider: "openrouter",
|
|
130
|
+
input: ["text", "document"],
|
|
131
|
+
reasoning: false,
|
|
132
|
+
contextWindow: 128e3,
|
|
133
|
+
cost: {
|
|
134
|
+
input: 2,
|
|
135
|
+
output: 6,
|
|
136
|
+
cacheRead: .2
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "moonshotai/kimi-k3",
|
|
141
|
+
name: "MoonshotAI: Kimi K3",
|
|
142
|
+
provider: "openrouter",
|
|
143
|
+
input: [
|
|
144
|
+
"text",
|
|
145
|
+
"image",
|
|
146
|
+
"video"
|
|
147
|
+
],
|
|
148
|
+
reasoning: true,
|
|
149
|
+
contextWindow: 1048576,
|
|
150
|
+
maxOutputTokens: 1048576,
|
|
151
|
+
cost: {
|
|
152
|
+
input: 3,
|
|
153
|
+
output: 15,
|
|
154
|
+
cacheRead: .3
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "openrouter/auto",
|
|
159
|
+
name: "OpenRouter: Auto",
|
|
160
|
+
provider: "openrouter",
|
|
161
|
+
input: ["text"],
|
|
162
|
+
reasoning: false
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
167
|
+
export { openrouter as t };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { n as clampThinkingLevel } from "./thinking-CH2uL1dr.mjs";
|
|
2
|
+
//#region src/server/thinking.ts
|
|
3
|
+
/** 三档 effort 的 provider(grok / groq / vercel-gateway / ollama gpt-oss)共用的折叠表。 */
|
|
4
|
+
const EFFORT_3 = {
|
|
5
|
+
minimal: "low",
|
|
6
|
+
low: "low",
|
|
7
|
+
medium: "medium",
|
|
8
|
+
high: "high",
|
|
9
|
+
xhigh: "high",
|
|
10
|
+
max: "high"
|
|
11
|
+
};
|
|
12
|
+
/** clamp 到模型支持的档位后再交给 preset;非推理模型关着时不发任何片段。 */
|
|
13
|
+
function resolveThinking(preset, model, level) {
|
|
14
|
+
const clamped = clampThinkingLevel(model, level);
|
|
15
|
+
if (clamped === "off" && !model.reasoning) return {};
|
|
16
|
+
return preset.thinking(clamped, model);
|
|
17
|
+
}
|
|
18
|
+
function openaiThinking(level, model) {
|
|
19
|
+
if (!model.reasoning) return {};
|
|
20
|
+
if (level === "off") return { reasoning: { effort: "none" } };
|
|
21
|
+
return { reasoning: {
|
|
22
|
+
effort: level === "minimal" ? "minimal" : level === "xhigh" || level === "max" ? "high" : level,
|
|
23
|
+
summary: "auto"
|
|
24
|
+
} };
|
|
25
|
+
}
|
|
26
|
+
const ANTHROPIC_BUDGET = {
|
|
27
|
+
minimal: 1024,
|
|
28
|
+
low: 4096,
|
|
29
|
+
medium: 16e3,
|
|
30
|
+
high: 32e3,
|
|
31
|
+
xhigh: 48e3,
|
|
32
|
+
max: 64e3
|
|
33
|
+
};
|
|
34
|
+
/** adaptive + `output_config.effort`(AnthropicAdaptiveOrDisabled / AdaptiveOnly + OutputConfig)。 */
|
|
35
|
+
const ANTHROPIC_ADAPTIVE_EFFORT = /* @__PURE__ */ new Set([
|
|
36
|
+
"claude-opus-4-7",
|
|
37
|
+
"claude-opus-4-8",
|
|
38
|
+
"claude-sonnet-5",
|
|
39
|
+
"claude-fable-5"
|
|
40
|
+
]);
|
|
41
|
+
/** adaptive 但无 effort 分级(AnthropicAdaptiveThinkingOptions,4.6 代)。 */
|
|
42
|
+
const ANTHROPIC_ADAPTIVE_ONLY = /* @__PURE__ */ new Set(["claude-opus-4-6", "claude-sonnet-4-6"]);
|
|
43
|
+
/** `thinking:{type:'disabled'}` 会被 400 拒绝的模型(AnthropicAdaptiveOnlyThinkingOptions);off 落到最低档。 */
|
|
44
|
+
const ANTHROPIC_ALWAYS_ON = /* @__PURE__ */ new Set(["claude-fable-5"]);
|
|
45
|
+
function anthropicThinking(level, model) {
|
|
46
|
+
if (ANTHROPIC_ADAPTIVE_EFFORT.has(model.id)) {
|
|
47
|
+
const effective = level === "off" && ANTHROPIC_ALWAYS_ON.has(model.id) ? "low" : level;
|
|
48
|
+
if (effective === "off") return { thinking: { type: "disabled" } };
|
|
49
|
+
return {
|
|
50
|
+
thinking: {
|
|
51
|
+
type: "adaptive",
|
|
52
|
+
display: "summarized"
|
|
53
|
+
},
|
|
54
|
+
output_config: { effort: effective === "minimal" ? "low" : effective }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (ANTHROPIC_ADAPTIVE_ONLY.has(model.id)) return level === "off" ? { thinking: { type: "disabled" } } : { thinking: {
|
|
58
|
+
type: "adaptive",
|
|
59
|
+
display: "summarized"
|
|
60
|
+
} };
|
|
61
|
+
if (level === "off") return { thinking: { type: "disabled" } };
|
|
62
|
+
return { thinking: {
|
|
63
|
+
type: "enabled",
|
|
64
|
+
budget_tokens: ANTHROPIC_BUDGET[level]
|
|
65
|
+
} };
|
|
66
|
+
}
|
|
67
|
+
const GEMINI_LEVEL = {
|
|
68
|
+
minimal: "MINIMAL",
|
|
69
|
+
low: "LOW",
|
|
70
|
+
medium: "MEDIUM",
|
|
71
|
+
high: "HIGH",
|
|
72
|
+
xhigh: "HIGH",
|
|
73
|
+
max: "HIGH"
|
|
74
|
+
};
|
|
75
|
+
const GEMINI_BUDGET = {
|
|
76
|
+
minimal: 1024,
|
|
77
|
+
low: 4096,
|
|
78
|
+
medium: 8192,
|
|
79
|
+
high: 16384,
|
|
80
|
+
xhigh: 20480,
|
|
81
|
+
max: 24576
|
|
82
|
+
};
|
|
83
|
+
function geminiThinking(level, model) {
|
|
84
|
+
const legacy = model.id.startsWith("gemini-2.");
|
|
85
|
+
if (level === "off") return legacy ? { thinkingConfig: { thinkingBudget: 0 } } : {};
|
|
86
|
+
return legacy ? { thinkingConfig: {
|
|
87
|
+
includeThoughts: true,
|
|
88
|
+
thinkingBudget: GEMINI_BUDGET[level]
|
|
89
|
+
} } : { thinkingConfig: {
|
|
90
|
+
includeThoughts: true,
|
|
91
|
+
thinkingLevel: GEMINI_LEVEL[level]
|
|
92
|
+
} };
|
|
93
|
+
}
|
|
94
|
+
function openrouterThinking(level, _model) {
|
|
95
|
+
return level === "off" ? { reasoning: { enabled: false } } : { reasoning: { effort: level } };
|
|
96
|
+
}
|
|
97
|
+
function grokThinking(level, model) {
|
|
98
|
+
if (model.id.startsWith("grok-build-")) return {};
|
|
99
|
+
return { reasoning: { effort: level === "off" ? "none" : EFFORT_3[level] } };
|
|
100
|
+
}
|
|
101
|
+
function groqThinking(level, model) {
|
|
102
|
+
if (!model.reasoning) return {};
|
|
103
|
+
if (level === "off") return { reasoning_effort: "none" };
|
|
104
|
+
return {
|
|
105
|
+
reasoning_effort: EFFORT_3[level],
|
|
106
|
+
reasoning_format: "parsed"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function vercelGatewayThinking(level, _model) {
|
|
110
|
+
return level === "off" ? {} : {
|
|
111
|
+
reasoning: { effort: EFFORT_3[level] },
|
|
112
|
+
include_reasoning: true
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function llmgatewayThinking(level, _model) {
|
|
116
|
+
return level === "off" ? {} : { reasoning_effort: level };
|
|
117
|
+
}
|
|
118
|
+
function ollamaThinking(level, model) {
|
|
119
|
+
if (level === "off") return { think: false };
|
|
120
|
+
return { think: model.id.startsWith("gpt-oss") ? EFFORT_3[level] : true };
|
|
121
|
+
}
|
|
122
|
+
function openaiCompatibleThinking(level, model) {
|
|
123
|
+
if (!model.reasoning || level === "off") return {};
|
|
124
|
+
return { reasoning_effort: EFFORT_3[level] };
|
|
125
|
+
}
|
|
126
|
+
const DEEPSEEK_EFFORT = {
|
|
127
|
+
minimal: "low",
|
|
128
|
+
low: "low",
|
|
129
|
+
medium: "low",
|
|
130
|
+
high: "high",
|
|
131
|
+
xhigh: "high",
|
|
132
|
+
max: "max"
|
|
133
|
+
};
|
|
134
|
+
function deepseekThinking(level, model) {
|
|
135
|
+
if (!model.reasoning) return {};
|
|
136
|
+
if (level === "off") return { thinking: { type: "disabled" } };
|
|
137
|
+
return {
|
|
138
|
+
thinking: { type: "enabled" },
|
|
139
|
+
reasoning_effort: DEEPSEEK_EFFORT[level]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function deepseekResponsesThinking(level, model) {
|
|
143
|
+
if (!model.reasoning) return {};
|
|
144
|
+
return { reasoning: { effort: level === "off" ? "none" : level } };
|
|
145
|
+
}
|
|
146
|
+
function noThinking(_level, _model) {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/server/preset.ts
|
|
151
|
+
/** 恒等 + 校验 byok slug 与 preset id 一致(客户端头名 `x-byok-<id>` 由 id 生成)。 */
|
|
152
|
+
function definePreset(preset) {
|
|
153
|
+
if (preset.byok && preset.byok.id !== preset.id) throw new Error(`cadenza-ai: preset "${preset.id}" declares a BYOK provider with a different id "${preset.byok.id}".`);
|
|
154
|
+
return preset;
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
export { deepseekThinking as a, groqThinking as c, ollamaThinking as d, openaiCompatibleThinking as f, vercelGatewayThinking as g, resolveThinking as h, deepseekResponsesThinking as i, llmgatewayThinking as l, openrouterThinking as m, EFFORT_3 as n, geminiThinking as o, openaiThinking as p, anthropicThinking as r, grokThinking as s, definePreset as t, noThinking as u };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a as Provider, o as ThinkingLevel, r as Model } from "./types-56Hn7Qq2.mjs";
|
|
2
|
+
import { AnyTextAdapter } from "@tanstack/ai";
|
|
3
|
+
//#region src/server/preset.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 服务端 provider 预设:目录里的纯数据 `Provider` 加上三件只在服务端存在的事——
|
|
6
|
+
* 建 adapter、把归一后的 thinking 档位翻成 provider 私有的 `modelOptions` 片段、
|
|
7
|
+
* (可选)用 key 在线发现模型。
|
|
8
|
+
*/
|
|
9
|
+
interface ProviderPreset extends Provider {
|
|
10
|
+
/** 用 BYOK / env 解析出的 key 建 adapter;`keyRequired: false` 的 provider 会收到 `null`。 */
|
|
11
|
+
create: (model: string, key: string | null) => AnyTextAdapter;
|
|
12
|
+
/** 纯函数:clamp 后的档位 → provider 的 `modelOptions` 片段(真源见 spec 附录 A)。 */
|
|
13
|
+
thinking: (level: ThinkingLevel, model: Model) => Record<string, unknown>;
|
|
14
|
+
discoverModels?: (key: string | null) => Promise<Model[]>;
|
|
15
|
+
}
|
|
16
|
+
/** 恒等 + 校验 byok slug 与 preset id 一致(客户端头名 `x-byok-<id>` 由 id 生成)。 */
|
|
17
|
+
declare function definePreset(preset: ProviderPreset): ProviderPreset;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { definePreset as n, ProviderPreset as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as anthropic$1 } from "../anthropic-DdrANeO1.mjs";
|
|
2
|
+
import { r as anthropicThinking, t as definePreset } from "../preset-CEyIPxfS.mjs";
|
|
3
|
+
import { createAnthropicChat } from "@tanstack/ai-anthropic";
|
|
4
|
+
//#region src/providers/anthropic.ts
|
|
5
|
+
const anthropic = definePreset({
|
|
6
|
+
...anthropic$1,
|
|
7
|
+
create: (model, key) => createAnthropicChat(model, key ?? ""),
|
|
8
|
+
thinking: anthropicThinking
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { anthropic };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as bedrock$1 } from "../bedrock-534H9yfk.mjs";
|
|
2
|
+
import { t as definePreset, u as noThinking } from "../preset-CEyIPxfS.mjs";
|
|
3
|
+
import { createBedrockConverse } from "@tanstack/ai-bedrock";
|
|
4
|
+
//#region src/providers/bedrock.ts
|
|
5
|
+
const bedrock = definePreset({
|
|
6
|
+
...bedrock$1,
|
|
7
|
+
create: (model, key) => createBedrockConverse(model, key ?? ""),
|
|
8
|
+
thinking: noThinking
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { bedrock };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { t as definePreset, u as noThinking } from "../preset-CEyIPxfS.mjs";
|
|
2
|
+
import { defineByokProvider } from "@tanstack/ai/byok";
|
|
3
|
+
//#region src/providers/byteplus.ts
|
|
4
|
+
const byteplus = definePreset({
|
|
5
|
+
id: "byteplus",
|
|
6
|
+
label: "BytePlus",
|
|
7
|
+
byok: defineByokProvider({
|
|
8
|
+
id: "byteplus",
|
|
9
|
+
label: "BytePlus",
|
|
10
|
+
env: ["ARK_API_KEY", "BYTEPLUS_API_KEY"]
|
|
11
|
+
}),
|
|
12
|
+
keyRequired: true,
|
|
13
|
+
runtime: "node",
|
|
14
|
+
models: [],
|
|
15
|
+
create: () => {
|
|
16
|
+
throw new Error("cadenza-ai: install @tanstack/ai-byteplus and define the preset with `definePreset` — the built-in `byteplus` is a placeholder.");
|
|
17
|
+
},
|
|
18
|
+
thinking: noThinking
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { byteplus };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as ProviderPreset } from "../preset-DRT0T14q.mjs";
|
|
2
|
+
import "../server/index.mjs";
|
|
3
|
+
import { AnyTool } from "@tanstack/ai";
|
|
4
|
+
//#region src/providers/deepseek.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* DeepSeek's server-side web search: the model searches, opens and reads pages
|
|
7
|
+
* itself (auto-continuing up to 10 rounds) before answering, and nothing is
|
|
8
|
+
* executed on our side. Only the Responses endpoint has it — Chat Completions
|
|
9
|
+
* still documents `function` as the one tool type.
|
|
10
|
+
*
|
|
11
|
+
* The wire shape is OpenAI's, so this is that factory; DeepSeek ignores the
|
|
12
|
+
* extra `search_context_size` / `user_location` fields it can carry.
|
|
13
|
+
*
|
|
14
|
+
* Hand it to `createChatHandler` through the *function* form of `tools`, so it
|
|
15
|
+
* only ever reaches DeepSeek:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* tools: sel => sel.preset.id === 'deepseek' ? [deepseekWebSearch()] : []
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function deepseekWebSearch(): AnyTool;
|
|
22
|
+
/**
|
|
23
|
+
* DeepSeek speaks three protocols under one host and they are not equal: only
|
|
24
|
+
* `/responses` carries the built-in `web_search` tool, and only there does
|
|
25
|
+
* thinking arrive as the standard `response.reasoning_text.delta` (which the
|
|
26
|
+
* base adapter already parses) instead of Chat Completions'
|
|
27
|
+
* `delta.reasoning_content` (which it ignores, and which forced a hand-written
|
|
28
|
+
* subclass plus `reasoning_content` echo on every assistant turn). So the
|
|
29
|
+
* preset is the compatible one over `/responses`, with the adapter swapped for
|
|
30
|
+
* the tool-converter fix above. The `openai` client is borrowed from the
|
|
31
|
+
* compatible factory: this package cannot resolve the SDK itself.
|
|
32
|
+
*/
|
|
33
|
+
declare const deepseek: ProviderPreset;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { deepseek, deepseekWebSearch };
|