llm-large-files 0.4.1 → 0.7.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 +1400 -338
- package/README.md +217 -49
- package/dist/analyze.d.ts +5 -0
- package/dist/analyze.d.ts.map +1 -1
- package/dist/analyze.js +96 -47
- package/dist/analyze.js.map +1 -1
- package/dist/anthropic/adapter.d.ts +117 -0
- package/dist/anthropic/adapter.d.ts.map +1 -0
- package/dist/anthropic/adapter.js +542 -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 +200 -0
- package/dist/ask.d.ts.map +1 -0
- package/dist/ask.js +1402 -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/encoding.d.ts +17 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +852 -0
- package/dist/encoding.js.map +1 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +333 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +159 -0
- package/dist/events.js.map +1 -0
- package/dist/evidence.d.ts +42 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +138 -0
- package/dist/evidence.js.map +1 -0
- package/dist/extract.d.ts +35 -3
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +626 -58
- package/dist/extract.js.map +1 -1
- package/dist/gemini/adapter.d.ts +59 -0
- package/dist/gemini/adapter.d.ts.map +1 -0
- package/dist/gemini/adapter.js +226 -0
- package/dist/gemini/adapter.js.map +1 -0
- package/dist/gemini/chat.d.ts +53 -77
- package/dist/gemini/chat.d.ts.map +1 -1
- package/dist/gemini/chat.js +42 -300
- package/dist/gemini/chat.js.map +1 -1
- package/dist/gemini/errors.d.ts +16 -0
- package/dist/gemini/errors.d.ts.map +1 -0
- package/dist/gemini/errors.js +46 -0
- package/dist/gemini/errors.js.map +1 -0
- package/dist/gemini/generate.d.ts +18 -21
- package/dist/gemini/generate.d.ts.map +1 -1
- package/dist/gemini/generate.js +49 -92
- package/dist/gemini/generate.js.map +1 -1
- package/dist/gemini/index.d.ts +6 -4
- package/dist/gemini/index.d.ts.map +1 -1
- package/dist/gemini/index.js +4 -3
- 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 +136 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +401 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/library.d.ts +96 -8
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +414 -96
- package/dist/library.js.map +1 -1
- package/dist/map-reduce.d.ts +37 -1
- package/dist/map-reduce.d.ts.map +1 -1
- package/dist/map-reduce.js +255 -61
- package/dist/map-reduce.js.map +1 -1
- package/dist/model.d.ts +278 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +222 -0
- package/dist/model.js.map +1 -0
- package/dist/node/handlers.d.ts +20 -4
- package/dist/node/handlers.d.ts.map +1 -1
- package/dist/node/handlers.js +122 -20
- package/dist/node/handlers.js.map +1 -1
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/sse.d.ts +59 -0
- package/dist/node/sse.d.ts.map +1 -0
- package/dist/node/sse.js +174 -0
- package/dist/node/sse.js.map +1 -0
- package/dist/openai/adapter.d.ts +109 -0
- package/dist/openai/adapter.d.ts.map +1 -0
- package/dist/openai/adapter.js +567 -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 +42 -0
- package/dist/output-limit.d.ts.map +1 -0
- package/dist/output-limit.js +121 -0
- package/dist/output-limit.js.map +1 -0
- package/dist/pause.d.ts +24 -0
- package/dist/pause.d.ts.map +1 -0
- package/dist/pause.js +38 -0
- package/dist/pause.js.map +1 -0
- package/dist/pdf-pages.d.ts +32 -2
- package/dist/pdf-pages.d.ts.map +1 -1
- package/dist/pdf-pages.js +275 -14
- package/dist/pdf-pages.js.map +1 -1
- package/dist/pdf-pictures.d.ts +30 -3
- package/dist/pdf-pictures.d.ts.map +1 -1
- package/dist/pdf-pictures.js +50 -8
- package/dist/pdf-pictures.js.map +1 -1
- package/dist/pdf-work.d.ts +40 -0
- package/dist/pdf-work.d.ts.map +1 -0
- package/dist/pdf-work.js +734 -0
- package/dist/pdf-work.js.map +1 -0
- package/dist/plan.d.ts +22 -4
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +61 -12
- package/dist/plan.js.map +1 -1
- package/dist/retry.d.ts +76 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +141 -0
- package/dist/retry.js.map +1 -0
- package/dist/search.d.ts +8 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +60 -10
- package/dist/search.js.map +1 -1
- package/dist/sse.d.ts +36 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +153 -0
- package/dist/sse.js.map +1 -0
- package/dist/stores.d.ts.map +1 -1
- package/dist/stores.js +5 -2
- package/dist/stores.js.map +1 -1
- package/dist/text-index.d.ts +6 -0
- package/dist/text-index.d.ts.map +1 -1
- package/dist/text-index.js +25 -8
- package/dist/text-index.js.map +1 -1
- package/dist/text.d.ts +62 -2
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +314 -14
- package/dist/text.js.map +1 -1
- package/dist/tools.d.ts +72 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +341 -60
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +128 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/zip-directory.d.ts +43 -0
- package/dist/zip-directory.d.ts.map +1 -0
- package/dist/zip-directory.js +130 -0
- package/dist/zip-directory.js.map +1 -0
- package/docs/README.md +288 -0
- package/docs/api.md +58 -184
- package/docs/configuration.md +34 -490
- package/docs/getting-started.md +412 -177
- package/docs/guides/anthropic.md +590 -0
- package/docs/guides/conversations.md +629 -0
- package/docs/guides/costs-and-limits.md +726 -0
- package/docs/guides/deployment.md +654 -0
- package/docs/guides/errors-and-reliability.md +735 -0
- package/docs/guides/explorer-model.md +399 -0
- package/docs/guides/openai-compatible.md +602 -0
- package/docs/guides/own-adapter-and-loop.md +1169 -0
- package/docs/guides/pdfs.md +971 -0
- package/docs/guides/storage.md +731 -0
- package/docs/guides/testing.md +1199 -0
- package/docs/guides/vertex-and-gemini.md +717 -0
- package/docs/guides/web-app.md +1589 -0
- package/docs/how-it-works.md +1022 -138
- package/docs/measurements.md +881 -0
- package/docs/publishing.md +274 -46
- package/docs/reference/anthropic.md +427 -0
- package/docs/reference/ask.md +892 -0
- package/docs/reference/errors-and-retries.md +758 -0
- package/docs/reference/events.md +993 -0
- package/docs/reference/gemini.md +823 -0
- package/docs/reference/library.md +1467 -0
- package/docs/reference/node.md +528 -0
- package/docs/reference/openai.md +385 -0
- package/docs/reference/tools.md +883 -0
- package/docs/security.md +902 -90
- package/docs/troubleshooting.md +1390 -0
- package/package.json +22 -4
- package/src/analyze.ts +93 -42
- package/src/anthropic/adapter.ts +611 -0
- package/src/anthropic/index.ts +2 -0
- package/src/ask.ts +1560 -0
- package/src/budget.ts +71 -0
- package/src/encoding.ts +850 -0
- package/src/errors.ts +17 -0
- package/src/events.ts +442 -0
- package/src/evidence.ts +165 -0
- package/src/extract.ts +602 -62
- package/src/gemini/adapter.ts +271 -0
- package/src/gemini/chat.ts +87 -355
- package/src/gemini/errors.ts +48 -0
- package/src/gemini/generate.ts +67 -94
- package/src/gemini/index.ts +6 -4
- package/src/gemini/sse.ts +1 -34
- package/src/http.ts +434 -0
- package/src/index.ts +55 -4
- package/src/library.ts +497 -97
- package/src/map-reduce.ts +266 -59
- package/src/model.ts +433 -0
- package/src/node/handlers.ts +137 -22
- package/src/node/index.ts +2 -0
- package/src/node/sse.ts +198 -0
- package/src/openai/adapter.ts +613 -0
- package/src/openai/index.ts +2 -0
- package/src/output-limit.ts +135 -0
- package/src/pause.ts +41 -0
- package/src/pdf-pages.ts +268 -15
- package/src/pdf-pictures.ts +56 -9
- package/src/pdf-work.ts +722 -0
- package/src/plan.ts +68 -12
- package/src/retry.ts +176 -0
- package/src/search.ts +63 -10
- package/src/sse.ts +159 -0
- package/src/stores.ts +5 -2
- package/src/text-index.ts +26 -7
- package/src/text.ts +323 -13
- package/src/tools.ts +338 -62
- package/src/types.ts +129 -5
- package/src/zip-directory.ts +136 -0
package/dist/ask.d.ts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { type AskEvent, type EventStream } from "./events.js";
|
|
2
|
+
import { type Evidence } from "./evidence.js";
|
|
3
|
+
import type { LargeFiles } from "./library.js";
|
|
4
|
+
import { type ChatMessage, type ModelAdapter, type ToolTurn, type UsageTotals } from "./model.js";
|
|
5
|
+
import { type RetryOptions } from "./retry.js";
|
|
6
|
+
import type { Budget, DocumentPlan } from "./types.js";
|
|
7
|
+
/** Sent (invisibly to the user) when the model must stop using tools and answer. */
|
|
8
|
+
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.";
|
|
9
|
+
/** The same, when the only tool was `view_pages`: the text of the files is in the prompt, not in tool results. */
|
|
10
|
+
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.";
|
|
11
|
+
/**
|
|
12
|
+
* Sent when no tool ran (an explorer model called none, the first reply was empty, or no turn was
|
|
13
|
+
* left for tools), so there is no tool result to answer from.
|
|
14
|
+
*/
|
|
15
|
+
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.";
|
|
16
|
+
/**
|
|
17
|
+
* Added to the system instruction of an explorer model's requests: it gathers what the answer
|
|
18
|
+
* needs, and the other model writes the answer.
|
|
19
|
+
*/
|
|
20
|
+
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.";
|
|
21
|
+
/** The limits of one question. */
|
|
22
|
+
export type AskLimits = {
|
|
23
|
+
/**
|
|
24
|
+
* The most model requests of the chat for one question, counting the answer. Tools can run in
|
|
25
|
+
* all but the last: if the model is still calling tools then, the last request must be answered
|
|
26
|
+
* in text. Defaults to 12. With an explorer model the answer is always a request of its own, so
|
|
27
|
+
* the explorer has one less than this. An answer that comes back without text is asked for once
|
|
28
|
+
* more, and that request can be one past this.
|
|
29
|
+
*/
|
|
30
|
+
toolTurns?: number;
|
|
31
|
+
/**
|
|
32
|
+
* The most tool calls of one model turn that are run. A turn with more gets an error for each
|
|
33
|
+
* of the others, which tells the model to send it again if it is still needed. Defaults to 8.
|
|
34
|
+
*/
|
|
35
|
+
callsPerTurn?: number;
|
|
36
|
+
/**
|
|
37
|
+
* How many times each document may be read whole (`analyze_whole_document`) for one question.
|
|
38
|
+
* One read of a large file is up to `maxMapChunks` model requests. Defaults to 1; 0 refuses
|
|
39
|
+
* every whole-file read.
|
|
40
|
+
*/
|
|
41
|
+
wholeDocumentReads?: number;
|
|
42
|
+
/**
|
|
43
|
+
* A ceiling on the input tokens of one question, over all its requests, whole-file part reads
|
|
44
|
+
* included. Once it is reached no more tools run and the next request is the answer; a
|
|
45
|
+
* whole-file read that would pass it is refused. Unset: no ceiling.
|
|
46
|
+
*/
|
|
47
|
+
inputTokens?: number;
|
|
48
|
+
/** The same ceiling, on the number of model requests: the chat's and the part reads' together. */
|
|
49
|
+
requests?: number;
|
|
50
|
+
};
|
|
51
|
+
export type AskOptions = {
|
|
52
|
+
files: LargeFiles;
|
|
53
|
+
/**
|
|
54
|
+
* The model that answers. With an `explorer` it only writes the answer, from what the explorer's
|
|
55
|
+
* tool calls returned. Without one it does both.
|
|
56
|
+
*/
|
|
57
|
+
model: ModelAdapter;
|
|
58
|
+
/**
|
|
59
|
+
* A second model that explores the documents: it makes the tool calls (search, read, look at
|
|
60
|
+
* pages) and reads a whole file in parts. It may be of another provider than `model`. Left out,
|
|
61
|
+
* or the same adapter as `model`: one model does both.
|
|
62
|
+
*/
|
|
63
|
+
explorer?: ModelAdapter | undefined;
|
|
64
|
+
/** Documents this conversation may use. Where their text or cards go: see `documentPlacement`. */
|
|
65
|
+
documentIds: string[];
|
|
66
|
+
/**
|
|
67
|
+
* Where document text and cards are added. "first" (the default) puts them at the start of the
|
|
68
|
+
* first user turn, where they stay as the conversation grows, so a provider's prompt cache can
|
|
69
|
+
* reuse them on every follow-up question. "last" appends them to the latest user turn; the
|
|
70
|
+
* document then moves on every turn and is billed in full each time.
|
|
71
|
+
*/
|
|
72
|
+
documentPlacement?: "first" | "last";
|
|
73
|
+
/**
|
|
74
|
+
* The conversation; the last message must be the user's question. Plain turns
|
|
75
|
+
* (`{ role, text }`), the tool rounds an earlier question returned (`AskResult.toolTurns`), and
|
|
76
|
+
* turns with parts in the provider's own form (`{ role, parts: [{ text }, { native }] }`).
|
|
77
|
+
*/
|
|
78
|
+
messages: ChatMessage[];
|
|
79
|
+
system?: string;
|
|
80
|
+
/** The user asking. Documents ingested with a different owner are treated as missing. */
|
|
81
|
+
owner?: string;
|
|
82
|
+
limits?: AskLimits;
|
|
83
|
+
/** How a model request that failed is sent again. Defaults to three more tries, with a wait that doubles. */
|
|
84
|
+
retry?: RetryOptions;
|
|
85
|
+
/**
|
|
86
|
+
* Budget fields for this question, in place of the library's. The budget is also made to fit
|
|
87
|
+
* what the adapters say of their models (`capabilities.contextTokens`, `maxRequestBytes`).
|
|
88
|
+
*/
|
|
89
|
+
budget?: Partial<Budget>;
|
|
90
|
+
/**
|
|
91
|
+
* Offer `analyze_whole_document`, which reads a whole file in many model calls. Defaults to true.
|
|
92
|
+
* It is offered only when the model that uses the tools (`explorer`, or else `model`) has
|
|
93
|
+
* `generateText`.
|
|
94
|
+
*/
|
|
95
|
+
wholeDocumentAnalysis?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Offer `view_pages` for PDFs whose original file is kept (`keepOriginals`), so the model can
|
|
98
|
+
* look at pictures, charts and layout. Defaults to true. It is offered only when every model of
|
|
99
|
+
* the question can be sent a file, and changes nothing for a library that keeps no originals.
|
|
100
|
+
*/
|
|
101
|
+
viewPages?: boolean;
|
|
102
|
+
/** Answer text as it arrives. The adapter streams when this is set and it can (see `streamText`). */
|
|
103
|
+
onText?: (delta: string) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Whether to ask the model for the answer as it is written (the adapter's streaming request).
|
|
106
|
+
* Defaults to true when `onText` is given, false otherwise; `askStream` defaults it to true. With
|
|
107
|
+
* it, a reply that fails after its first piece of text is not sent again. New in 0.7.0.
|
|
108
|
+
*/
|
|
109
|
+
streamText?: boolean;
|
|
110
|
+
/** Short-lived status, such as "Searching app.log for “timeout”…". */
|
|
111
|
+
onActivity?: (text: string) => void;
|
|
112
|
+
/** A finished step, such as "Search app.log (exact) for “timeout” — 12 matching lines". */
|
|
113
|
+
onStep?: (text: string) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Everything the question does, as typed events in order: the plan, each model request, tool
|
|
116
|
+
* call, piece of text and notice, and last `run.finish` or `run.error`. The callbacks above get
|
|
117
|
+
* the same strings as before. It does not change how the model is asked: without `streamText`
|
|
118
|
+
* (or `onText`), the text of a reply comes in its `text` events once the reply is in. A throw
|
|
119
|
+
* from it ends the question with that error (on `run.finish`, the answer is lost: `askWithFiles`
|
|
120
|
+
* throws it; on `run.error`, it replaces the question's own error). `askStream` gives the events
|
|
121
|
+
* as an async iterable. New in 0.7.0.
|
|
122
|
+
*/
|
|
123
|
+
onEvent?: (event: AskEvent) => void;
|
|
124
|
+
/** The `runId` of the events. Defaults to one made for the question ("run_…"). */
|
|
125
|
+
runId?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Put each tool result in its `tool.end` event (`result`), and the tool rounds in the result that
|
|
128
|
+
* `run.finish` and `run.error` carry (`toolTurns`). Off by default: results hold the text of the
|
|
129
|
+
* documents, and events are often sent on to a browser.
|
|
130
|
+
*/
|
|
131
|
+
eventResults?: boolean;
|
|
132
|
+
signal?: AbortSignal;
|
|
133
|
+
};
|
|
134
|
+
export type AskResult = {
|
|
135
|
+
/**
|
|
136
|
+
* Everything the model wrote, including any remark it made before calling a tool. With an
|
|
137
|
+
* explorer model, only what the answering model wrote: the explorer's words are not shown.
|
|
138
|
+
*/
|
|
139
|
+
text: string;
|
|
140
|
+
/**
|
|
141
|
+
* False when the model's last turn had no text: the prompt was blocked, the reply was cut off
|
|
142
|
+
* before any text, or the model produced a malformed tool call. `text` may then be empty or
|
|
143
|
+
* hold only an earlier remark, so show your own message instead of treating it as the answer.
|
|
144
|
+
*/
|
|
145
|
+
answered: boolean;
|
|
146
|
+
/** Why the provider refused the prompt, when it did. */
|
|
147
|
+
blockReason?: string;
|
|
148
|
+
/** Every tool step taken, in order (also delivered through `onStep`). */
|
|
149
|
+
steps: string[];
|
|
150
|
+
/** What each tool call showed the model: the document, and the lines or pages. In call order. */
|
|
151
|
+
evidence: Evidence[];
|
|
152
|
+
/**
|
|
153
|
+
* The tool rounds of this question as plain JSON. Kept with the conversation and passed back in
|
|
154
|
+
* `messages` between this question and its answer, they let a later question use what was
|
|
155
|
+
* found here. Pages that were shown are not in them: only that they were.
|
|
156
|
+
*/
|
|
157
|
+
toolTurns: ToolTurn[];
|
|
158
|
+
/** Which documents went in whole and which were searched. */
|
|
159
|
+
plan: DocumentPlan;
|
|
160
|
+
/** The budget the question ran with: the library's, fitted to the models. */
|
|
161
|
+
budget: Budget;
|
|
162
|
+
/** Model requests made for the chat itself, an explorer model's among them (whole-document part reads not included). */
|
|
163
|
+
turns: number;
|
|
164
|
+
finishReason?: string;
|
|
165
|
+
/** Tokens and requests of the whole question, part reads included, in all and for each model. */
|
|
166
|
+
usage: UsageTotals;
|
|
167
|
+
/** The provider's own usage object of the last chat response, as it came. */
|
|
168
|
+
lastUsage?: Record<string, unknown>;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Shares `room` characters among tool calls whose results may be up to `caps` characters. A call
|
|
172
|
+
* gets no more than its cap, and the others split what it leaves. Calls that cannot each get
|
|
173
|
+
* `LEAST_ROOM_CHARACTERS` (or their cap, when it is smaller) are not run, the last ones first:
|
|
174
|
+
* their share is undefined.
|
|
175
|
+
*/
|
|
176
|
+
export declare function shareRoom(caps: number[], room: number): Array<number | undefined>;
|
|
177
|
+
/**
|
|
178
|
+
* What a question that failed had done before it failed: its tool steps, evidence, tool rounds and
|
|
179
|
+
* usage, with `answered: false`. `askWithFiles` throws the provider's error as it came (a
|
|
180
|
+
* `ModelRequestError` that was not worth sending again, or still failed after the retries); this
|
|
181
|
+
* gives what was found and paid for until then, so that an application can keep the tool rounds
|
|
182
|
+
* with the conversation and count the usage. Undefined for an error that did not come from a
|
|
183
|
+
* question under way (a document that is missing, a budget that does not work).
|
|
184
|
+
*/
|
|
185
|
+
export declare function partialResultOf(error: unknown): AskResult | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Answers a chat turn about large documents with any model that has an adapter.
|
|
188
|
+
* Documents that fit go into the prompt whole; otherwise the model gets search and read tools and
|
|
189
|
+
* this runs the tool loop, ending with a request that must be answered in text, so there is always
|
|
190
|
+
* an answer. With an `explorer`, that model runs the tool loop and `model` writes the answer.
|
|
191
|
+
*/
|
|
192
|
+
export declare function askWithFiles(options: AskOptions): Promise<AskResult>;
|
|
193
|
+
/**
|
|
194
|
+
* `askWithFiles` as a stream of its events, for a page that shows the question as it goes: see
|
|
195
|
+
* `AskEvent`. Leaving the loop early (`break`) stops the question. `result` is what `askWithFiles`
|
|
196
|
+
* returns. `onEvent`, when given, gets each event too, after the stream. The model is asked for
|
|
197
|
+
* the answer as it is written unless `streamText` is false. New in 0.7.0.
|
|
198
|
+
*/
|
|
199
|
+
export declare function askStream(options: AskOptions): EventStream<AskEvent, AskResult>;
|
|
200
|
+
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqD,KAAK,QAAQ,EAAsC,KAAK,WAAW,EAA4E,MAAM,aAAa,CAAC;AAC/N,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,YAAY,EAQjB,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAyC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAetF,OAAO,KAAK,EAAE,MAAM,EAAgB,YAAY,EAA4H,MAAM,YAAY,CAAC;AAE/L,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,iJAAiJ,CAAC;AACnL,kHAAkH;AAClH,eAAO,MAAM,wBAAwB,iJAAiJ,CAAC;AACvL;;;GAGG;AACH,eAAO,MAAM,0BAA0B,mLAAmL,CAAC;AAC3N;;;GAGG;AACH,eAAO,MAAM,oBAAoB,oWAAoW,CAAC;AAEtY,kCAAkC;AAClC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