llm-large-files 0.9.0 → 0.10.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.
Files changed (222) hide show
  1. package/CHANGELOG.md +500 -0
  2. package/README.md +13 -7
  3. package/dist/access.d.ts +45 -3
  4. package/dist/access.d.ts.map +1 -1
  5. package/dist/access.js +106 -3
  6. package/dist/access.js.map +1 -1
  7. package/dist/aggregate.d.ts +6 -0
  8. package/dist/aggregate.d.ts.map +1 -1
  9. package/dist/aggregate.js +86 -13
  10. package/dist/aggregate.js.map +1 -1
  11. package/dist/analyze.d.ts +4 -0
  12. package/dist/analyze.d.ts.map +1 -1
  13. package/dist/analyze.js +2 -2
  14. package/dist/analyze.js.map +1 -1
  15. package/dist/answer-info.d.ts +26 -0
  16. package/dist/answer-info.d.ts.map +1 -0
  17. package/dist/answer-info.js +32 -0
  18. package/dist/answer-info.js.map +1 -0
  19. package/dist/anthropic/adapter.d.ts +5 -1
  20. package/dist/anthropic/adapter.d.ts.map +1 -1
  21. package/dist/anthropic/adapter.js +35 -10
  22. package/dist/anthropic/adapter.js.map +1 -1
  23. package/dist/ask.d.ts +115 -14
  24. package/dist/ask.d.ts.map +1 -1
  25. package/dist/ask.js +572 -103
  26. package/dist/ask.js.map +1 -1
  27. package/dist/citations.d.ts +36 -0
  28. package/dist/citations.d.ts.map +1 -0
  29. package/dist/citations.js +298 -0
  30. package/dist/citations.js.map +1 -0
  31. package/dist/error-info.d.ts +13 -0
  32. package/dist/error-info.d.ts.map +1 -1
  33. package/dist/error-info.js +37 -1
  34. package/dist/error-info.js.map +1 -1
  35. package/dist/errors.d.ts +3 -1
  36. package/dist/errors.d.ts.map +1 -1
  37. package/dist/errors.js +3 -1
  38. package/dist/errors.js.map +1 -1
  39. package/dist/events.d.ts +27 -8
  40. package/dist/events.d.ts.map +1 -1
  41. package/dist/events.js.map +1 -1
  42. package/dist/evidence.d.ts.map +1 -1
  43. package/dist/evidence.js +21 -2
  44. package/dist/evidence.js.map +1 -1
  45. package/dist/extract.d.ts.map +1 -1
  46. package/dist/extract.js +6 -1
  47. package/dist/extract.js.map +1 -1
  48. package/dist/gemini/adapter.d.ts +35 -4
  49. package/dist/gemini/adapter.d.ts.map +1 -1
  50. package/dist/gemini/adapter.js +68 -29
  51. package/dist/gemini/adapter.js.map +1 -1
  52. package/dist/gemini/chat.d.ts +28 -55
  53. package/dist/gemini/chat.d.ts.map +1 -1
  54. package/dist/gemini/chat.js +20 -27
  55. package/dist/gemini/chat.js.map +1 -1
  56. package/dist/gemini/endpoints.d.ts +59 -11
  57. package/dist/gemini/endpoints.d.ts.map +1 -1
  58. package/dist/gemini/endpoints.js +33 -7
  59. package/dist/gemini/endpoints.js.map +1 -1
  60. package/dist/gemini/errors.d.ts +39 -5
  61. package/dist/gemini/errors.d.ts.map +1 -1
  62. package/dist/gemini/errors.js +70 -9
  63. package/dist/gemini/errors.js.map +1 -1
  64. package/dist/gemini/generate.d.ts +53 -2
  65. package/dist/gemini/generate.d.ts.map +1 -1
  66. package/dist/gemini/generate.js +100 -50
  67. package/dist/gemini/generate.js.map +1 -1
  68. package/dist/gemini/index.d.ts +3 -3
  69. package/dist/gemini/index.d.ts.map +1 -1
  70. package/dist/http.d.ts +41 -3
  71. package/dist/http.d.ts.map +1 -1
  72. package/dist/http.js +40 -2
  73. package/dist/http.js.map +1 -1
  74. package/dist/index.d.ts +7 -5
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +4 -2
  77. package/dist/index.js.map +1 -1
  78. package/dist/ingest.d.ts +9 -1
  79. package/dist/ingest.d.ts.map +1 -1
  80. package/dist/ingest.js +50 -25
  81. package/dist/ingest.js.map +1 -1
  82. package/dist/library.d.ts +129 -2
  83. package/dist/library.d.ts.map +1 -1
  84. package/dist/library.js +224 -149
  85. package/dist/library.js.map +1 -1
  86. package/dist/map-reduce.d.ts +176 -10
  87. package/dist/map-reduce.d.ts.map +1 -1
  88. package/dist/map-reduce.js +804 -58
  89. package/dist/map-reduce.js.map +1 -1
  90. package/dist/model.d.ts +36 -4
  91. package/dist/model.d.ts.map +1 -1
  92. package/dist/model.js +17 -1
  93. package/dist/model.js.map +1 -1
  94. package/dist/node/handlers.d.ts +29 -8
  95. package/dist/node/handlers.d.ts.map +1 -1
  96. package/dist/node/handlers.js +148 -126
  97. package/dist/node/handlers.js.map +1 -1
  98. package/dist/node/index.d.ts +1 -1
  99. package/dist/node/index.d.ts.map +1 -1
  100. package/dist/node/index.js.map +1 -1
  101. package/dist/node/ingest-child.js +2 -2
  102. package/dist/node/ingest-child.js.map +1 -1
  103. package/dist/node/spool.d.ts +9 -5
  104. package/dist/node/spool.d.ts.map +1 -1
  105. package/dist/node/spool.js +28 -15
  106. package/dist/node/spool.js.map +1 -1
  107. package/dist/node/sse.d.ts +6 -5
  108. package/dist/node/sse.d.ts.map +1 -1
  109. package/dist/node/sse.js +8 -7
  110. package/dist/node/sse.js.map +1 -1
  111. package/dist/openai/adapter.d.ts +5 -1
  112. package/dist/openai/adapter.d.ts.map +1 -1
  113. package/dist/openai/adapter.js +53 -12
  114. package/dist/openai/adapter.js.map +1 -1
  115. package/dist/output-limit.d.ts +2 -1
  116. package/dist/output-limit.d.ts.map +1 -1
  117. package/dist/output-limit.js +5 -2
  118. package/dist/output-limit.js.map +1 -1
  119. package/dist/pdf-outline.d.ts +71 -0
  120. package/dist/pdf-outline.d.ts.map +1 -0
  121. package/dist/pdf-outline.js +414 -0
  122. package/dist/pdf-outline.js.map +1 -0
  123. package/dist/plan.d.ts +137 -7
  124. package/dist/plan.d.ts.map +1 -1
  125. package/dist/plan.js +248 -26
  126. package/dist/plan.js.map +1 -1
  127. package/dist/prepare.d.ts +50 -0
  128. package/dist/prepare.d.ts.map +1 -0
  129. package/dist/prepare.js +207 -0
  130. package/dist/prepare.js.map +1 -0
  131. package/dist/ranged.d.ts +2 -1
  132. package/dist/ranged.d.ts.map +1 -1
  133. package/dist/ranged.js +16 -3
  134. package/dist/ranged.js.map +1 -1
  135. package/dist/search.d.ts +7 -0
  136. package/dist/search.d.ts.map +1 -1
  137. package/dist/search.js +72 -10
  138. package/dist/search.js.map +1 -1
  139. package/dist/stores.d.ts +6 -0
  140. package/dist/stores.d.ts.map +1 -1
  141. package/dist/stores.js +82 -11
  142. package/dist/stores.js.map +1 -1
  143. package/dist/tools.d.ts +22 -2
  144. package/dist/tools.d.ts.map +1 -1
  145. package/dist/tools.js +323 -76
  146. package/dist/tools.js.map +1 -1
  147. package/dist/types.d.ts +49 -1
  148. package/dist/types.d.ts.map +1 -1
  149. package/dist/whole-cost.d.ts +37 -0
  150. package/dist/whole-cost.d.ts.map +1 -0
  151. package/dist/whole-cost.js +46 -0
  152. package/dist/whole-cost.js.map +1 -0
  153. package/docs/README.md +4 -0
  154. package/docs/guides/anthropic.md +5 -2
  155. package/docs/guides/conversations.md +1 -1
  156. package/docs/guides/costs-and-limits.md +133 -36
  157. package/docs/guides/deployment.md +106 -13
  158. package/docs/guides/errors-and-reliability.md +158 -45
  159. package/docs/guides/explorer-model.md +4 -1
  160. package/docs/guides/openai-compatible.md +47 -7
  161. package/docs/guides/own-adapter-and-loop.md +33 -6
  162. package/docs/guides/pdfs.md +96 -7
  163. package/docs/guides/storage.md +46 -3
  164. package/docs/guides/testing.md +71 -0
  165. package/docs/guides/vertex-and-gemini.md +159 -50
  166. package/docs/guides/web-app.md +10 -6
  167. package/docs/how-it-works.md +120 -22
  168. package/docs/measurements.md +172 -5
  169. package/docs/publishing.md +76 -4
  170. package/docs/reference/anthropic.md +12 -7
  171. package/docs/reference/ask.md +264 -35
  172. package/docs/reference/errors-and-retries.md +30 -2
  173. package/docs/reference/events.md +27 -10
  174. package/docs/reference/gemini.md +189 -68
  175. package/docs/reference/library.md +190 -23
  176. package/docs/reference/node.md +51 -17
  177. package/docs/reference/openai.md +21 -10
  178. package/docs/reference/tools.md +273 -26
  179. package/docs/security.md +101 -12
  180. package/docs/troubleshooting.md +14 -12
  181. package/docs/upgrading-0.10.md +484 -0
  182. package/package.json +5 -1
  183. package/src/access.ts +127 -4
  184. package/src/aggregate.ts +92 -14
  185. package/src/analyze.ts +2 -2
  186. package/src/answer-info.ts +45 -0
  187. package/src/anthropic/adapter.ts +40 -11
  188. package/src/ask.ts +646 -106
  189. package/src/citations.ts +301 -0
  190. package/src/error-info.ts +36 -1
  191. package/src/errors.ts +3 -1
  192. package/src/events.ts +31 -7
  193. package/src/evidence.ts +21 -2
  194. package/src/extract.ts +6 -1
  195. package/src/gemini/adapter.ts +99 -32
  196. package/src/gemini/chat.ts +53 -82
  197. package/src/gemini/endpoints.ts +89 -16
  198. package/src/gemini/errors.ts +74 -11
  199. package/src/gemini/generate.ts +147 -57
  200. package/src/gemini/index.ts +3 -3
  201. package/src/http.ts +65 -4
  202. package/src/index.ts +7 -5
  203. package/src/ingest.ts +58 -27
  204. package/src/library.ts +336 -142
  205. package/src/map-reduce.ts +855 -67
  206. package/src/model.ts +44 -4
  207. package/src/node/handlers.ts +159 -118
  208. package/src/node/index.ts +1 -0
  209. package/src/node/ingest-child.ts +2 -2
  210. package/src/node/spool.ts +28 -14
  211. package/src/node/sse.ts +8 -7
  212. package/src/openai/adapter.ts +56 -13
  213. package/src/output-limit.ts +5 -2
  214. package/src/pdf-outline.ts +400 -0
  215. package/src/plan.ts +287 -36
  216. package/src/prepare.ts +253 -0
  217. package/src/ranged.ts +16 -3
  218. package/src/search.ts +69 -13
  219. package/src/stores.ts +76 -11
  220. package/src/tools.ts +327 -75
  221. package/src/types.ts +45 -1
  222. package/src/whole-cost.ts +64 -0
