@loomwork/llm 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +80 -2
- package/dist/assembleStream.d.ts +95 -0
- package/dist/assembleStream.d.ts.map +1 -0
- package/dist/assembleStream.js +180 -0
- package/dist/assembleStream.js.map +1 -0
- package/dist/capabilities.d.ts +43 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +77 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/createLlmEffect.d.ts +110 -0
- package/dist/createLlmEffect.d.ts.map +1 -0
- package/dist/createLlmEffect.js +177 -0
- package/dist/createLlmEffect.js.map +1 -0
- package/dist/errors.d.ts +96 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +280 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/parts.d.ts +220 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +231 -0
- package/dist/parts.js.map +1 -0
- package/dist/providers/AnthropicProvider.d.ts +53 -0
- package/dist/providers/AnthropicProvider.d.ts.map +1 -0
- package/dist/providers/AnthropicProvider.js +443 -0
- package/dist/providers/AnthropicProvider.js.map +1 -0
- package/dist/providers/GeminiProvider.d.ts +66 -0
- package/dist/providers/GeminiProvider.d.ts.map +1 -0
- package/dist/providers/GeminiProvider.js +281 -0
- package/dist/providers/GeminiProvider.js.map +1 -0
- package/dist/providers/OpenAiProvider.d.ts +56 -0
- package/dist/providers/OpenAiProvider.d.ts.map +1 -0
- package/dist/providers/OpenAiProvider.js +402 -0
- package/dist/providers/OpenAiProvider.js.map +1 -0
- package/dist/providers/extraHeaders.d.ts +7 -0
- package/dist/providers/extraHeaders.d.ts.map +1 -0
- package/dist/providers/extraHeaders.js +40 -0
- package/dist/providers/extraHeaders.js.map +1 -0
- package/dist/providers/systemPrompt.d.ts +10 -0
- package/dist/providers/systemPrompt.d.ts.map +1 -0
- package/dist/providers/systemPrompt.js +22 -0
- package/dist/providers/systemPrompt.js.map +1 -0
- package/dist/reasoning.d.ts +154 -0
- package/dist/reasoning.d.ts.map +1 -0
- package/dist/reasoning.js +256 -0
- package/dist/reasoning.js.map +1 -0
- package/dist/resolveContent.d.ts +74 -0
- package/dist/resolveContent.d.ts.map +1 -0
- package/dist/resolveContent.js +335 -0
- package/dist/resolveContent.js.map +1 -0
- package/dist/types.d.ts +152 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/untrusted.d.ts +91 -0
- package/dist/untrusted.d.ts.map +1 -0
- package/dist/untrusted.js +385 -0
- package/dist/untrusted.js.map +1 -0
- package/package.json +54 -3
- package/src/assembleStream.ts +219 -0
- package/src/capabilities.ts +96 -0
- package/src/createLlmEffect.ts +287 -0
- package/src/errors.ts +269 -0
- package/src/index.ts +137 -0
- package/src/parts.ts +409 -0
- package/src/providers/AnthropicProvider.ts +550 -0
- package/src/providers/GeminiProvider.ts +380 -0
- package/src/providers/OpenAiProvider.ts +511 -0
- package/src/providers/extraHeaders.ts +41 -0
- package/src/providers/systemPrompt.ts +19 -0
- package/src/reasoning.ts +386 -0
- package/src/resolveContent.ts +425 -0
- package/src/types.ts +175 -0
- package/src/untrusted.ts +440 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnthropicProvider = void 0;
|
|
4
|
+
exports.mapPart = mapPart;
|
|
5
|
+
const capabilities_1 = require("../capabilities");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const parts_1 = require("../parts");
|
|
8
|
+
const resolveContent_1 = require("../resolveContent");
|
|
9
|
+
const untrusted_1 = require("../untrusted");
|
|
10
|
+
const extraHeaders_1 = require("./extraHeaders");
|
|
11
|
+
const systemPrompt_1 = require("./systemPrompt");
|
|
12
|
+
/**
|
|
13
|
+
* Anthropic's `stop_reason` → the SPI's. ONE implementation, used by both
|
|
14
|
+
* `complete` and `stream`: a duplicated mapping is exactly where two paths to one
|
|
15
|
+
* outcome start disagreeing, which is what the conformance parity check exists to
|
|
16
|
+
* catch and what this makes structurally impossible.
|
|
17
|
+
*/
|
|
18
|
+
function normalizeStopReason(raw) {
|
|
19
|
+
return raw === "tool_use" ? "tool_use" : raw === "max_tokens" ? "max_tokens" : "end_turn";
|
|
20
|
+
}
|
|
21
|
+
/** Messages API: images (JPEG/PNG/GIF/WebP) and PDF documents; no audio. */
|
|
22
|
+
const ANTHROPIC_CAPABILITIES = {
|
|
23
|
+
image: ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
24
|
+
file: ["application/pdf"],
|
|
25
|
+
reasoning: true,
|
|
26
|
+
};
|
|
27
|
+
const PROVIDER_ID = "anthropic";
|
|
28
|
+
/** Model families that take images and PDFs: Claude 3 and later (2.x and Instant do not). */
|
|
29
|
+
const ANTHROPIC_MEDIA_MODELS = [/^claude-(3|[4-9]\d*|opus|sonnet|haiku)/];
|
|
30
|
+
const ANTHROPIC_DEFAULT_URL = "https://api.anthropic.com";
|
|
31
|
+
function mapResultPart(p) {
|
|
32
|
+
return mapPart(p);
|
|
33
|
+
}
|
|
34
|
+
/** SPI part → Anthropic content block. Exported for tests. */
|
|
35
|
+
function mapPart(p) {
|
|
36
|
+
switch (p.type) {
|
|
37
|
+
case "text":
|
|
38
|
+
return { type: "text", text: p.text };
|
|
39
|
+
case "image":
|
|
40
|
+
return {
|
|
41
|
+
type: "image",
|
|
42
|
+
source: { type: "base64", media_type: p.mediaType, data: (0, resolveContent_1.inlineData)(p) },
|
|
43
|
+
};
|
|
44
|
+
case "file":
|
|
45
|
+
return {
|
|
46
|
+
type: "document",
|
|
47
|
+
source: { type: "base64", media_type: p.mediaType, data: (0, resolveContent_1.inlineData)(p) },
|
|
48
|
+
...(p.name !== undefined && { title: p.name }),
|
|
49
|
+
};
|
|
50
|
+
case "audio":
|
|
51
|
+
throw new Error("Anthropic Messages does not accept audio content");
|
|
52
|
+
case "tool_use":
|
|
53
|
+
return { type: "tool_use", id: p.id, name: p.name, input: p.input };
|
|
54
|
+
case "reasoning":
|
|
55
|
+
return mapReasoningPart(p);
|
|
56
|
+
case "tool_result":
|
|
57
|
+
return {
|
|
58
|
+
type: "tool_result",
|
|
59
|
+
tool_use_id: p.toolUseId,
|
|
60
|
+
content: typeof p.content === "string"
|
|
61
|
+
? p.content
|
|
62
|
+
: (0, untrusted_1.fenceUntrustedMedia)(p.content).map(mapResultPart),
|
|
63
|
+
...(p.isError === true && { is_error: true }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An assistant `reasoning` part -> the vendor block, UNCHANGED (ADR 0133 D5): a `thinking` block with
|
|
69
|
+
* its text (resolved by `resolveRequestContent`, "" when omitted) and signature, or a
|
|
70
|
+
* `redacted_thinking` block whose `data` is the recorded signature. Callers drop other providers'
|
|
71
|
+
* parts first ({@link mapContent}); this is only reached for ours.
|
|
72
|
+
*/
|
|
73
|
+
function mapReasoningPart(p) {
|
|
74
|
+
if (p.kind === "redacted")
|
|
75
|
+
return { type: "redacted_thinking", data: p.signature ?? "" };
|
|
76
|
+
return {
|
|
77
|
+
type: "thinking",
|
|
78
|
+
thinking: p.text ?? "",
|
|
79
|
+
...(p.signature !== undefined && { signature: p.signature }),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Blocks go back in the order they were recorded (ADR 0133 D5): a signature binds the blocks before
|
|
84
|
+
* it, so `thinking, text, tool_use, thinking, tool_use` must not be regrouped. A part from another
|
|
85
|
+
* provider is omitted: its signature means nothing here.
|
|
86
|
+
*/
|
|
87
|
+
function mapContent(content) {
|
|
88
|
+
if (typeof content === "string")
|
|
89
|
+
return content;
|
|
90
|
+
const own = content.filter((p) => p.type !== "reasoning" || p.provider === PROVIDER_ID);
|
|
91
|
+
return (0, untrusted_1.fenceUntrustedMedia)(own).map(mapPart);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* ADR 0133 D2 - ONE rule, pinned by a test: a non-empty `thinking` text is `summary` (current models
|
|
95
|
+
* return only summaries; the raw chain of thought is never returned), an empty one is `text` with
|
|
96
|
+
* `text: ""` (an omitted-display block, the signature carries the reasoning), and `redacted_thinking`
|
|
97
|
+
* is `redacted` with its `data` as the signature. Shared by `complete` and `stream`.
|
|
98
|
+
*/
|
|
99
|
+
function reasoningOf(block) {
|
|
100
|
+
if (block.type === "redacted_thinking") {
|
|
101
|
+
return {
|
|
102
|
+
kind: "redacted",
|
|
103
|
+
...(typeof block.data === "string" && { signature: block.data }),
|
|
104
|
+
provider: PROVIDER_ID,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (block.type !== "thinking")
|
|
108
|
+
return undefined;
|
|
109
|
+
const text = typeof block.thinking === "string" ? block.thinking : "";
|
|
110
|
+
return {
|
|
111
|
+
kind: text === "" ? "text" : "summary",
|
|
112
|
+
text,
|
|
113
|
+
...(typeof block.signature === "string" && { signature: block.signature }),
|
|
114
|
+
provider: PROVIDER_ID,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
class AnthropicProvider {
|
|
118
|
+
apiKey;
|
|
119
|
+
model;
|
|
120
|
+
baseUrl;
|
|
121
|
+
maxResponseBytes;
|
|
122
|
+
maxStreamBytes;
|
|
123
|
+
maxLineBytes;
|
|
124
|
+
thinking;
|
|
125
|
+
extraHeaders;
|
|
126
|
+
capabilities;
|
|
127
|
+
constructor(config = {}) {
|
|
128
|
+
this.extraHeaders = (0, extraHeaders_1.validateExtraHeaders)(config.headers, ["x-api-key", "anthropic-version", "content-type", "authorization"], "AnthropicProvider");
|
|
129
|
+
this.thinking = config.thinking;
|
|
130
|
+
const model = config.model ?? "claude-opus-4-8";
|
|
131
|
+
this.capabilities =
|
|
132
|
+
config.capabilities ??
|
|
133
|
+
(config.baseUrl !== undefined && config.baseUrl !== ANTHROPIC_DEFAULT_URL
|
|
134
|
+
? {}
|
|
135
|
+
: (0, capabilities_1.capabilitiesForModel)(model, ANTHROPIC_CAPABILITIES, ANTHROPIC_MEDIA_MODELS));
|
|
136
|
+
this.apiKey =
|
|
137
|
+
config.apiKey ??
|
|
138
|
+
(typeof process !== "undefined" ? (process.env.ANTHROPIC_API_KEY ?? "") : "");
|
|
139
|
+
this.model = config.model ?? "claude-opus-4-8";
|
|
140
|
+
this.baseUrl = config.baseUrl ?? ANTHROPIC_DEFAULT_URL;
|
|
141
|
+
this.maxResponseBytes = (0, errors_1.resolveLimit)(config.maxResponseBytes, errors_1.DEFAULT_MAX_RESPONSE_BYTES, "maxResponseBytes");
|
|
142
|
+
this.maxStreamBytes = (0, errors_1.resolveLimit)(config.maxStreamBytes, errors_1.DEFAULT_MAX_STREAM_BYTES, "maxStreamBytes");
|
|
143
|
+
this.maxLineBytes = (0, errors_1.resolveLimit)(config.maxLineBytes, errors_1.DEFAULT_MAX_LINE_BYTES, "maxLineBytes");
|
|
144
|
+
}
|
|
145
|
+
buildBody(request) {
|
|
146
|
+
const system = (0, systemPrompt_1.resolveSystem)(request);
|
|
147
|
+
const messages = request.messages
|
|
148
|
+
.filter((m) => m.role !== "system")
|
|
149
|
+
.map((m) => ({ role: m.role, content: mapContent(m.content) }));
|
|
150
|
+
const body = {
|
|
151
|
+
model: this.model,
|
|
152
|
+
max_tokens: request.maxTokens ?? 4096,
|
|
153
|
+
messages,
|
|
154
|
+
};
|
|
155
|
+
if (system !== undefined)
|
|
156
|
+
body.system = system;
|
|
157
|
+
if (request.temperature !== undefined)
|
|
158
|
+
body.temperature = request.temperature;
|
|
159
|
+
if (this.thinking !== undefined)
|
|
160
|
+
body.thinking = { ...this.thinking };
|
|
161
|
+
if (request.tools !== undefined && request.tools.length > 0) {
|
|
162
|
+
body.tools = request.tools.map((t) => ({
|
|
163
|
+
name: t.name,
|
|
164
|
+
description: t.description,
|
|
165
|
+
input_schema: { type: "object", ...t.inputSchema },
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
return body;
|
|
169
|
+
}
|
|
170
|
+
async complete(request) {
|
|
171
|
+
(0, capabilities_1.assertRequestSupported)(request, this.capabilities, "AnthropicProvider");
|
|
172
|
+
const body = this.buildBody(request);
|
|
173
|
+
const resp = await fetch(`${this.baseUrl}/v1/messages`, {
|
|
174
|
+
method: "POST",
|
|
175
|
+
headers: {
|
|
176
|
+
...this.extraHeaders,
|
|
177
|
+
"content-type": "application/json",
|
|
178
|
+
"x-api-key": this.apiKey,
|
|
179
|
+
"anthropic-version": "2023-06-01",
|
|
180
|
+
},
|
|
181
|
+
body: JSON.stringify(body),
|
|
182
|
+
...(request.signal !== undefined && { signal: request.signal }),
|
|
183
|
+
// Never follow a redirect (it would re-send the body and credentials to another origin): a 3xx
|
|
184
|
+
// comes back as a response and becomes `LlmHttpError(provider, status)` below.
|
|
185
|
+
redirect: "manual",
|
|
186
|
+
});
|
|
187
|
+
if (!resp.ok) {
|
|
188
|
+
await (0, errors_1.drainBody)(resp);
|
|
189
|
+
throw new errors_1.LlmHttpError("anthropic", resp.status);
|
|
190
|
+
}
|
|
191
|
+
const data = (await (0, errors_1.readBoundedJson)(resp, "anthropic", this.maxResponseBytes));
|
|
192
|
+
const content = data.content
|
|
193
|
+
.filter((b) => b.type === "text")
|
|
194
|
+
.map((b) => b.text)
|
|
195
|
+
.join("");
|
|
196
|
+
const toolCalls = data.content
|
|
197
|
+
.filter((b) => b.type === "tool_use")
|
|
198
|
+
.map((b) => ({ id: b.id, name: b.name, input: b.input }));
|
|
199
|
+
const stopReason = normalizeStopReason(data.stop_reason);
|
|
200
|
+
const reasoning = [];
|
|
201
|
+
const entries = [];
|
|
202
|
+
for (const b of data.content) {
|
|
203
|
+
const r = reasoningOf(b);
|
|
204
|
+
if (r !== undefined) {
|
|
205
|
+
reasoning.push(r);
|
|
206
|
+
entries.push("reasoning");
|
|
207
|
+
}
|
|
208
|
+
else if (b.type === "text")
|
|
209
|
+
entries.push({ text: b.text.length });
|
|
210
|
+
else if (b.type === "tool_use")
|
|
211
|
+
entries.push({ call: b.id });
|
|
212
|
+
}
|
|
213
|
+
const layout = (0, parts_1.layoutOf)(entries);
|
|
214
|
+
return {
|
|
215
|
+
content,
|
|
216
|
+
...(toolCalls.length > 0 && { toolCalls }),
|
|
217
|
+
stopReason,
|
|
218
|
+
usage: { inputTokens: data.usage.input_tokens, outputTokens: data.usage.output_tokens },
|
|
219
|
+
...(reasoning.length > 0 && { reasoning }),
|
|
220
|
+
...(layout !== undefined && { layout }),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
async *stream(request) {
|
|
224
|
+
(0, capabilities_1.assertRequestSupported)(request, this.capabilities, "AnthropicProvider");
|
|
225
|
+
const body = { ...this.buildBody(request), stream: true };
|
|
226
|
+
const resp = await fetch(`${this.baseUrl}/v1/messages`, {
|
|
227
|
+
method: "POST",
|
|
228
|
+
headers: {
|
|
229
|
+
...this.extraHeaders,
|
|
230
|
+
"content-type": "application/json",
|
|
231
|
+
"x-api-key": this.apiKey,
|
|
232
|
+
"anthropic-version": "2023-06-01",
|
|
233
|
+
},
|
|
234
|
+
body: JSON.stringify(body),
|
|
235
|
+
...(request.signal !== undefined && { signal: request.signal }),
|
|
236
|
+
// Never follow a redirect (it would re-send the body and credentials to another origin): a 3xx
|
|
237
|
+
// comes back as a response and becomes `LlmHttpError(provider, status)` below.
|
|
238
|
+
redirect: "manual",
|
|
239
|
+
});
|
|
240
|
+
if (!resp.ok) {
|
|
241
|
+
await (0, errors_1.drainBody)(resp);
|
|
242
|
+
throw new errors_1.LlmHttpError("anthropic", resp.status);
|
|
243
|
+
}
|
|
244
|
+
if (!resp.body)
|
|
245
|
+
return;
|
|
246
|
+
const reader = resp.body.getReader();
|
|
247
|
+
const limiter = new errors_1.StreamLimiter("anthropic", this.maxStreamBytes, this.maxLineBytes);
|
|
248
|
+
const decoder = new TextDecoder();
|
|
249
|
+
let buffer = "";
|
|
250
|
+
// Accumulated across the stream so the TERMINAL chunk can report the same
|
|
251
|
+
// outcome `complete` would have. Tool-call arguments arrive as `input_json_delta`
|
|
252
|
+
// fragments that are only valid JSON once concatenated, so a block is parsed at
|
|
253
|
+
// `content_block_stop`, not per delta.
|
|
254
|
+
const toolCalls = [];
|
|
255
|
+
const openBlocks = new Map();
|
|
256
|
+
// ADR 0133 - thinking blocks assemble from `thinking_delta` / `signature_delta`; a block is
|
|
257
|
+
// closed (and mapped through the same {@link reasoningOf} as `complete`) at `content_block_stop`.
|
|
258
|
+
const openThinking = new Map();
|
|
259
|
+
const reasoning = [];
|
|
260
|
+
// ADR 0133 D5 - block order, by `content_block_start`; a text block's entry grows with its deltas.
|
|
261
|
+
const entries = [];
|
|
262
|
+
const textEntries = new Map();
|
|
263
|
+
let stopReason;
|
|
264
|
+
let inputTokens;
|
|
265
|
+
let outputTokens;
|
|
266
|
+
const terminal = () => {
|
|
267
|
+
const layout = (0, parts_1.layoutOf)(entries);
|
|
268
|
+
return {
|
|
269
|
+
delta: "",
|
|
270
|
+
done: true,
|
|
271
|
+
...(toolCalls.length > 0 && { toolCalls }),
|
|
272
|
+
...(stopReason !== undefined && { stopReason }),
|
|
273
|
+
...(inputTokens !== undefined &&
|
|
274
|
+
outputTokens !== undefined && { usage: { inputTokens, outputTokens } }),
|
|
275
|
+
...(reasoning.length > 0 && { reasoning }),
|
|
276
|
+
...(layout !== undefined && { layout }),
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
try {
|
|
280
|
+
while (true) {
|
|
281
|
+
const { done, value } = await reader.read();
|
|
282
|
+
if (done)
|
|
283
|
+
break;
|
|
284
|
+
limiter.chunk(value);
|
|
285
|
+
buffer += decoder.decode(value, { stream: true });
|
|
286
|
+
const lines = buffer.split("\n");
|
|
287
|
+
buffer = lines.pop() ?? "";
|
|
288
|
+
limiter.lines(lines, buffer);
|
|
289
|
+
for (const line of lines) {
|
|
290
|
+
if (!line.startsWith("data: "))
|
|
291
|
+
continue;
|
|
292
|
+
const json = line.slice(6).trim();
|
|
293
|
+
if (json === "[DONE]") {
|
|
294
|
+
yield terminal();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
try {
|
|
298
|
+
const event = JSON.parse(json);
|
|
299
|
+
if (event.type === "content_block_start") {
|
|
300
|
+
const block = event.content_block;
|
|
301
|
+
if (block?.type === "text") {
|
|
302
|
+
const entry = { text: 0 };
|
|
303
|
+
textEntries.set(Number(event.index), entry);
|
|
304
|
+
entries.push(entry);
|
|
305
|
+
}
|
|
306
|
+
else if (block?.type === "thinking" || block?.type === "redacted_thinking") {
|
|
307
|
+
entries.push("reasoning");
|
|
308
|
+
openThinking.set(Number(event.index), {
|
|
309
|
+
type: block.type,
|
|
310
|
+
thinking: typeof block.thinking === "string" ? block.thinking : "",
|
|
311
|
+
...(typeof block.signature === "string" && { signature: block.signature }),
|
|
312
|
+
...(typeof block.data === "string" && { data: block.data }),
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
else if (block?.type === "tool_use") {
|
|
316
|
+
entries.push({ call: String(block.id ?? "") });
|
|
317
|
+
openBlocks.set(Number(event.index), {
|
|
318
|
+
id: String(block.id ?? ""),
|
|
319
|
+
name: String(block.name ?? ""),
|
|
320
|
+
argsJson: "",
|
|
321
|
+
});
|
|
322
|
+
yield {
|
|
323
|
+
delta: "",
|
|
324
|
+
done: false,
|
|
325
|
+
toolDelta: {
|
|
326
|
+
id: String(block.id ?? ""),
|
|
327
|
+
name: String(block.name ?? ""),
|
|
328
|
+
inputDelta: "",
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
else if (event.type === "content_block_delta") {
|
|
334
|
+
const delta = event.delta;
|
|
335
|
+
if (delta?.type === "text_delta") {
|
|
336
|
+
const text = String(delta.text ?? "");
|
|
337
|
+
let entry = textEntries.get(Number(event.index));
|
|
338
|
+
if (entry === undefined) {
|
|
339
|
+
entry = { text: 0 };
|
|
340
|
+
textEntries.set(Number(event.index), entry);
|
|
341
|
+
entries.push(entry);
|
|
342
|
+
}
|
|
343
|
+
entry.text += text.length;
|
|
344
|
+
yield { delta: text, done: false };
|
|
345
|
+
}
|
|
346
|
+
else if (delta?.type === "thinking_delta") {
|
|
347
|
+
const open = openThinking.get(Number(event.index));
|
|
348
|
+
const fragment = String(delta.thinking ?? "");
|
|
349
|
+
if (open !== undefined)
|
|
350
|
+
open.thinking += fragment;
|
|
351
|
+
if (fragment !== "")
|
|
352
|
+
yield { delta: "", done: false, reasoningDelta: fragment };
|
|
353
|
+
}
|
|
354
|
+
else if (delta?.type === "signature_delta") {
|
|
355
|
+
const open = openThinking.get(Number(event.index));
|
|
356
|
+
if (open !== undefined)
|
|
357
|
+
open.signature = (open.signature ?? "") + String(delta.signature ?? "");
|
|
358
|
+
}
|
|
359
|
+
else if (delta?.type === "input_json_delta") {
|
|
360
|
+
const open = openBlocks.get(Number(event.index));
|
|
361
|
+
if (open !== undefined) {
|
|
362
|
+
const fragment = String(delta.partial_json ?? "");
|
|
363
|
+
open.argsJson += fragment;
|
|
364
|
+
yield {
|
|
365
|
+
delta: "",
|
|
366
|
+
done: false,
|
|
367
|
+
toolDelta: { id: open.id, inputDelta: fragment },
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else if (event.type === "content_block_stop") {
|
|
373
|
+
const thinking = openThinking.get(Number(event.index));
|
|
374
|
+
if (thinking !== undefined) {
|
|
375
|
+
openThinking.delete(Number(event.index));
|
|
376
|
+
const r = reasoningOf(thinking);
|
|
377
|
+
if (r !== undefined)
|
|
378
|
+
reasoning.push(r);
|
|
379
|
+
}
|
|
380
|
+
const open = openBlocks.get(Number(event.index));
|
|
381
|
+
if (open !== undefined) {
|
|
382
|
+
openBlocks.delete(Number(event.index));
|
|
383
|
+
// An empty argument object streams as no deltas at all, which is `{}`,
|
|
384
|
+
// not a parse error.
|
|
385
|
+
let input = {};
|
|
386
|
+
try {
|
|
387
|
+
input = open.argsJson === "" ? {} : JSON.parse(open.argsJson);
|
|
388
|
+
}
|
|
389
|
+
catch {
|
|
390
|
+
// Malformed arguments are reported as-is rather than dropped: the
|
|
391
|
+
// agent loop must be able to see WHY a call could not be made.
|
|
392
|
+
input = { __unparsedArguments: open.argsJson };
|
|
393
|
+
}
|
|
394
|
+
toolCalls.push({ id: open.id, name: open.name, input });
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
else if (event.type === "message_delta") {
|
|
398
|
+
// Carries the stop reason and the OUTPUT token count (input tokens came
|
|
399
|
+
// with message_start).
|
|
400
|
+
const delta = event.delta;
|
|
401
|
+
stopReason = normalizeStopReason(delta?.stop_reason);
|
|
402
|
+
const usage = event.usage;
|
|
403
|
+
if (usage?.output_tokens !== undefined)
|
|
404
|
+
outputTokens = Number(usage.output_tokens);
|
|
405
|
+
}
|
|
406
|
+
else if (event.type === "message_start") {
|
|
407
|
+
const message = event.message;
|
|
408
|
+
const usage = message?.usage;
|
|
409
|
+
if (usage?.input_tokens !== undefined)
|
|
410
|
+
inputTokens = Number(usage.input_tokens);
|
|
411
|
+
if (usage?.output_tokens !== undefined)
|
|
412
|
+
outputTokens = Number(usage.output_tokens);
|
|
413
|
+
}
|
|
414
|
+
else if (event.type === "message_stop") {
|
|
415
|
+
yield terminal();
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
else if (event.type === "error") {
|
|
419
|
+
// The message text can echo the prompt: only the error type is kept.
|
|
420
|
+
const err = event.error;
|
|
421
|
+
throw new errors_1.LlmStreamError("anthropic", err?.type);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
catch (e) {
|
|
425
|
+
if (e instanceof errors_1.LlmStreamError)
|
|
426
|
+
throw e;
|
|
427
|
+
// skip malformed SSE lines
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
finally {
|
|
433
|
+
try {
|
|
434
|
+
await reader.cancel();
|
|
435
|
+
}
|
|
436
|
+
catch {
|
|
437
|
+
// already closed or released: nothing to free
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
exports.AnthropicProvider = AnthropicProvider;
|
|
443
|
+
//# sourceMappingURL=AnthropicProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnthropicProvider.js","sourceRoot":"","sources":["../../src/providers/AnthropicProvider.ts"],"names":[],"mappings":";;;AA+FA,0BAgCC;AA/HD,kDAIyB;AACzB,sCAUmB;AACnB,oCAOkB;AAClB,sDAA+C;AAS/C,4CAAmD;AACnD,iDAAsD;AACtD,iDAA+C;AAE/C;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,GAAY;IACvC,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;AAC5F,CAAC;AAgCD,4EAA4E;AAC5E,MAAM,sBAAsB,GAAoB;IAC9C,KAAK,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC;IAC7D,IAAI,EAAE,CAAC,iBAAiB,CAAC;IACzB,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,6FAA6F;AAC7F,MAAM,sBAAsB,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAC1E,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAE1D,SAAS,aAAa,CAAC,CAAgB;IACrC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAED,8DAA8D;AAC9D,SAAgB,OAAO,CAAC,CAAiB;IACvC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAA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AAM,GAAG,GAAG,KAAK,CAAC,KAA4C,CAAC;4BAC/D,MAAM,IAAI,uBAAc,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;wBACnD,CAAC;oBACH,CAAC;oBAAC,OAAO,CAAC,EAAE,CAAC;wBACX,IAAI,CAAC,YAAY,uBAAc;4BAAE,MAAM,CAAC,CAAC;wBACzC,2BAA2B;oBAC7B,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;YACxB,CAAC;YAAC,MAAM,CAAC;gBACP,8CAA8C;YAChD,CAAC;QACH,CAAC;IACH,CAAC;CACF;AArVD,8CAqVC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type LlmCapabilities } from "../capabilities";
|
|
2
|
+
import type { LlmMessage, LlmProvider, LlmRequest, LlmResponse } from "../types";
|
|
3
|
+
export interface GeminiProviderConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Extra request headers sent on every request (for example `anthropic-workspace-id`). Header
|
|
6
|
+
* names and values must be strings without CR/LF; a header the provider sets itself (auth,
|
|
7
|
+
* protocol, content type) cannot be overridden and throws at construction. Unset, the request
|
|
8
|
+
* is unchanged.
|
|
9
|
+
*/
|
|
10
|
+
headers?: Readonly<Record<string, string>>;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Cap on a complete response body, in bytes after decompression (default 8 MiB). Over it the
|
|
16
|
+
* body is cancelled and `LlmResponseLimitError` (provider and reason only) is thrown.
|
|
17
|
+
*/
|
|
18
|
+
maxResponseBytes?: number;
|
|
19
|
+
/** Cap on the total bytes read from a stream (default 128 MiB); same error. */
|
|
20
|
+
maxStreamBytes?: number;
|
|
21
|
+
/** Cap on one line of a stream, in UTF-8 bytes (default 1 MiB); same error. */
|
|
22
|
+
maxLineBytes?: number;
|
|
23
|
+
/** Override the declared modalities. */
|
|
24
|
+
capabilities?: LlmCapabilities;
|
|
25
|
+
/**
|
|
26
|
+
* Ask for thought summaries (`generationConfig.thinkingConfig.includeThoughts`, ADR 0133).
|
|
27
|
+
* Unset, nothing is sent.
|
|
28
|
+
*/
|
|
29
|
+
includeThoughts?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Cap on thinking tokens (`generationConfig.thinkingConfig.thinkingBudget`). Thinking tokens
|
|
32
|
+
* count against `maxOutputTokens`, so without a cap a small output budget can be spent entirely
|
|
33
|
+
* on thinking (`MAX_TOKENS`, no text). An integer: `-1` lets the model decide (dynamic), `0`
|
|
34
|
+
* disables thinking on models that allow it. The accepted range is per model and enforced by the
|
|
35
|
+
* server (Gemini 2.5: Pro 128-32768, cannot be disabled; Flash 0-24576; Flash-Lite 512-24576, `0`
|
|
36
|
+
* disables). Unset, nothing is sent.
|
|
37
|
+
*/
|
|
38
|
+
thinkingBudget?: number;
|
|
39
|
+
}
|
|
40
|
+
/** `generateContent` takes any inline mime type the model supports; declare the common ones. */
|
|
41
|
+
export declare const GEMINI_CAPABILITIES: LlmCapabilities;
|
|
42
|
+
/** Model families that take media: Gemini 1.5 and later, and the `-latest` aliases (1.0 Pro does not). */
|
|
43
|
+
export declare const GEMINI_MEDIA_MODELS: RegExp[];
|
|
44
|
+
/**
|
|
45
|
+
* SPI messages → Gemini `contents`. `functionResponse` is matched to its call by NAME, which
|
|
46
|
+
* the SPI's `tool_result` does not carry, so names are recovered from the earlier `tool_use`
|
|
47
|
+
* part with the same id. Media a tool returned rides as extra `inlineData` parts alongside.
|
|
48
|
+
* Exported for tests.
|
|
49
|
+
*/
|
|
50
|
+
export declare function mapContents(messages: readonly LlmMessage[]): Record<string, unknown>[];
|
|
51
|
+
export declare class GeminiProvider implements LlmProvider {
|
|
52
|
+
private readonly apiKey;
|
|
53
|
+
private readonly model;
|
|
54
|
+
private readonly baseUrl;
|
|
55
|
+
private readonly maxResponseBytes;
|
|
56
|
+
private readonly maxStreamBytes;
|
|
57
|
+
private readonly maxLineBytes;
|
|
58
|
+
private readonly includeThoughts;
|
|
59
|
+
private readonly thinkingBudget;
|
|
60
|
+
private readonly extraHeaders;
|
|
61
|
+
readonly capabilities: LlmCapabilities;
|
|
62
|
+
constructor(config?: GeminiProviderConfig);
|
|
63
|
+
private buildBody;
|
|
64
|
+
complete(request: LlmRequest): Promise<LlmResponse>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=GeminiProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeminiProvider.d.ts","sourceRoot":"","sources":["../../src/providers/GeminiProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AAmBzB,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAe,MAAM,UAAU,CAAC;AAK9F,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,gGAAgG;AAChG,eAAO,MAAM,mBAAmB,EAAE,eAKjC,CAAC;AAIF,0GAA0G;AAC1G,eAA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