llm-large-files 0.4.0 → 0.5.0
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/CHANGELOG.md +205 -0
- package/README.md +48 -8
- package/dist/anthropic/adapter.d.ts +106 -0
- package/dist/anthropic/adapter.d.ts.map +1 -0
- package/dist/anthropic/adapter.js +391 -0
- package/dist/anthropic/adapter.js.map +1 -0
- package/dist/anthropic/index.d.ts +3 -0
- package/dist/anthropic/index.d.ts.map +1 -0
- package/dist/anthropic/index.js +2 -0
- package/dist/anthropic/index.js.map +1 -0
- package/dist/ask.d.ts +144 -0
- package/dist/ask.d.ts.map +1 -0
- package/dist/ask.js +540 -0
- package/dist/ask.js.map +1 -0
- package/dist/budget.d.ts +23 -0
- package/dist/budget.d.ts.map +1 -0
- package/dist/budget.js +64 -0
- package/dist/budget.js.map +1 -0
- package/dist/cache.d.ts +11 -2
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +36 -7
- package/dist/cache.js.map +1 -1
- package/dist/errors.d.ts +21 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +44 -0
- package/dist/errors.js.map +1 -0
- package/dist/evidence.d.ts +40 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +137 -0
- package/dist/evidence.js.map +1 -0
- package/dist/gemini/adapter.d.ts +50 -0
- package/dist/gemini/adapter.d.ts.map +1 -0
- package/dist/gemini/adapter.js +179 -0
- package/dist/gemini/adapter.js.map +1 -0
- package/dist/gemini/chat.d.ts +32 -71
- package/dist/gemini/chat.d.ts.map +1 -1
- package/dist/gemini/chat.js +38 -284
- package/dist/gemini/chat.js.map +1 -1
- package/dist/gemini/errors.d.ts +11 -0
- package/dist/gemini/errors.d.ts.map +1 -0
- package/dist/gemini/errors.js +14 -0
- package/dist/gemini/errors.js.map +1 -0
- package/dist/gemini/generate.d.ts +12 -13
- package/dist/gemini/generate.d.ts.map +1 -1
- package/dist/gemini/generate.js +62 -26
- package/dist/gemini/generate.js.map +1 -1
- package/dist/gemini/index.d.ts +3 -1
- package/dist/gemini/index.d.ts.map +1 -1
- package/dist/gemini/index.js +2 -1
- package/dist/gemini/index.js.map +1 -1
- package/dist/gemini/sse.d.ts +1 -2
- package/dist/gemini/sse.d.ts.map +1 -1
- package/dist/gemini/sse.js +1 -38
- package/dist/gemini/sse.js.map +1 -1
- package/dist/http.d.ts +20 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +55 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/library.d.ts +50 -5
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +56 -26
- package/dist/library.js.map +1 -1
- package/dist/map-reduce.d.ts +15 -0
- package/dist/map-reduce.d.ts.map +1 -1
- package/dist/map-reduce.js +58 -27
- package/dist/map-reduce.js.map +1 -1
- package/dist/model.d.ts +196 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +41 -0
- package/dist/model.js.map +1 -0
- package/dist/openai/adapter.d.ts +85 -0
- package/dist/openai/adapter.d.ts.map +1 -0
- package/dist/openai/adapter.js +293 -0
- package/dist/openai/adapter.js.map +1 -0
- package/dist/openai/index.d.ts +3 -0
- package/dist/openai/index.d.ts.map +1 -0
- package/dist/openai/index.js +2 -0
- package/dist/openai/index.js.map +1 -0
- package/dist/output-limit.d.ts +30 -0
- package/dist/output-limit.d.ts.map +1 -0
- package/dist/output-limit.js +92 -0
- package/dist/output-limit.js.map +1 -0
- package/dist/plan.d.ts +20 -4
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +44 -7
- package/dist/plan.js.map +1 -1
- package/dist/ranged.d.ts +2 -2
- package/dist/ranged.d.ts.map +1 -1
- package/dist/ranged.js +11 -4
- package/dist/ranged.js.map +1 -1
- package/dist/retry.d.ts +54 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +111 -0
- package/dist/retry.js.map +1 -0
- package/dist/search.d.ts +16 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +109 -26
- package/dist/search.js.map +1 -1
- package/dist/sse.d.ts +3 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +39 -0
- package/dist/sse.js.map +1 -0
- package/dist/stores.d.ts +5 -1
- package/dist/stores.d.ts.map +1 -1
- package/dist/stores.js +58 -15
- package/dist/stores.js.map +1 -1
- package/dist/text.d.ts +12 -1
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +43 -15
- package/dist/text.js.map +1 -1
- package/dist/tools.d.ts +23 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +115 -35
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +33 -3
- package/dist/types.d.ts.map +1 -1
- package/docs/api.md +253 -28
- package/docs/configuration.md +89 -10
- package/docs/getting-started.md +69 -16
- package/docs/how-it-works.md +46 -4
- package/docs/security.md +36 -3
- package/package.json +21 -3
- package/src/anthropic/adapter.ts +454 -0
- package/src/anthropic/index.ts +2 -0
- package/src/ask.ts +675 -0
- package/src/budget.ts +71 -0
- package/src/cache.ts +32 -8
- package/src/errors.ts +42 -0
- package/src/evidence.ts +162 -0
- package/src/gemini/adapter.ts +218 -0
- package/src/gemini/chat.ts +62 -333
- package/src/gemini/errors.ts +15 -0
- package/src/gemini/generate.ts +72 -30
- package/src/gemini/index.ts +3 -1
- package/src/gemini/sse.ts +1 -34
- package/src/http.ts +59 -0
- package/src/index.ts +34 -4
- package/src/library.ts +102 -29
- package/src/map-reduce.ts +52 -23
- package/src/model.ts +200 -0
- package/src/openai/adapter.ts +345 -0
- package/src/openai/index.ts +2 -0
- package/src/output-limit.ts +99 -0
- package/src/plan.ts +46 -7
- package/src/ranged.ts +13 -6
- package/src/retry.ts +132 -0
- package/src/search.ts +116 -25
- package/src/sse.ts +34 -0
- package/src/stores.ts +51 -15
- package/src/text.ts +39 -12
- package/src/tools.ts +127 -38
- package/src/types.ts +29 -3
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
// Claude (the Messages API) as a model of `askWithFiles`. No SDK, like the other adapters: the
|
|
2
|
+
// caller gives a key or a token, and may give the URL of a gateway that speaks the same API.
|
|
3
|
+
import { base64, resolveHeaderSource, resolveSecret, unreachableReason } from "../http.js";
|
|
4
|
+
import { ModelRequestError } from "../model.js";
|
|
5
|
+
import { completeWithinLimit } from "../output-limit.js";
|
|
6
|
+
import { retryAfterMs } from "../retry.js";
|
|
7
|
+
import { parseSseJson } from "../sse.js";
|
|
8
|
+
/** The API answered with an HTTP error, or could not be reached (`status` 0). `type` is the API's own word: "rate_limit_error". */
|
|
9
|
+
export class AnthropicRequestError extends ModelRequestError {
|
|
10
|
+
type;
|
|
11
|
+
constructor(message, status, options = {}) {
|
|
12
|
+
super(message, status, options);
|
|
13
|
+
this.name = "AnthropicRequestError";
|
|
14
|
+
if (options.type)
|
|
15
|
+
this.type = options.type;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** The API version the requests are written for. */
|
|
19
|
+
export const ANTHROPIC_VERSION = "2026-10-21";
|
|
20
|
+
/** The beta that `fallbacks` needs. */
|
|
21
|
+
const FALLBACK_BETA = "server-side-fallback-2026-07-01";
|
|
22
|
+
const DEFAULT_MAX_TOKENS = 64_000;
|
|
23
|
+
const STATUS_OF_TYPE = { overloaded_error: 529, rate_limit_error: 429, api_error: 500, timeout_error: 408 };
|
|
24
|
+
/** Blocks of a model that declined part-way must not go back: only what came after the last switch to another model does. */
|
|
25
|
+
const INTERNAL_BEFORE_FALLBACK = new Set(["thinking", "redacted_thinking", "tool_use", "server_tool_use"]);
|
|
26
|
+
/** The content of a reply as it goes back in the next request. */
|
|
27
|
+
function echoable(content) {
|
|
28
|
+
const boundary = content.map((block) => block?.type).lastIndexOf("fallback");
|
|
29
|
+
if (boundary < 0)
|
|
30
|
+
return content;
|
|
31
|
+
return content.filter((block, index) => index >= boundary || !INTERNAL_BEFORE_FALLBACK.has(block?.type));
|
|
32
|
+
}
|
|
33
|
+
function usageOf(usage) {
|
|
34
|
+
const number = (value) => (typeof value === "number" && Number.isFinite(value) ? value : 0);
|
|
35
|
+
// With fallbacks, each attempt is an entry of `iterations`, and the top-level numbers are the last attempt's alone.
|
|
36
|
+
const attempts = Array.isArray(usage?.iterations) && usage.iterations.length > 0 ? usage.iterations : [usage ?? {}];
|
|
37
|
+
const sum = { inputTokens: 0, cachedInputTokens: 0, outputTokens: 0, thoughtTokens: 0 };
|
|
38
|
+
for (const attempt of attempts) {
|
|
39
|
+
const read = number(attempt?.cache_read_input_tokens);
|
|
40
|
+
// `input_tokens` is what was not cached: the prompt is the three together.
|
|
41
|
+
sum.inputTokens += number(attempt?.input_tokens) + number(attempt?.cache_creation_input_tokens) + read;
|
|
42
|
+
sum.cachedInputTokens += read;
|
|
43
|
+
sum.outputTokens += number(attempt?.output_tokens);
|
|
44
|
+
}
|
|
45
|
+
return sum;
|
|
46
|
+
}
|
|
47
|
+
async function failure(response) {
|
|
48
|
+
const data = await response.json().catch(() => null);
|
|
49
|
+
const wait = retryAfterMs(response.headers, data);
|
|
50
|
+
const type = typeof data?.error?.type === "string" ? data.error.type : undefined;
|
|
51
|
+
return new AnthropicRequestError(typeof data?.error?.message === "string" && data.error.message ? data.error.message : `Claude returned HTTP ${response.status}.`, response.status, {
|
|
52
|
+
...(wait === undefined ? {} : { retryAfterMs: wait }),
|
|
53
|
+
...(type ? { type } : {}),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const toolResultOf = (id, result, documents) => ({
|
|
57
|
+
type: "tool_result",
|
|
58
|
+
tool_use_id: id,
|
|
59
|
+
content: documents.length > 0 ? [{ type: "text", text: JSON.stringify(result) }, ...documents] : JSON.stringify(result),
|
|
60
|
+
// Says to the model that the call failed, so it tries another way instead of reading the message as data.
|
|
61
|
+
...(typeof result.error === "string" ? { is_error: true } : {}),
|
|
62
|
+
});
|
|
63
|
+
/** The two messages of one tool round. `number` makes the IDs of calls that came without one. */
|
|
64
|
+
function roundMessages(round, number, files) {
|
|
65
|
+
const idOf = (call, index) => call.id ?? `toolu_${number}_${index + 1}`;
|
|
66
|
+
// Its own turn goes back exactly as it came: Claude checks its thinking blocks against the conversation they were written in.
|
|
67
|
+
const asked = {
|
|
68
|
+
role: "assistant",
|
|
69
|
+
content: round.raw !== undefined ? round.raw : round.calls.map((call, index) => ({ type: "tool_use", id: idOf(call, index), name: call.name, input: call.args })),
|
|
70
|
+
};
|
|
71
|
+
if (round.answers.length === 0)
|
|
72
|
+
return [asked];
|
|
73
|
+
const document = (file) => ({ type: "document", source: { type: "base64", media_type: file.mimeType, data: base64(file.bytes) } });
|
|
74
|
+
const results = round.answers.map((answer, index) => toolResultOf(idOf(answer.call, index), answer.result, files === "inside" ? (answer.files ?? []).map(document) : []));
|
|
75
|
+
// Anything else in the turn comes after every tool result: the API refuses text before one.
|
|
76
|
+
const beside = files === "beside" ? round.answers.flatMap((answer) => (answer.files ?? []).flatMap((file) => [
|
|
77
|
+
{ type: "text", text: `${file.name} (returned by ${answer.call.name}):` },
|
|
78
|
+
document(file),
|
|
79
|
+
])) : [];
|
|
80
|
+
return [asked, { role: "user", content: [...results, ...beside] }];
|
|
81
|
+
}
|
|
82
|
+
/** Turns that follow each other with the same role, made one: tool results and the text after them belong to one user turn. */
|
|
83
|
+
function joined(messages) {
|
|
84
|
+
const out = [];
|
|
85
|
+
for (const message of messages) {
|
|
86
|
+
const content = typeof message.content === "string" ? (message.content ? [{ type: "text", text: message.content }] : []) : message.content;
|
|
87
|
+
if (content.length === 0)
|
|
88
|
+
continue;
|
|
89
|
+
const last = out.at(-1);
|
|
90
|
+
if (last && last.role === message.role)
|
|
91
|
+
last.content = [...last.content, ...content];
|
|
92
|
+
else
|
|
93
|
+
out.push({ role: message.role, content: [...content] });
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Messages of the Messages API as the conversation of `askWithFiles`: text blocks as text, a turn
|
|
99
|
+
* of `tool_use` blocks and the `tool_result` blocks that answer it as one stored tool round, and
|
|
100
|
+
* every other block (an image, a document) as it is. Thinking blocks are left out: they belong to
|
|
101
|
+
* the conversation they were written in.
|
|
102
|
+
*/
|
|
103
|
+
export function fromAnthropicMessages(history) {
|
|
104
|
+
const messages = [];
|
|
105
|
+
const open = new Map();
|
|
106
|
+
for (const message of history) {
|
|
107
|
+
const content = typeof message.content === "string" ? [{ type: "text", text: message.content }] : message.content;
|
|
108
|
+
const calls = [];
|
|
109
|
+
const parts = [];
|
|
110
|
+
for (const block of content) {
|
|
111
|
+
if (block.type === "thinking" || block.type === "redacted_thinking")
|
|
112
|
+
continue;
|
|
113
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
114
|
+
if (block.text)
|
|
115
|
+
parts.push({ text: block.text });
|
|
116
|
+
}
|
|
117
|
+
else if (block.type === "tool_use" && message.role === "assistant") {
|
|
118
|
+
calls.push({ id: String(block.id), name: String(block.name), args: block.input && typeof block.input === "object" ? block.input : {}, result: { error: "No result was kept for this call." } });
|
|
119
|
+
}
|
|
120
|
+
else if (block.type === "tool_result" && message.role === "user") {
|
|
121
|
+
const call = open.get(String(block.tool_use_id));
|
|
122
|
+
if (!call)
|
|
123
|
+
continue;
|
|
124
|
+
const text = typeof block.content === "string" ? block.content : (Array.isArray(block.content) ? block.content : []).map((part) => (part.type === "text" ? String(part.text ?? "") : "")).join("");
|
|
125
|
+
try {
|
|
126
|
+
const parsed = JSON.parse(text);
|
|
127
|
+
call.result = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : { text };
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
call.result = { text };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
parts.push({ native: block });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (parts.length > 0)
|
|
138
|
+
messages.push({ role: message.role, parts });
|
|
139
|
+
if (calls.length > 0) {
|
|
140
|
+
for (const call of calls)
|
|
141
|
+
open.set(call.id, call);
|
|
142
|
+
messages.push({ role: "tools", calls });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return messages;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The tool rounds a question returned (`AskResult.toolTurns`) as messages of the Messages API, for
|
|
149
|
+
* an application that keeps its history in that form: put them between the question and its answer.
|
|
150
|
+
*/
|
|
151
|
+
export function anthropicToolTurns(turns) {
|
|
152
|
+
return turns.flatMap((turn, index) => {
|
|
153
|
+
const answers = turn.calls.map(({ result, ...call }) => ({ call, result }));
|
|
154
|
+
return roundMessages({ role: "tools", calls: answers.map((answer) => answer.call), answers }, index + 1, "none");
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/** A Claude model for `askWithFiles`. */
|
|
158
|
+
export function anthropic(options) {
|
|
159
|
+
const fetchImpl = options.fetch ?? fetch;
|
|
160
|
+
const url = options.url ?? `${(options.baseUrl ?? "https://api.anthropic.com").replace(/\/+$/, "")}/v1/messages`;
|
|
161
|
+
const firstParty = (() => {
|
|
162
|
+
try {
|
|
163
|
+
return new URL(url).hostname === "api.anthropic.com";
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
})();
|
|
169
|
+
const files = options.toolFilePlacement ?? "inside";
|
|
170
|
+
const maxTokens = Math.max(1, Math.trunc(options.maxTokens ?? DEFAULT_MAX_TOKENS));
|
|
171
|
+
const streaming = options.stream !== false;
|
|
172
|
+
const eager = options.eagerInputStreaming ?? firstParty;
|
|
173
|
+
const cache = options.cache === false ? undefined : { type: "ephemeral", ...(options.cache === "1h" ? { ttl: "1h" } : {}) };
|
|
174
|
+
const betas = [...new Set([...(options.betas ?? []), ...(options.fallbacks ? [FALLBACK_BETA] : [])])];
|
|
175
|
+
const headersNow = async () => {
|
|
176
|
+
const [key, token] = await Promise.all([resolveSecret(options.apiKey), resolveSecret(options.authToken)]);
|
|
177
|
+
return {
|
|
178
|
+
"Content-Type": "application/json",
|
|
179
|
+
"anthropic-version": options.version ?? ANTHROPIC_VERSION,
|
|
180
|
+
...(betas.length > 0 ? { "anthropic-beta": betas.join(",") } : {}),
|
|
181
|
+
...(key ? { "x-api-key": key } : {}),
|
|
182
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
183
|
+
...await resolveHeaderSource(options.headers),
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
const built = new WeakMap();
|
|
187
|
+
const toMessages = (messages) => {
|
|
188
|
+
let rounds = 0;
|
|
189
|
+
return joined(messages.flatMap((message) => {
|
|
190
|
+
if (message.role !== "tools") {
|
|
191
|
+
// The API refuses an empty text block.
|
|
192
|
+
return [{ role: message.role, content: message.parts.flatMap((part) => (part.native !== undefined ? [part.native] : part.text ? [{ type: "text", text: part.text }] : [])) }];
|
|
193
|
+
}
|
|
194
|
+
const number = ++rounds;
|
|
195
|
+
let known = built.get(message);
|
|
196
|
+
if (!known || known.number !== number) {
|
|
197
|
+
known = { number, messages: roundMessages(message, number, files) };
|
|
198
|
+
built.set(message, known);
|
|
199
|
+
}
|
|
200
|
+
return known.messages;
|
|
201
|
+
}));
|
|
202
|
+
};
|
|
203
|
+
const asTool = (declaration, stream) => ({
|
|
204
|
+
name: declaration.name,
|
|
205
|
+
description: declaration.description,
|
|
206
|
+
input_schema: declaration.parameters,
|
|
207
|
+
...(stream && eager ? { eager_input_streaming: true } : {}),
|
|
208
|
+
});
|
|
209
|
+
const bodyOf = (request, stream) => ({
|
|
210
|
+
model: options.model,
|
|
211
|
+
max_tokens: maxTokens,
|
|
212
|
+
...(request.system ? { system: request.system } : {}),
|
|
213
|
+
messages: toMessages(request.messages),
|
|
214
|
+
// The tools stay listed in the request that must be answered in text: Claude ties its thinking
|
|
215
|
+
// to the tools of the conversation, and wants them declared next to earlier calls.
|
|
216
|
+
...(request.tools?.length ? { tools: request.tools.map((tool) => asTool(tool, stream)), ...(request.toolChoice === "none" ? { tool_choice: { type: "none" } } : {}) } : {}),
|
|
217
|
+
...(stream ? { stream: true } : {}),
|
|
218
|
+
...(cache ? { cache_control: cache } : {}),
|
|
219
|
+
...(options.fallbacks ? { fallbacks: options.fallbacks } : {}),
|
|
220
|
+
...options.body,
|
|
221
|
+
});
|
|
222
|
+
const post = async (body, signal, stopped) => {
|
|
223
|
+
let response;
|
|
224
|
+
try {
|
|
225
|
+
response = await fetchImpl(url, { method: "POST", headers: await headersNow(), body: JSON.stringify(body), ...(signal ? { signal } : {}) });
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
if (stopped())
|
|
229
|
+
throw error;
|
|
230
|
+
throw new AnthropicRequestError(`Claude could not be reached${unreachableReason(error)}.`, 0, { cause: error });
|
|
231
|
+
}
|
|
232
|
+
if (!response.ok)
|
|
233
|
+
throw await failure(response);
|
|
234
|
+
return response;
|
|
235
|
+
};
|
|
236
|
+
/** The reply, from the content of a finished message. */
|
|
237
|
+
const replyOf = (content, stopReason, stopDetails, usage, problems, text) => {
|
|
238
|
+
const boundary = content.map((block) => block?.type).lastIndexOf("fallback");
|
|
239
|
+
const refused = stopReason === "refusal";
|
|
240
|
+
// Cut off at the output limit with a call half-written: the call is answered, not run.
|
|
241
|
+
const cutOff = stopReason === "max_tokens";
|
|
242
|
+
const calls = refused ? [] : content.flatMap((block, index) => {
|
|
243
|
+
if (block?.type !== "tool_use" || index < boundary || typeof block.name !== "string")
|
|
244
|
+
return [];
|
|
245
|
+
const problem = problems.get(index) ?? (cutOff ? "This call was cut off at the output limit before its arguments were complete, and was not run. Send it again." : undefined);
|
|
246
|
+
return [{
|
|
247
|
+
...(typeof block.id === "string" ? { id: block.id } : {}),
|
|
248
|
+
name: block.name,
|
|
249
|
+
args: block.input && typeof block.input === "object" && !Array.isArray(block.input) ? block.input : {},
|
|
250
|
+
...(problem ? { problem } : {}),
|
|
251
|
+
}];
|
|
252
|
+
});
|
|
253
|
+
const category = typeof stopDetails?.category === "string" ? `: ${stopDetails.category}` : "";
|
|
254
|
+
return {
|
|
255
|
+
text,
|
|
256
|
+
calls,
|
|
257
|
+
raw: echoable(content),
|
|
258
|
+
...(typeof stopReason === "string" ? { finishReason: stopReason } : {}),
|
|
259
|
+
...(refused ? { blockReason: `refusal${category}` } : {}),
|
|
260
|
+
...(usage ? { usage: usageOf(usage), providerUsage: usage } : {}),
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
const generateText = ({ system, prompt, maxOutputTokens, signal, onTruncated, onUsage }) => {
|
|
264
|
+
const send = async (limit) => {
|
|
265
|
+
const timeout = AbortSignal.timeout(options.timeoutMs ?? 180_000);
|
|
266
|
+
const response = await post({
|
|
267
|
+
model: options.model,
|
|
268
|
+
max_tokens: limit,
|
|
269
|
+
system,
|
|
270
|
+
messages: [{ role: "user", content: prompt }],
|
|
271
|
+
...options.analysisBody?.(limit),
|
|
272
|
+
}, signal ? AbortSignal.any([signal, timeout]) : timeout, () => Boolean(signal?.aborted) || timeout.aborted);
|
|
273
|
+
const data = await response.json();
|
|
274
|
+
onUsage?.(usageOf(data.usage));
|
|
275
|
+
const content = Array.isArray(data.content) ? data.content : [];
|
|
276
|
+
return {
|
|
277
|
+
text: content.map((block) => (block?.type === "text" && typeof block.text === "string" ? block.text : "")).join(""),
|
|
278
|
+
cutOff: data.stop_reason === "max_tokens",
|
|
279
|
+
...(typeof data.stop_reason === "string" ? { reason: data.stop_reason } : {}),
|
|
280
|
+
thoughts: 0,
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
return completeWithinLimit(`${url}|${options.model}`, maxOutputTokens, send, { signal, onTruncated });
|
|
284
|
+
};
|
|
285
|
+
return {
|
|
286
|
+
id: options.id ?? options.model,
|
|
287
|
+
capabilities: {
|
|
288
|
+
...(options.contextTokens ? { contextTokens: options.contextTokens } : {}),
|
|
289
|
+
maxRequestBytes: options.maxRequestBytes ?? 32_000_000,
|
|
290
|
+
toolFiles: files,
|
|
291
|
+
pageTokens: options.pageTokens ?? 3_500,
|
|
292
|
+
tokenScale: options.tokenScale ?? 1.35,
|
|
293
|
+
outputTokens: maxTokens,
|
|
294
|
+
// Claude checks its thinking blocks against the conversation they were written in: an
|
|
295
|
+
// earlier turn that is rewritten makes the later ones invalid.
|
|
296
|
+
appendOnly: true,
|
|
297
|
+
},
|
|
298
|
+
requestBytes: (request) => Buffer.byteLength(JSON.stringify(bodyOf(request, streaming))),
|
|
299
|
+
generateText,
|
|
300
|
+
async send(request, hooks = {}) {
|
|
301
|
+
const response = await post(bodyOf(request, streaming), hooks.signal, () => Boolean(hooks.signal?.aborted));
|
|
302
|
+
const problems = new Map();
|
|
303
|
+
if (!(streaming && response.body && (response.headers.get("content-type") ?? "").includes("text/event-stream"))) {
|
|
304
|
+
// In one piece: streaming is off, or the gateway answered without it.
|
|
305
|
+
const data = await response.json();
|
|
306
|
+
const content = Array.isArray(data.content) ? data.content : [];
|
|
307
|
+
const text = content.map((block) => (block?.type === "text" && typeof block.text === "string" ? block.text : "")).join("");
|
|
308
|
+
if (text)
|
|
309
|
+
hooks.onText?.(text);
|
|
310
|
+
return replyOf(content, data.stop_reason, data.stop_details, data.usage, problems, text);
|
|
311
|
+
}
|
|
312
|
+
const content = [];
|
|
313
|
+
const inputs = new Map();
|
|
314
|
+
let text = "";
|
|
315
|
+
let stopReason;
|
|
316
|
+
let stopDetails;
|
|
317
|
+
let usage;
|
|
318
|
+
try {
|
|
319
|
+
for await (const event of parseSseJson(response.body)) {
|
|
320
|
+
if (event.type === "error") {
|
|
321
|
+
const type = typeof event.error?.type === "string" ? event.error.type : undefined;
|
|
322
|
+
throw new AnthropicRequestError(String(event.error?.message ?? "Claude reported an error."), (type && STATUS_OF_TYPE[type]) || response.status, type ? { type } : {});
|
|
323
|
+
}
|
|
324
|
+
if (event.type === "message_start") {
|
|
325
|
+
usage = { ...event.message?.usage };
|
|
326
|
+
}
|
|
327
|
+
else if (event.type === "content_block_start" && typeof event.index === "number") {
|
|
328
|
+
content[event.index] = { ...event.content_block };
|
|
329
|
+
}
|
|
330
|
+
else if (event.type === "content_block_delta" && typeof event.index === "number") {
|
|
331
|
+
const block = (content[event.index] ??= {});
|
|
332
|
+
const delta = (event.delta ?? {});
|
|
333
|
+
if (delta.type === "text_delta" && typeof delta.text === "string") {
|
|
334
|
+
block.text = `${block.text ?? ""}${delta.text}`;
|
|
335
|
+
text += delta.text;
|
|
336
|
+
if (delta.text)
|
|
337
|
+
hooks.onText?.(delta.text);
|
|
338
|
+
}
|
|
339
|
+
else if (delta.type === "thinking_delta" && typeof delta.thinking === "string") {
|
|
340
|
+
block.thinking = `${block.thinking ?? ""}${delta.thinking}`;
|
|
341
|
+
}
|
|
342
|
+
else if (delta.type === "signature_delta") {
|
|
343
|
+
block.signature = delta.signature;
|
|
344
|
+
}
|
|
345
|
+
else if (delta.type === "input_json_delta" && typeof delta.partial_json === "string") {
|
|
346
|
+
inputs.set(event.index, `${inputs.get(event.index) ?? ""}${delta.partial_json}`);
|
|
347
|
+
}
|
|
348
|
+
else if (delta.type === "citations_delta") {
|
|
349
|
+
(block.citations ??= []).push(delta.citation);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
else if (event.type === "content_block_stop" && typeof event.index === "number") {
|
|
353
|
+
const written = inputs.get(event.index);
|
|
354
|
+
const block = content[event.index];
|
|
355
|
+
if (block?.type === "tool_use" && written !== undefined && written.trim()) {
|
|
356
|
+
// The pieces of the input are JSON only when they are all there: read them strictly.
|
|
357
|
+
try {
|
|
358
|
+
const input = JSON.parse(written);
|
|
359
|
+
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
360
|
+
throw new Error("not an object");
|
|
361
|
+
block.input = input;
|
|
362
|
+
}
|
|
363
|
+
catch {
|
|
364
|
+
block.input = {};
|
|
365
|
+
problems.set(event.index, `The arguments of this call were not valid JSON, and it was not run: ${written.slice(0, 300)}. Send the call again.`);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
else if (event.type === "message_delta") {
|
|
370
|
+
stopReason = event.delta?.stop_reason ?? stopReason;
|
|
371
|
+
stopDetails = event.delta?.stop_details ?? stopDetails;
|
|
372
|
+
usage = { ...usage, ...event.usage };
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
if (hooks.signal?.aborted || error instanceof AnthropicRequestError)
|
|
378
|
+
throw error;
|
|
379
|
+
// The connection went while the answer was on its way.
|
|
380
|
+
throw new AnthropicRequestError(`Claude could not be reached${unreachableReason(error)}.`, 0, { cause: error });
|
|
381
|
+
}
|
|
382
|
+
const blocks = content.filter(Boolean);
|
|
383
|
+
// The problems were noted by the place of the block in the stream: the same place, with no gaps, in what is kept.
|
|
384
|
+
const placed = new Map();
|
|
385
|
+
for (const [index, problem] of problems)
|
|
386
|
+
placed.set(blocks.indexOf(content[index]), problem);
|
|
387
|
+
return replyOf(blocks, stopReason, stopDetails, usage, placed, text);
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/anthropic/adapter.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,6FAA6F;AAC7F,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,aAAa,EAAE,iBAAiB,EAAwC,MAAM,YAAY,CAAC;AACjI,OAAO,EAAE,iBAAiB,EAAiK,MAAM,aAAa,CAAC;AAC/M,OAAO,EAAE,mBAAmB,EAAqB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,mIAAmI;AACnI,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IACjD,IAAI,CAAU;IACvB,YAAY,OAAe,EAAE,MAAc,EAAE,UAAqE,EAAE;QACl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EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YAClH,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvC,kHAAkH;YAClH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;YACzC,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,QAAQ;gBAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAE,CAAC,EAAE,OAAO,CAAC,CAAC;YAC9F,OAAO,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACvE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/anthropic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC9H,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/anthropic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/ask.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { type Evidence } from "./evidence.js";
|
|
2
|
+
import type { LargeFiles } from "./library.js";
|
|
3
|
+
import { type ChatMessage, type ModelAdapter, type ToolTurn, type UsageTotals } from "./model.js";
|
|
4
|
+
import { type RetryOptions } from "./retry.js";
|
|
5
|
+
import type { Budget, DocumentPlan } from "./types.js";
|
|
6
|
+
/** Sent (invisibly to the user) when the model must stop using tools and answer. */
|
|
7
|
+
export declare const FINAL_ANSWER_REQUEST = "Stop using tools now. Answer my question using only what the tools returned above, with line citations. Say plainly what you could not find.";
|
|
8
|
+
/** The same, when the only tool was `view_pages`: the text of the files is in the prompt, not in tool results. */
|
|
9
|
+
export declare const FINAL_ANSWER_AFTER_PAGES = "Stop using tools now. Answer my question from the text of the files and the pages you looked at. Say plainly what you could not see or find.";
|
|
10
|
+
/** Sent to the answering model when an explorer model used no tool, so there is no tool result to answer from. */
|
|
11
|
+
export declare const FINAL_ANSWER_WITHOUT_TOOLS = "Answer my question now, from what is in this conversation. No tools are available for this reply: if the answer needs a part of a file that is not shown here, say so plainly.";
|
|
12
|
+
/**
|
|
13
|
+
* Added to the system instruction of an explorer model's requests: it gathers what the answer
|
|
14
|
+
* needs, and the other model writes the answer.
|
|
15
|
+
*/
|
|
16
|
+
export declare const EXPLORER_INSTRUCTION = "You only gather material in this conversation: another model writes the answer. It sees this conversation and what your tool calls returned, not what you thought or wrote. So call the tools until their results hold everything the answer needs from the files. Then, or at once if no tool is needed, reply with the single word DONE instead of an answer.";
|
|
17
|
+
/** The limits of one question. */
|
|
18
|
+
export type AskLimits = {
|
|
19
|
+
/**
|
|
20
|
+
* The most model requests of the chat for one question, counting the answer. Tools can run in
|
|
21
|
+
* all but the last: if the model is still calling tools then, the last request must be answered
|
|
22
|
+
* in text. Defaults to 12. With an explorer model the answer is always a request of its own, so
|
|
23
|
+
* the explorer has one less than this.
|
|
24
|
+
*/
|
|
25
|
+
toolTurns?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The most tool calls of one model turn that are run. A turn with more gets an error for each
|
|
28
|
+
* of the others, which tells the model to send it again if it is still needed. Defaults to 8.
|
|
29
|
+
*/
|
|
30
|
+
callsPerTurn?: number;
|
|
31
|
+
/**
|
|
32
|
+
* How many times each document may be read whole (`analyze_whole_document`) for one question.
|
|
33
|
+
* One read of a large file is up to `maxMapChunks` model requests. Defaults to 1; 0 refuses
|
|
34
|
+
* every whole-file read.
|
|
35
|
+
*/
|
|
36
|
+
wholeDocumentReads?: number;
|
|
37
|
+
/**
|
|
38
|
+
* A ceiling on the input tokens of one question, over all its requests, whole-file part reads
|
|
39
|
+
* included. Once it is reached no more tools run and the next request is the answer; a
|
|
40
|
+
* whole-file read that would pass it is refused. Unset: no ceiling.
|
|
41
|
+
*/
|
|
42
|
+
inputTokens?: number;
|
|
43
|
+
/** The same ceiling, on the number of model requests: the chat's and the part reads' together. */
|
|
44
|
+
requests?: number;
|
|
45
|
+
};
|
|
46
|
+
export type AskOptions = {
|
|
47
|
+
files: LargeFiles;
|
|
48
|
+
/**
|
|
49
|
+
* The model that answers. With an `explorer` it only writes the answer, from what the explorer's
|
|
50
|
+
* tool calls returned. Without one it does both.
|
|
51
|
+
*/
|
|
52
|
+
model: ModelAdapter;
|
|
53
|
+
/**
|
|
54
|
+
* A second model that explores the documents: it makes the tool calls (search, read, look at
|
|
55
|
+
* pages) and reads a whole file in parts. It may be of another provider than `model`. Left out,
|
|
56
|
+
* or the same adapter as `model`: one model does both.
|
|
57
|
+
*/
|
|
58
|
+
explorer?: ModelAdapter | undefined;
|
|
59
|
+
/** Documents this conversation may use. Where their text or cards go: see `documentPlacement`. */
|
|
60
|
+
documentIds: string[];
|
|
61
|
+
/**
|
|
62
|
+
* Where document text and cards are added. "first" (the default) puts them at the start of the
|
|
63
|
+
* first user turn, where they stay as the conversation grows, so a provider's prompt cache can
|
|
64
|
+
* reuse them on every follow-up question. "last" appends them to the latest user turn; the
|
|
65
|
+
* document then moves on every turn and is billed in full each time.
|
|
66
|
+
*/
|
|
67
|
+
documentPlacement?: "first" | "last";
|
|
68
|
+
/**
|
|
69
|
+
* The conversation; the last message must be the user's question. Plain turns
|
|
70
|
+
* (`{ role, text }`), the tool rounds an earlier question returned (`AskResult.toolTurns`), and
|
|
71
|
+
* turns with parts in the provider's own form (`{ role, parts: [{ text }, { native }] }`).
|
|
72
|
+
*/
|
|
73
|
+
messages: ChatMessage[];
|
|
74
|
+
system?: string;
|
|
75
|
+
/** The user asking. Documents ingested with a different owner are treated as missing. */
|
|
76
|
+
owner?: string;
|
|
77
|
+
limits?: AskLimits;
|
|
78
|
+
/** How a model request that failed is sent again. Defaults to three more tries, with a wait that doubles. */
|
|
79
|
+
retry?: RetryOptions;
|
|
80
|
+
/**
|
|
81
|
+
* Budget fields for this question, in place of the library's. The budget is also made to fit
|
|
82
|
+
* what the adapters say of their models (`capabilities.contextTokens`, `maxRequestBytes`).
|
|
83
|
+
*/
|
|
84
|
+
budget?: Partial<Budget>;
|
|
85
|
+
/** Offer `analyze_whole_document`, which reads a whole file in many model calls. Defaults to true. */
|
|
86
|
+
wholeDocumentAnalysis?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Offer `view_pages` for PDFs whose original file is kept (`keepOriginals`), so the model can
|
|
89
|
+
* look at pictures, charts and layout. Defaults to true. It is offered only when every model of
|
|
90
|
+
* the question can be sent a file, and changes nothing for a library that keeps no originals.
|
|
91
|
+
*/
|
|
92
|
+
viewPages?: boolean;
|
|
93
|
+
/** Answer text as it arrives. The adapter streams when this is set and it can. */
|
|
94
|
+
onText?: (delta: string) => void;
|
|
95
|
+
/** Short-lived status, such as "Searching app.log for “timeout”…". */
|
|
96
|
+
onActivity?: (text: string) => void;
|
|
97
|
+
/** A finished step, such as "Search app.log (exact) for “timeout” — 12 matching lines". */
|
|
98
|
+
onStep?: (text: string) => void;
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
};
|
|
101
|
+
export type AskResult = {
|
|
102
|
+
/**
|
|
103
|
+
* Everything the model wrote, including any remark it made before calling a tool. With an
|
|
104
|
+
* explorer model, only what the answering model wrote: the explorer's words are not shown.
|
|
105
|
+
*/
|
|
106
|
+
text: string;
|
|
107
|
+
/**
|
|
108
|
+
* False when the model's last turn had no text: the prompt was blocked, the reply was cut off
|
|
109
|
+
* before any text, or the model produced a malformed tool call. `text` may then be empty or
|
|
110
|
+
* hold only an earlier remark, so show your own message instead of treating it as the answer.
|
|
111
|
+
*/
|
|
112
|
+
answered: boolean;
|
|
113
|
+
/** Why the provider refused the prompt, when it did. */
|
|
114
|
+
blockReason?: string;
|
|
115
|
+
/** Every tool step taken, in order (also delivered through `onStep`). */
|
|
116
|
+
steps: string[];
|
|
117
|
+
/** What each tool call showed the model: the document, and the lines or pages. In call order. */
|
|
118
|
+
evidence: Evidence[];
|
|
119
|
+
/**
|
|
120
|
+
* The tool rounds of this question as plain JSON. Kept with the conversation and passed back in
|
|
121
|
+
* `messages` between this question and its answer, they let a later question use what was
|
|
122
|
+
* found here. Pages that were shown are not in them: only that they were.
|
|
123
|
+
*/
|
|
124
|
+
toolTurns: ToolTurn[];
|
|
125
|
+
/** Which documents went in whole and which were searched. */
|
|
126
|
+
plan: DocumentPlan;
|
|
127
|
+
/** The budget the question ran with: the library's, fitted to the models. */
|
|
128
|
+
budget: Budget;
|
|
129
|
+
/** Model requests made for the chat itself, an explorer model's among them (whole-document part reads not included). */
|
|
130
|
+
turns: number;
|
|
131
|
+
finishReason?: string;
|
|
132
|
+
/** Tokens and requests of the whole question, part reads included, in all and for each model. */
|
|
133
|
+
usage: UsageTotals;
|
|
134
|
+
/** The provider's own usage object of the last chat response, as it came. */
|
|
135
|
+
lastUsage?: Record<string, unknown>;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Answers a chat turn about large documents with any model that has an adapter.
|
|
139
|
+
* Documents that fit go into the prompt whole; otherwise the model gets search and read tools and
|
|
140
|
+
* this runs the tool loop, ending with a request that must be answered in text, so there is always
|
|
141
|
+
* an answer. With an `explorer`, that model runs the tool loop and `model` writes the answer.
|
|
142
|
+
*/
|
|
143
|
+
export declare function askWithFiles(options: AskOptions): Promise<AskResult>;
|
|
144
|
+
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.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