package/CHANGELOG.md CHANGED
@@ -36,6 +36,506 @@ Grouped by area. One or two lines each, written for an app developer, with the n
36
36
  matter.
37
37
  -->
38
38
 
39
+ ## 0.10.1 — 2026-11-25
40
+
41
+ A patch from the review of 0.10.0 against its code: a few pages said more, or less, than the code
42
+ does, `checkCitations` read a line number written with commas as its first digits, and one test
43
+ failed on a slow runner. The text sent to the model is the same as 0.10.0's.
44
+
45
+ ### Upgrading: what you need to change
46
+
47
+ Nothing. Code written for 0.10.0 compiles as it is, and the requests are byte for byte those of
48
+ 0.10.0.
49
+
50
+ ### New: what you can add
51
+
52
+ - `HeaderSource` and `HeaderContext` are exported: the type of `vertexAi({ headers })` and of a
53
+ headers function that takes `{ refresh }`
54
+ ([VertexAiOptions](docs/reference/gemini.md#vertexaioptions)).
55
+
56
+ ### Fixed
57
+
58
+ - **`checkCitations` read "(app.log L1,200)" as line 1.** A number written in groups of three after
59
+ commas is now one number ("L1,200", "line 12,345", "שורה 1,200"), in `AskResult.citations` too;
60
+ "L1,20" is still line 1.
61
+ - **Docs that did not match the code:**
62
+ - after a whole-file read with `output: "items"`, only the lines of its items count as shown, not
63
+ the whole file ([`CitationCheck`](docs/reference/ask.md#citationcheck));
64
+ - a reply over a table sent whole that ended for a reason asking again cannot mend (`"other"`) is
65
+ not asked for again ([Tables sent whole](docs/guides/costs-and-limits.md#tables-sent-whole));
66
+ - `body` of `askGemini` and `gemini()` reaches the chat requests, not the part reads of a
67
+ whole-file read, which take `analysisBody`: the upgrade guide's worked example labelled only
68
+ the chat requests, and now sets both
69
+ ([The worked example](docs/upgrading-0.10.md#the-worked-example));
70
+ - `has("aggregate_table")` is true while the text tools are declared; of two keyword passages with
71
+ one score, the one met first comes first, not always the earlier in the file;
72
+ `maxStuckStoreCalls` is half the libuv pool, at least 1; a Gemini error in a stream is retried
73
+ for 408 and 409 too; its `code` is its status only from 400 to 599; `location` is not checked
74
+ when `host` is given; the printed `VertexAiOptions` shows the fields it refuses;
75
+ - the 0.10.0 entry below and the upgrade guide: what the opt-outs do not give back (also the
76
+ prompts of merges, the answer to an unknown tool, and results cut in tokens), which finish
77
+ reasons 0.9 already did not ask again for, the 3-row rule (for tables sent whole only), the
78
+ item check (it takes out a short `\u` escape), and the mocks that need `stats` and `toolsFor`;
79
+ - `docs/measurements.md` listed thought signatures of earlier questions as if 0.10.0 sent them:
80
+ it ran them as a probe, and sends none.
81
+ - **Tests:** a search test that stops at a 5 ms budget ran out of time before its first match on a
82
+ Windows runner; it now doubles the budget until a scan finds lines.
83
+
84
+ ## 0.10.0 — 2026-11-25
85
+
86
+ Counts that are right and a cost that is bounded, for a chatbot on Gemini. Tables sent whole get
87
+ exact counts, files sent whole get line numbers, and every question has a ceiling on input tokens
88
+ by default. Answers say how they ended, a store that stops answering no longer holds a question or
89
+ a server, Gemini requests take fields of your own, and a PDF whose headings are set in larger type,
90
+ Hebrew included, gets an outline. The text sent to the model changes on purpose, all at once: each
91
+ chat with files misses the provider's prompt cache once at the upgrade.
92
+ [Upgrading to 0.10](docs/upgrading-0.10.md) takes an application from 0.9.0 step by step, with the
93
+ Hebrew chatbot of the 0.9 guide carried over.
94
+
95
+ ### Upgrading: what you need to change
96
+
97
+ Code written for 0.9.0 compiles with 0.10.0, except in these cases
98
+ ([Does my code compile?](docs/upgrading-0.10.md#does-my-code-compile)):
99
+
100
+ - `NoticeCode` has two new members, `"answer_filtered"` and `"answer_cut"`; `ToolOutcome` one,
101
+ `"redacted"`; and `ModelReply.finish` one, `"other"`, which the `finish` of a `request.end` event
102
+ has too. An exhaustive `switch` over any of them, or a `Record` keyed by it, needs them. The new
103
+ `AskResult.finish` has the same members.
104
+ - The plan of `run.finish` and `run.error` (`EventResult.plan`) holds
105
+ `Omit<DocumentMeta, "owner" | "scope" | "sha256" | "original" | "metaVersion">`, and the result
106
+ of `eventResults: true` leaves those fields out at run time too. Code that reads them there fails
107
+ with TS2339. Read them from `AskResult.plan`.
108
+ - `createLargeFiles` returns `CreatedLargeFiles`, a `LargeFiles` whose `stats()` and `toolsFor()`
109
+ are required. A value typed `ReturnType<typeof createLargeFiles>` and made by hand (a mock), or a
110
+ variable whose type was inferred from it and that you later give a `LargeFiles` of your own,
111
+ fails with TS2322. Type it `LargeFiles`.
112
+ - `DocumentHandlers` has a required `stats()`. A `DocumentHandlers` made by hand (a mock) fails
113
+ with TS2741.
114
+ - `LargeFiles` has two new optional methods, `stats` and `toolsFor`. A `LargeFiles` of your own
115
+ with a member of either name and another type fails with TS2322 or TS2416. Rename it.
116
+ - `vertexAi` takes `VertexAiOptions`, a union of the token form and express mode (`apiKey`), and
117
+ its token function is typed with its `{ refresh }` argument. A value typed
118
+ `Parameters<typeof vertexAi>[0]` whose `project` you read as a string, or whose `accessToken`
119
+ you call with no argument, fails with TS2322 or TS2554. Type it
120
+ `Extract<VertexAiOptions, { project: string }>`, and call `accessToken({ refresh: false })`.
121
+ - A subclass of `UsageMeter` whose `add` takes a parameter of its own after `usage` fails with
122
+ TS2416: `add(model, usage, estimatedInputTokens?)` takes that place. Put yours after it.
123
+
124
+ The other changes to the public types add exports, options, fields and optional members.
125
+ `ModelReply.responseId` and `responseModel`, `ExtractedText.headings`, `ToolSet.wholeReadsLeft` and
126
+ `PreparedContext.toolable` are optional, so an adapter, an extractor, a tool set or a `LargeFiles`
127
+ of your own still compiles, unless it already has a field of the same name and another type. The
128
+ type of `askGemini`'s options is now `Omit<AskOptions, "model" | "explorer" | "messages"> &
129
+ GeminiOwnOptions`: no field was removed, and every option of `askWithFiles` reaches the loop. No
130
+ export was removed or renamed. The new exports are under **New**.
131
+
132
+ Some behavior is different. Check each point against your app:
133
+
134
+ - **One prompt-cache miss for each chat with files at the upgrade.** The text sent changes once:
135
+ files sent whole are numbered (`12| `), and when no file is searched the system text gets the
136
+ line `Cite line numbers like (report.docx L12).`; a table sent whole gets three tool
137
+ declarations, its `document_id` in its frame line, and a line of the system text that says to
138
+ count with them; `analyze_whole_document` is declared with two more arguments, `output` and
139
+ `labels`; the closing request after files shown in full asks for an answer from those files and
140
+ what the tools returned, with line citations, where 0.9's named only what the tools returned; and
141
+ on a card, a size between 999,500 and 999,999 tokens reads "1.0M", and one between 1,048,064 and
142
+ 1,048,575 bytes "1 MB", on a card and in `get_document_overview`'s `size` (LLF-059); error
143
+ messages that print a size in that range (upload and text limits, `view_pages`) read "1 MB" too.
144
+ After that one miss, the cache works across questions as in 0.9: a follow-up still differs from
145
+ its first stored round, which goes back as its calls.
146
+ **What to do:** nothing; the first question of each chat after the deploy costs its full input
147
+ ([Prompt caching](docs/guides/costs-and-limits.md#prompt-caching)).
148
+ - **A ceiling on input tokens by default.** A question that sets no `limits.inputTokens` stops
149
+ calling tools once what it spent, its next tool request and the answer would pass the larger of
150
+ `DEFAULT_INPUT_TOKENS` (1,000,000) and `toolTurns` times the estimate of its first request, plus
151
+ room for the whole-file reads it may make. It looks ahead before each tool request, and a request
152
+ that reports no input counts by its estimate. A question of four tool turns over a 3 MB log uses
153
+ less than half of it.
154
+ **What to do:** nothing, or set your own ceiling. `limits: { inputTokens: Infinity }` gives 0.9's
155
+ behavior ([The default ceiling](docs/guides/costs-and-limits.md#the-default-ceiling)).
156
+ - **At most 2 whole-file reads per question**, over all its documents. A third is refused with its
157
+ reason. **What to do:** `limits: { wholeReadsPerQuestion: Infinity }` gives 0.9's rule.
158
+ - **Tables sent whole get tools** (`inlineTables: "tools"`, the default of `askWithFiles` and
159
+ `askGemini`). A CSV, an XLSX workbook, or a DOCX, PPTX, PDF, HTML or Markdown file with a table of
160
+ at least 3 `| cell |` rows that is sent whole gets `search_document`, `read_document` and
161
+ `aggregate_table`, and the question runs the tool loop. A question with no count stays at one
162
+ request when the model answers at once; a count takes 2 or 3 (live, a median of 2 on both
163
+ models), each sending the table again; at most, about `toolTurns` times the first request (about
164
+ 1.5M input tokens for a CSV of 3,000 invoices), bounded by the ceiling. Live, input tokens on the
165
+ eval's cases shared with 0.9.0 were about 2.3 to 2.4 times 0.9.0's, and counts were right in 24
166
+ of 24 on both models
167
+ ([Measurements](docs/measurements.md#tables-sent-whole-p1s-live-gate)). Gemini 3.5 Flash-Lite
168
+ looks a row up with a tool even when the table is shown in full: 21 of 39 questions with no count
169
+ took one request (Gemini 3.8 Flash: 38 of 39), so a lookup takes 2, each sending the table. This
170
+ is recorded, not tuned. Limits sized for 0.9's one request (`toolTurns: 1`, `requests: 1`, an
171
+ `inputTokens` between one and two requests with the table) leave no tool turn: such a question
172
+ makes 0.9's one request, without tools.
173
+ **What to do:** nothing, or `inlineTables: "text"` for 0.9's cost and counts by eye
174
+ ([Tables sent whole](docs/guides/costs-and-limits.md#tables-sent-whole)).
175
+ - **Files sent whole are numbered** (`numberInline: true`, the default of `askWithFiles` and
176
+ `askGemini`), so that answers cite their lines: about 8% to 16% more tokens for each file, and a
177
+ file at the edge of `inlineTokens` may become a card. When no file is searched, the system text
178
+ gets the line `Cite line numbers like (report.docx L12).`.
179
+ **What to do:** nothing, or `numberInline: false` to send them as 0.9 did.
180
+ - **`AskResult.evidence` lists each file sent whole first**, as
181
+ `{ tool: "inline", documentId, document, lines: [[1, n]], whole: true }`, with no `callId`.
182
+ **What to do:** code that counts tool calls from evidence, or maps it to `tool.end`, skips the
183
+ entries without a `callId`.
184
+ - **What the opt-outs do not give back.** `inlineTables: "text"` and `numberInline: false` each
185
+ give 0.9's bytes for what they cover. With both, these stay: the `whole_file` hint of a
186
+ `read_document` result cut short, and the `filter_note` of `aggregate_table`; the declaration of
187
+ `analyze_whole_document` and the prompts of its part reads and merges (M8); the card sizes of
188
+ LLF-059; the loop's own answer to a call of an unknown tool ("Unknown tool “x”. The tools are:
189
+ …", LLF-049); and tool results cut to their room in tokens, at each document's own characters per
190
+ token, so a result cut at the room differs from 0.9's
191
+ ([What has a way back](docs/upgrading-0.10.md#going-back-to-09s-text)).
192
+ - **Rolling deploys.** What 0.10.0 stores is what 0.9 stores, so servers of both versions share a
193
+ store and nothing fails. But they send different text, so a chat answered by 0.9 and 0.10 servers
194
+ in turn misses the prompt cache on every switch.
195
+ **What to do:** deploy every server at once, or route each chat to one version until the rollout
196
+ ends. Run the sweep from a server of 0.10.0
197
+ ([Rolling deploys](docs/upgrading-0.10.md#rolling-deploys)).
198
+ - **Store calls have a time limit.** A `getMeta`, a read of a text, its index or its original, or a
199
+ `delete` that does not end within `storeTimeoutMs` (30 s) fails with a `DocumentStoreError` of
200
+ code `"ETIMEDOUT"` (503, to retry), where it hung. In a question, a store call that times out,
201
+ in a tool call or in a part of a whole-file read too, ends it with `run.error`: `execute` and
202
+ `executeWithFiles` throw it, where they returned an error result, and a page look at a hung
203
+ original is that error, where the model was told the file could not be read in time. While
204
+ `maxStuckStoreCalls` calls of the process are stuck past their limit (half of
205
+ `UV_THREADPOOL_SIZE`: 2 by default), store calls fail at once with code `"STORE_STUCK"` (503).
206
+ **What to do:** on servers that use a network volume, set `UV_THREADPOOL_SIZE=32`. Raise
207
+ `storeTimeoutMs` for a slow store, or set 0 for none
208
+ ([A store that stops answering](docs/guides/deployment.md#a-store-that-stops-answering)).
209
+ - **Transient system errors are 503 and retryable.** `ETIMEDOUT`, `ECONNRESET`, `ECONNREFUSED`,
210
+ `EPIPE`, `EAI_AGAIN`, `EAGAIN`, `EBUSY`, `EMFILE`, `ENFILE`, `ESTALE`, `EHOSTUNREACH` and
211
+ `ENETUNREACH` are 503 with `Retry-After: 5` in `errorInfoOf` and the upload handlers, and
212
+ `ENOSPC` and `EDQUOT` 503 with 30 s. They were 500, not to retry: "Upload failed (ETIMEDOUT)." is
213
+ now a 503. A path upload whose read does not answer within `ingestTimeoutMs` is such an
214
+ `ETIMEDOUT`, not the `IngestError` `"timeout"` (422) it was.
215
+ **What to do:** tell users to try again when `errorInfoOf(error).retryable` is true
216
+ ([Transient errors](docs/guides/errors-and-reliability.md#transient-errors-a-store-or-a-disk-that-does-not-answer)).
217
+ - **Gemini errors inside a stream, or in a reply of HTTP 200, are retried.** One with no numeric
218
+ code gets the status of its `google.rpc` name (`UNAVAILABLE` 503, `RESOURCE_EXHAUSTED` 429,
219
+ `DEADLINE_EXCEEDED` 504, 500 for a name it does not know), and a transient one is sent again up to
220
+ `retry.retries` times (3), unless text was already shown. It had status 200 and was not sent
221
+ again. A daily quota is still `"quota"`, and not sent again.
222
+ **What to do:** nothing.
223
+ - **Part reads that run out of time** are a `ModelRequestError` of kind `"timeout"` and status 0
224
+ in every adapter, sent again once after the first wait of `retry`. Before, it was the timer's
225
+ abort error, with no status. `timeoutMs: 0` now sets no limit; it aborted every part read at once.
226
+ **What to do:** nothing; `gemini({ timeoutMs })` and `askGemini`'s `timeoutMs` set the limit
227
+ ([Part reads](docs/guides/errors-and-reliability.md#part-reads-have-a-time-limit-of-their-own)).
228
+ - **Filtered and cut answers say so.** `result.finish` tells how the answer ended, an
229
+ `answer_filtered` or `answer_cut` notice comes before `run.finish`, and a reply that a filter or
230
+ another reason that asking again cannot mend ended (`finish` `"filtered"` or `"other"`) is not
231
+ asked for again. 0.9 already stopped so after the filters it knew; a reason it did not know made
232
+ 4 requests over a searched file, and now makes 2. Gemini's `MODEL_ARMOR`,
233
+ `IMAGE_PROHIBITED_CONTENT`, `IMAGE_RECITATION` and `IMAGE_OTHER` are now `"filtered"` (as
234
+ `IMAGE_SAFETY` was), and `OTHER`, `LANGUAGE` and four more `"other"`; they gave no finish.
235
+ `MALFORMED_RESPONSE` is now `"malformed_call"`: the turn is asked for once more.
236
+ **What to do:** switch on `answerInfoOf(result)` for the message to show. With
237
+ `filteredAnswer: "drop"`, take back streamed text when the notice has `discardText`
238
+ ([Filtered and cut answers](docs/guides/errors-and-reliability.md#filtered-and-cut-answers)).
239
+ - **A PDF ingested from 0.10.0 on** whose text gives fewer than 3 headings gets an outline from its
240
+ lines set at least 15% larger than its body, when 3 or more of them are found in its text. Its
241
+ card gains an "Outline" block, `get_document_overview` lists it, and search hits gain `section`.
242
+ A PDF with a title alone keeps the card and hits of 0.9. Documents already stored keep their
243
+ metadata until they are ingested again; `metaVersion` stays 1. A wrapper around the built-in PDF
244
+ extractor that returns only `text` and `pages` keeps the 0.9 outline.
245
+ **What to do:** pass `headings` on in such a wrapper (`{ ...extracted, text }`)
246
+ ([PDF outline](docs/guides/pdfs.md#pdf-outline)).
247
+ - **Tests that compare results, events or requests whole.** Requests change as the first point
248
+ says. `usage` gains `estimatedInputTokens` and `unmeasuredRequests` when a request reports no
249
+ input. Replies gain `responseId` and `responseModel` where the provider gives them. A malformed
250
+ call on the last tool turn now gets a closing request: one request more (LLF-048). The loop
251
+ answers a call of an unknown tool itself ("Unknown tool “x”. The tools are: …"), with outcome
252
+ `"refused"` and no `onActivity` line, where the tool set returned an `"error"`. A size between
253
+ 1,048,064 and 1,048,575 bytes reads "1 MB" on a card, in `get_document_overview` and in error
254
+ messages (LLF-059).
255
+ **What to do:** update the tests that compare these whole.
256
+
257
+ ### New: what you can add
258
+
259
+ **Answers and costs**
260
+
261
+ - **How an answer ended:** `AskResult.finish`, the notices `"answer_filtered"` and `"answer_cut"`,
262
+ `AskOptions.filteredAnswer` (`"keep"` or `"drop"`, with `discardText` on the notice), and
263
+ `answerInfoOf(result)` with `AnswerInfo`: one value to switch on, `"filtered"`, `"cut"`,
264
+ `"blocked"`, `"language"` (Gemini's `LANGUAGE`, not a filter), `"no_answer"` or `"other"`
265
+ ([Filtered and cut answers](docs/guides/errors-and-reliability.md#filtered-and-cut-answers)).
266
+ - **Citations checked:** `AskResult.citations` and `checkCitations` (`CitationCheck`). They read
267
+ "(name L12)", ranges, "line N", "Row N", and the Hebrew "שורה N" and "שורות N-M", and check each
268
+ against what the tools showed; a workbook's rows are unchecked (S3,
269
+ [CitationCheck](docs/reference/ask.md#citationcheck)).
270
+ - **`onToolResult`** (`ToolResultContext`, `ToolResultVerdict`): see each tool result before the
271
+ model does, and keep it, replace it (outcome `"redacted"`) or refuse it
272
+ ([Security](docs/security.md#tool-results-ontoolresult)).
273
+ - **Limits:** `limits.wholeReadsPerQuestion` and `DEFAULT_INPUT_TOKENS`; `UsageTotals`
274
+ `estimatedInputTokens` and `unmeasuredRequests`, and `UsageMeter.add(model, usage,
275
+ estimatedInputTokens?)` ([Costs and limits](docs/guides/costs-and-limits.md#the-limits-of-a-question)).
276
+ - **Response IDs:** `ModelReply.responseId` and `responseModel` from Gemini, OpenAI-compatible
277
+ servers and Claude, on `request.end` too.
278
+
279
+ **Tables and line numbers**
280
+
281
+ - `AskOptions.inlineTables` (`"tools"` by default) and `AskOptions.numberInline` (`true` by
282
+ default), also in `askGemini`. For loops of your own, `PrepareOptions.inlineTables` and
283
+ `numberInline` (off by default) and `PreparedContext.toolable`; and for the tool set,
284
+ `ToolOptions.inline` (the files sent whole) and `ToolOptions.declare` (exactly these tools), with
285
+ `declarationsFor(names)` and `ToolName`
286
+ ([Numbered lines and tables sent whole](docs/how-it-works.md#numbered-lines-and-tables-sent-whole)).
287
+
288
+ The chat of a Hebrew chatbot on Vertex AI and MongoDB:
289
+
290
+ ```ts
291
+ import { answerInfoOf, hashedScopeSegment } from "llm-large-files";
292
+ import { askGemini, vertexAi } from "llm-large-files/gemini";
293
+
294
+ const turn = { role: "user" as const, text: question };
295
+ const result = await askGemini({
296
+ files,
297
+ endpoint: vertexAi({ project, location: "global", model, accessToken }), // accessToken({ refresh })
298
+ body: { labels: { app: "chatbot", team: "hr" } }, // billing labels: no user IDs
299
+ documentIds: chat.documentIds,
300
+ messages: [...chat.messages, turn], // the stored turns and tool rounds, as in 0.9
301
+ owner: userId,
302
+ scope: [hashedScopeSegment(userId), chatId],
303
+ onMissingDocuments: "drop",
304
+ filteredAnswer: "drop",
305
+ });
306
+ const info = answerInfoOf(result); // complete, or why not: one switch for the Hebrew message
307
+ const answer = result.answered ? [{ role: "assistant" as const, text: result.text }] : [];
308
+ await chats.updateOne({ _id: chatId }, {
309
+ $push: { messages: { $each: [turn, ...result.toolTurns, ...answer] } }, // as in 0.9
310
+ });
311
+ ```
312
+
313
+ **Whole-file reads and tools**
314
+
315
+ - `analyze_whole_document` with `output: "items"` and `labels`: items judged by meaning, each
316
+ checked against its line, and counted by code (`total_items`, `counts_by_label`, `items`,
317
+ `unverified_items`, `parts_failed`, `parts_cut_short`; M9,
318
+ [Items](docs/reference/tools.md#items-output-items)).
319
+ - `notes_left_out` on a whole-read result, and `whole_file` on a `read_document` result cut short
320
+ of its range when a whole read would run.
321
+ - `ToolCallHooks.signal` (I9) and `ToolSet.wholeReadsLeft(documentId)`.
322
+
323
+ **Gemini and Vertex AI**
324
+
325
+ - `gemini()` and `askGemini` take `body`, `analysisBody` and `functionCallingMode` (`"AUTO"` or
326
+ `"VALIDATED"`), and `timeoutMs` for part reads; `askGemini` also `explorerBody`. Types
327
+ `GeminiRequestFields` and `GeminiOwnOptions` (A5,
328
+ [Fields of your own](docs/guides/vertex-and-gemini.md#fields-of-your-own-safety-settings-labels-and-more)).
329
+ - `answerWithoutTools` in `gemini()` and `askGemini`: `"omit"` (the default) or `"mode_none"` for
330
+ the request of the answer (NEW-answer-request-tools).
331
+ - `vertexAi({ headers, host, apiKey })` (`VertexAiOptions`); `apiKey` is Vertex AI express mode
332
+ (NEW-vertex-endpoint-options).
333
+ - `accessToken({ refresh })` and a `HeaderSource` that takes a context: after a 401, the request is
334
+ sent once more with a fresh token. `GeminiEndpoint.refreshable`
335
+ ([Access tokens](docs/guides/vertex-and-gemini.md#access-tokens-for-vertex-ai)).
336
+
337
+ **Operations**
338
+
339
+ - `storeTimeoutMs` (30,000), `sweepTimeoutMs` and `maxStuckStoreCalls` in `createLargeFiles`, and
340
+ the `DocumentStoreError` codes `"ETIMEDOUT"` and `"STORE_STUCK"`
341
+ ([Deployment](docs/guides/deployment.md#a-store-that-stops-answering)).
342
+ - `AccessOptions.signal`: ends the caller's own wait for the store.
343
+ - `files.stats()` (`LargeFilesStats`) and `handlers.stats()` (`DocumentHandlerStats`): counters for
344
+ metrics, alerts and readiness, read without a store call
345
+ ([files.stats()](docs/reference/library.md#filesstats)).
346
+ - `files.toolsFor(ids, options)` (I6), and the type `CreatedLargeFiles`.
347
+ - `sseMessageOf` sends `finish` and `citations` in `run.finish`.
348
+
349
+ **PDFs**
350
+
351
+ - `ExtractedText.headings`: a PDF's lines set larger than its body, with page, level and title,
352
+ and `skip`, how many lines above it on its page read the same (a contents list). The built-in
353
+ extractor returns them; an extractor of your own may too
354
+ ([PDF outline](docs/guides/pdfs.md#pdf-outline)).
355
+
356
+ ### Changed: what works differently
357
+
358
+ **Costs and limits**
359
+
360
+ - The ceiling on input tokens looks ahead before each tool request. A whole-file read is priced
361
+ before it starts by what its requests send: its numbered lines, its prompts, its merges, and the
362
+ heading line a part starts under. An items read is priced at its parts, with a frame of 650
363
+ tokens.
364
+ - A reply ended by a reason that asking again cannot mend (`"filtered"`, `"other"`) is neither
365
+ nudged nor asked for again. Over files sent whole alone (nothing searched or viewed), one with no
366
+ text that ended so, or at the output limit, ends the question without a closing request. Otherwise the closing request is made once, and
367
+ a filtered closing is not asked for again.
368
+ - The room for tool results is shared in tokens, at each document's own characters per token. A
369
+ result that would still pass the room is cut before the model gets it, in call order.
370
+ - A question that is stopped ends at once, even while `files.prepare`, a tool call or
371
+ `onToolResult` waits on a store that hangs.
372
+
373
+ **Tables, numbers and citations**
374
+
375
+ - A file sent whole counts as having a table, for the tools of `inlineTables: "tools"`, when it has
376
+ 3 rows of one table. Whether a searched file gets `aggregate_table` is decided by its format, as
377
+ in 0.9.
378
+ - `aggregate_table`: a filter that orders a column (`>`, `>=`, `<`, `<=`) against a value that
379
+ names another column compares the two cells of each row, and says so in `filter_note`. A column
380
+ letter works in every table. Over a table sent whole, a grouped result ends with a `cite` line.
381
+ - With an explorer, a question in which no file is searched, and a table sent whole gets the tools,
382
+ is run by the answering model alone: the files sent whole are not sent to two models.
383
+
384
+ **Whole-file reads, search and tools**
385
+
386
+ - Part reads send the part first and the task last, with the heading line the part starts under
387
+ first, and their system text marks the part as file content. Merges and the read's answer send
388
+ their notes first and the task last (M8).
389
+ - `analyze_whole_document` keeps 0.9.0's description word for word: items are told in `output`
390
+ only. A new description made Gemini 3.5 Flash-Lite skip whole reads.
391
+ - The item check counts a quote near its named line as verified (up to one letter in five
392
+ differs), finds a clause's line by the number it starts with, and takes out a `\u` escape with
393
+ fewer than four hex digits, which a model writes by mistake (the near check allows for the gap). The
394
+ rule asks for five to twelve words of the line, copied exactly.
395
+ - A whole read with more parts than `ToolCallLimits.maxRequests` is refused before any request; one
396
+ given `maxRequests` stops merging at it (`notes_left_out`, or `notes_only` when no request is left
397
+ for the answer). A whole read that could read no part is not tried again, even when
398
+ `maxWholeDocumentReads` is above 1.
399
+ - With `declare`, a tool set answers only the declared tools. `ToolSet.resultCharacters` is 600 for
400
+ a name the tool set does not answer.
401
+ - Exact search counts past 1,000,000 matching lines, within the time of a regex search (P8).
402
+ Keyword search keeps its top passages in a heap (P9).
403
+ - Measured live: Gemini 3.5 Flash-Lite's timeline of a diary read whole lost a date in about one
404
+ run in three, when a part replied `NOTHING RELEVANT`. An A/B with 0.9.0, 8 reads each, lost no
405
+ date on either. This is recorded as a limit of Flash-Lite, not tuned
406
+ ([Measurements](docs/measurements.md#whole-file-reads-and-items-package-t)).
407
+
408
+ **Gemini and other providers**
409
+
410
+ - A Gemini part read stopped by a filter or for an `"other"` reason is flagged as incomplete.
411
+ - A Vertex AI 401 with a token from a function is sent once more with a fresh token, in chat
412
+ requests, part reads and the explorer. A second 401 is the error; a refresh that throws keeps the
413
+ 401 as the error, with the refresh's error as its `cause`.
414
+ - A non-streamed Gemini reply that is a list of chunks is read chunk by chunk, and an error inside
415
+ a stream carries its `retryDelay`.
416
+ - `timeoutMs: 0` sets no limit in `openAiCompatible()` and `anthropic()` too.
417
+
418
+ **Storage and operations**
419
+
420
+ - Deletes of one library run one at a time, and one time limit covers a whole delete.
421
+ - `FileDocumentStore` writes a text longer than 1 Mi UTF-16 units in slices: a 50 MB put held the
422
+ event loop for 379 ms, and now for about 20 ms, with the same bytes.
423
+ - `FileDocumentStore` claims a removal by renaming the metadata to a name of its own, and counts
424
+ only its own removals.
425
+ - The upload handlers' calls to the disk past `uploadIdleTimeoutMs`, and ingest's store calls past
426
+ `ingestTimeoutMs`, count as stuck. At the limit, a sweep and ingest's store calls are refused too;
427
+ ingest's clean-up removal is not.
428
+
429
+ **PDFs**
430
+
431
+ - The outline of a PDF from type sizes: levels 1 to 3 from the sizes used by several headings, and
432
+ a title or cover line set larger than all of them is level 1. Not headings: table rows (a gap of
433
+ more than 3 times the type size between pieces), running headers and footers (a line repeated on
434
+ 3 or more pages, or on at least half of them), page numbers (lines that differ only by their
435
+ numbers, on at least half the pages, and that do not count up as section numbers do, on one page
436
+ or from page to page; the same number in a page's header and footer is one page number, while
437
+ headings that count up, such as "פרק 1" to "פרק 5" on the odd pages, are kept; chapters one to a
438
+ page, on pages in a row covering at least half the document, are taken for page numbers), lines
439
+ over 120 characters, and lines with fewer than 3 letters or more digits than letters. A PDF with
440
+ 3 or more text-rule headings keeps its outline, and the text of a PDF does not change.
441
+
442
+ **Release**
443
+
444
+ - The release workflow runs by hand as a dry run, the default: it builds and checks the tarball on
445
+ any branch or tag, then runs `npm publish --dry-run` in a job with no identity token
446
+ ([Publishing](docs/publishing.md#a-dry-run-of-the-release-workflow), LO-6).
447
+ - An eval suite of 48 Hebrew and English cases (in `evals/`, not published) replays its recorded
448
+ requests on every pull request. The prompt changes of this version were gated on it live, on
449
+ Gemini 3.5 Flash-Lite and 3.8 Flash: tables and line numbers by P1's gate (pass^3, at 64a4ec8),
450
+ whole-file reads and items by T's (at c1fbbb5)
451
+ ([Measurements](docs/measurements.md#tables-sent-whole-p1s-live-gate)). Each of its 96
452
+ recordings (48 cases on 2 models) replays against 0.10.0, so 0.10.0 sends the requests that were
453
+ recorded live, byte for byte but for keys and project IDs (T4;
454
+ [Testing](docs/guides/testing.md#the-librarys-own-evals)).
455
+
456
+ ### Fixed
457
+
458
+ **Questions and costs**
459
+
460
+ - **No ceiling by default, and a set one overshot (L5, L7):** a runaway question made 13 requests
461
+ and about 6.9M input tokens; a ceiling of 500,000 let 1,219,683 through, and never tripped when the
462
+ provider reported no usage.
463
+ - **L1:** results over tables of numbers took 2.22 times their room.
464
+ - **LLF-048:** on the last tool turn, the remark of a reply whose tool call could not be read was
465
+ taken for the answer.
466
+ - **LLF-049:** calls of unknown tools took room, and shortened earlier results.
467
+ - **LLF-058:** a whole-file read that had failed was priced again, instead of refused with its
468
+ reason.
469
+ - **N12:** a whole-file read passed `limits.requests`: 40 requests against 32, 42 through
470
+ `askWithFiles`.
471
+ - **A6, NEW-filtered-answer:** a reply that Gemini ended with `MODEL_ARMOR`, `OTHER`, `LANGUAGE` or
472
+ another reason 0.9 did not know (the image filters, `NO_IMAGE`, `TOO_MANY_TOOL_CALLS`,
473
+ `MISSING_THOUGHT_SIGNATURE`) cost 4 requests and gave no finish, and a filtered or cut answer
474
+ read as complete ("The employee's medical leave was", `answered: true`). A reason 0.10.0 does not
475
+ know either is still asked for again.
476
+ - **LO-7:** with `eventResults`, event plans held owner, scope, sha256 and original at run time.
477
+ - `alreadyShown` could point to a result that `onToolResult` replaced.
478
+
479
+ **Tables and citations**
480
+
481
+ - **NEW-inline-table-tools:** a CSV of 3,000 Hebrew invoices went whole with no tools, and its 750
482
+ late invoices were counted by eye. Live, counts over tables were right in 24 of 24 on both
483
+ models.
484
+ - **L12:** files sent whole had no line numbers, citation line or evidence.
485
+ - **LLF-059:** card sizes read "1024 KB" and "1000K", and so did the size of
486
+ `get_document_overview` and of some error messages; they read "1 MB" and "1.0M".
487
+ - **LLF-061:** `describe()` of a `read_document` call left out an end line given as a string
488
+ (`"250"`), which the tool reads: it now says "lines 1-250".
489
+
490
+ **Providers**
491
+
492
+ - **LLF-018:** a Gemini error in a stream or a reply of HTTP 200 with no numeric code had status
493
+ 200; a part read whose body of HTTP 200 held an error reported "The model returned no text".
494
+ - **LLF-034:** an OpenAI call without an ID got an ID in its tool message that the call itself did
495
+ not have.
496
+ - **LLF-035:** a stream without `index` that repeated the ID on every piece made one call per piece.
497
+ - **LLF-036:** an aborted part read waited for another question's request: 1.5 s after an abort at
498
+ 50 ms, now 51 ms.
499
+ - **LLF-056, A11:** the time limit of a Gemini part read (180 s) could not be changed, and a part
500
+ read failed after 6 minutes; a timeout was not of kind `"timeout"`.
501
+ - **LLF-057:** Gemini encoded tool files with its own base64, beside the shared cache.
502
+ - A Gemini part read whose body was a list of chunks kept only the first chunk, and missed an error
503
+ in a later one.
504
+ - A part read's time limit did not end the wait for a `fetch` that ignores its signal, in all three
505
+ adapters.
506
+
507
+ **Storage and operations**
508
+
509
+ - **NEW-store-call-timeout:** a store that did not answer held a question, `files.delete`, the
510
+ DELETE route and the upload handler's rollback delete forever.
511
+ - **Four stuck calls froze a pod:** with the default thread pool, every file call and DNS look-up of
512
+ the process waited.
513
+ - On Windows, two sweeps could count one document twice, and two deletes of one document could both
514
+ return true.
515
+
516
+ **PDFs**
517
+
518
+ - **An unnumbered Hebrew PDF had no outline** (HARNESS-LESSONS item 4): Hebrew has no capitals, and
519
+ pdf.js gives no blank lines. A Hebrew lease now gets its title, sections and subsections, and the
520
+ isolated child returns the same outline as the server.
521
+
522
+ **Docs**
523
+
524
+ - **A1:** the OpenAI recipe uses `reasoning_effort: "none"`, which tool calls on GPT-5.4 and later
525
+ need through Chat Completions.
526
+ - **DeepSeek:** in a request with tools, its thinking mode asks for the reasoning of every earlier
527
+ assistant turn, those of earlier questions included, and refuses a request without it (HTTP 400,
528
+ as DeepSeek's guide says). The library does not keep the reasoning of an earlier question, so the
529
+ guide says to turn thinking off for chat requests in a chat of several questions
530
+ ([DeepSeek](docs/guides/openai-compatible.md#deepseek)).
531
+
532
+ In all, this version fixes LLF-018, -034, -035, -036, -048, -049, -056, -057, -058, -059 and
533
+ -061. It closes the roadmap items A5, A6, A11, I6 (`files.toolsFor`), I9 (`ToolCallHooks.signal`),
534
+ L1, L5, L7, L12, M8, M9, N12, P8, P9, S3 (in part: the citation check), T4, the leftovers of 0.9.0
535
+ (LO-1, LO-2 (the write half), LO-3 to LO-7), NEW-answer-request-tools, NEW-filtered-answer,
536
+ NEW-inline-table-tools, NEW-store-call-timeout and NEW-vertex-endpoint-options, and the Hebrew PDF
537
+ outline (HARNESS-LESSONS item 4).
538
+
39
539
  ## 0.9.0 — 2026-11-24
40
540
 
41
541
  One server process for every user and chat. Every store call carries the scope and the owner of
package/README.md CHANGED
@@ -6,7 +6,8 @@ context window**.
6
6
  Your users upload a 50 MB log or a 900-page book. Your model connector accepts 10 MB per request
7
7
  and 1M tokens of context. This package bridges the gap:
8
8
 
9
- - **Files that fit** go into the prompt whole.
9
+ - **Files that fit** go into the prompt whole, with their lines numbered. A table sent whole still
10
+ gets tools, so its counts and sums are exact.
10
11
  - **Files that don't** become a short summary card, and the model gets tools to **search**,
11
12
  **read line ranges**, or **read the whole file in parts** (map-reduce). Answers cite line numbers.
12
13
  - **Pictures in a PDF** are not in its text. The model can **look at the real pages** when it
@@ -114,7 +115,8 @@ text is asked for again, a repeated call gets a pointer to the result already sh
114
115
  each file is read whole at most once a question.
115
116
 
116
117
  A question that fails throws `DocumentsNotFoundError` for a file that expired, was deleted, or
117
- belongs to another `owner`, `DocumentStoreError` when the store cannot be read, or a
118
+ belongs to another `owner`, `DocumentStoreError` when the store cannot be read or does not answer
119
+ within 30 s (`storeTimeoutMs`), or a
118
120
  `ModelRequestError` whose `kind` (`"rate_limit"`, `"quota"`, `"timeout"`, `"context_overflow"`, …)
119
121
  tells you what to show the user. `partialResultOf(error)` gives what it found and paid for:
120
122
  [Errors and reliability](docs/guides/errors-and-reliability.md).
@@ -256,13 +258,14 @@ What each model gets, and what it costs: [An explorer model](docs/guides/explore
256
258
  |---|---|
257
259
  | **Formats** | Text, Markdown, logs (UTF-8 and UTF-16, and Hebrew, Arabic, Cyrillic, Japanese and Western European text in its older encoding), JSON/JSONL, CSV/TSV, HTML (the text a browser shows), DOCX (headings, clause numbers, tables, notes and comments), PPTX (slides in show order, tables, speaker notes), XLSX (every sheet, a line per row, with its row number), PDF (text layer, with tables rebuilt so empty cells stay empty; pages with a picture are marked, and the model can look at the pages themselves; scans of up to 30 pages when PDFs are kept) |
258
260
  | **Logs** | Detected automatically; the card shows level counts, the time range, and the most frequent errors grouped by shape (`timeout after <n>ms to <ip>`) |
259
- | **Books and documents** | An outline of headings with line numbers, including Markdown, "Chapter 12", numbered sections, and Hebrew chapter titles |
260
- | **Counting** | Exact counts of matching lines, per hour, per code or per message shape, in one search; exact sums, averages and groups over the rows of a CSV, an Excel sheet or a table of a document with `aggregate_table`, which reads every row and runs no code |
261
+ | **Books and documents** | An outline of headings with line numbers, including Markdown, "Chapter 12", numbered sections, and Hebrew chapter titles; for a PDF, Hebrew included, the lines set in larger type (new in 0.10.0) |
262
+ | **Counting** | Exact counts of matching lines, per hour, per code or per message shape, in one search; exact sums, averages and groups over the rows of a CSV, an Excel sheet or a table of a document with `aggregate_table`, which reads every row and runs no code. Since 0.10.0 a table small enough to be sent whole gets these tools too |
263
+ | **Citations** | Answers cite line numbers, of files sent whole too (numbered since 0.10.0); `result.citations` checks each against what the tools showed, Hebrew forms ("שורה 12") included |
261
264
  | **Every language** | Search finds a Hebrew word with any prefix letter, words written with or without accents, quotes or gershayim either way; regex `\w` and `\b` know every script |
262
265
  | **Limits** | One budget covers tokens *and* request bytes, so files fit both your context window and your connector's payload limit. It assumes 1M tokens and 10 MB: set `budget.contextTokens` for your model's window (an adapter's `contextTokens` can only make it smaller) |
263
- | **Reliability** | Retries, waits on a silent model, recovery from a request too large, error kinds: see [Errors and reliability](docs/guides/errors-and-reliability.md) |
266
+ | **Reliability** | Retries, waits on a silent model, recovery from a request too large, error kinds, answers that say when a filter or the output limit stopped them, and a time limit on every store call, so a network volume that hangs does not hold a server: see [Errors and reliability](docs/guides/errors-and-reliability.md) |
264
267
  | **Models** | Gemini and Vertex AI, any OpenAI-compatible endpoint, Claude, or an adapter of your own. Two models of different providers can share a question |
265
- | **Cost** | Usage summed over every request of a question, for each model, with ceilings on whole-file reads, requests and input tokens |
268
+ | **Cost** | Usage summed over every request of a question, for each model, with ceilings on whole-file reads, requests and input tokens; since 0.10.0 every question has a ceiling on input tokens by default |
266
269
  | **Privacy** | Documents can belong to an `owner`; other users can't plan, read, or delete them |
267
270
  | **Hostile uploads** | Limits on the text, pages and time of one file; zip bombs and PDFs built to exhaust a server are refused when the checks recognize them, with a code (`"hostile"`); ingest pauses for other requests between pages and slices. Not every hostile file is refused, and some steps hold the server for a while: read untrusted uploads in child processes with `createIsolatedExtractors`, which refuses a file that runs out of memory or time while the server goes on ([Security](docs/security.md#uploads)) |
268
271
  | **Storage** | In memory, on disk with expiry, or your own store (Redis, S3, a database) |
@@ -271,7 +274,9 @@ What each model gets, and what it costs: [An explorer model](docs/guides/explore
271
274
 
272
275
  With `gemini-3.8-flash` on the Gemini API, a 5 MB log of about 1.27M tokens, over the 1M window,
273
276
  got the right root cause of an outage, citing the right lines, in about 60 s over 11 tool calls.
274
- Every live result with its date, model and setup, and what has not been run live, such as the
277
+ For 0.10.0, an eval of Hebrew and English questions ran three times each on `gemini-3.5-flash-lite`
278
+ and `gemini-3.8-flash`: counts over tables sent whole were right in 24 of 24 on both. Every live
279
+ result with its date, model and setup, and what has not been run live, such as the
275
280
  Claude adapter: [Measurements](docs/measurements.md).
276
281
 
277
282
  ## Documentation
@@ -309,6 +314,7 @@ Reference, one page per module:
309
314
  - [`llm-large-files/testing`](docs/reference/testing.md): `fakeModel` and `fakeFetch`, for your tests (new in 0.9.0).
310
315
 
311
316
  [Changelog](CHANGELOG.md): what each version changed, and what to change in your code when you upgrade.
317
+ [Upgrading to 0.10](docs/upgrading-0.10.md) takes an application from 0.9.0 step by step.
312
318
 
313
319
  Also: [How it works](docs/how-it-works.md), [Security](docs/security.md),
314
320
  [Troubleshooting](docs/troubleshooting.md) and [Measurements](docs/measurements.md). For