presubmit 0.1.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.
Files changed (220) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +51 -0
  3. package/THIRD_PARTY_NOTICES.md +24 -0
  4. package/apps/web/dist/assets/FileCode-CZZH52o7.js +5 -0
  5. package/apps/web/dist/assets/FileCode-DovDO7Jh.css +1 -0
  6. package/apps/web/dist/assets/SettingsPage-CRvOwdjt.js +4 -0
  7. package/apps/web/dist/assets/SettingsPage-UbYSCwJj.css +1 -0
  8. package/apps/web/dist/assets/TerminalPanel-0sw-J6YS.css +1 -0
  9. package/apps/web/dist/assets/TerminalPanel-BqUjPWav.js +16 -0
  10. package/apps/web/dist/assets/index-BhqNNFja.js +54 -0
  11. package/apps/web/dist/assets/index-DD8VXy8H.css +1 -0
  12. package/apps/web/dist/assets/presubmit-mark-BBQ19Fmr.svg +7 -0
  13. package/apps/web/dist/assets/presubmit-mark-busy-CwBC-7on.svg +8 -0
  14. package/apps/web/dist/assets/react-vendor-wiHys0m2.js +9 -0
  15. package/apps/web/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
  16. package/apps/web/dist/index.html +6 -0
  17. package/apps/web/dist/service-worker.js +11 -0
  18. package/dist/apps/server/src/agent-builder.js +204 -0
  19. package/dist/apps/server/src/attach.js +163 -0
  20. package/dist/apps/server/src/attachments.js +86 -0
  21. package/dist/apps/server/src/browser-access.js +131 -0
  22. package/dist/apps/server/src/check-provenance.js +95 -0
  23. package/dist/apps/server/src/check-supervisor.js +112 -0
  24. package/dist/apps/server/src/checks.js +402 -0
  25. package/dist/apps/server/src/child-collaboration-guidance.js +2 -0
  26. package/dist/apps/server/src/child-sessions.js +191 -0
  27. package/dist/apps/server/src/cli.js +162 -0
  28. package/dist/apps/server/src/conversation-search.js +12 -0
  29. package/dist/apps/server/src/coordinator-messages.js +72 -0
  30. package/dist/apps/server/src/dev-auth.js +54 -0
  31. package/dist/apps/server/src/dev-server.js +201 -0
  32. package/dist/apps/server/src/dev-worker.js +48 -0
  33. package/dist/apps/server/src/diagnostics.js +105 -0
  34. package/dist/apps/server/src/fast-mode.js +8 -0
  35. package/dist/apps/server/src/folder-picker.js +54 -0
  36. package/dist/apps/server/src/git-blobs.js +62 -0
  37. package/dist/apps/server/src/git-handoff.js +127 -0
  38. package/dist/apps/server/src/history-sources.js +59 -0
  39. package/dist/apps/server/src/hub.js +159 -0
  40. package/dist/apps/server/src/internal-transport.js +38 -0
  41. package/dist/apps/server/src/local-embeddings.js +70 -0
  42. package/dist/apps/server/src/ollama-setup.js +56 -0
  43. package/dist/apps/server/src/planning.js +30 -0
  44. package/dist/apps/server/src/project-agents.js +276 -0
  45. package/dist/apps/server/src/project-memory.js +94 -0
  46. package/dist/apps/server/src/projects.js +106 -0
  47. package/dist/apps/server/src/queued-launch.js +13 -0
  48. package/dist/apps/server/src/reply-search.js +172 -0
  49. package/dist/apps/server/src/review-context.js +60 -0
  50. package/dist/apps/server/src/review-refresh.js +14 -0
  51. package/dist/apps/server/src/reviewers.js +75 -0
  52. package/dist/apps/server/src/search-settings.js +22 -0
  53. package/dist/apps/server/src/semantic-history.js +186 -0
  54. package/dist/apps/server/src/server.js +4338 -0
  55. package/dist/apps/server/src/session-changes.js +181 -0
  56. package/dist/apps/server/src/session-router-settings.js +198 -0
  57. package/dist/apps/server/src/session-workspaces.js +135 -0
  58. package/dist/apps/server/src/sessions.js +579 -0
  59. package/dist/apps/server/src/shared-auth.js +70 -0
  60. package/dist/apps/server/src/shell-evaluator-settings.js +53 -0
  61. package/dist/apps/server/src/store.js +203 -0
  62. package/dist/apps/server/src/tailscale-process.js +115 -0
  63. package/dist/apps/server/src/tailscale-serve-worker.js +33 -0
  64. package/dist/apps/server/src/tailscale-serve.js +276 -0
  65. package/dist/apps/server/src/task-capacity.js +92 -0
  66. package/dist/apps/server/src/task-graph.js +190 -0
  67. package/dist/apps/server/src/task-logs.js +74 -0
  68. package/dist/apps/server/src/task-numbers.js +25 -0
  69. package/dist/apps/server/src/task-orchestrator.js +1088 -0
  70. package/dist/apps/server/src/terminal.js +182 -0
  71. package/dist/apps/server/src/terminals.js +80 -0
  72. package/dist/apps/server/src/tool-safety.js +2 -0
  73. package/dist/apps/server/src/workspace-lock.js +140 -0
  74. package/dist/apps/server/src/workspace-watcher.js +65 -0
  75. package/dist/apps/server/src/workspace.js +517 -0
  76. package/dist/packages/agent-pi/src/agent-builder-tool.js +32 -0
  77. package/dist/packages/agent-pi/src/agent-capabilities.js +44 -0
  78. package/dist/packages/agent-pi/src/ask-user.js +86 -0
  79. package/dist/packages/agent-pi/src/auth.js +510 -0
  80. package/dist/packages/agent-pi/src/check-tools.js +72 -0
  81. package/dist/packages/agent-pi/src/command-policy.js +246 -0
  82. package/dist/packages/agent-pi/src/coordinator-tools.js +122 -0
  83. package/dist/packages/agent-pi/src/fast-mode.js +67 -0
  84. package/dist/packages/agent-pi/src/file-tools.js +163 -0
  85. package/dist/packages/agent-pi/src/history-tool.js +40 -0
  86. package/dist/packages/agent-pi/src/history.js +34 -0
  87. package/dist/packages/agent-pi/src/index.js +177 -0
  88. package/dist/packages/agent-pi/src/ipc.js +314 -0
  89. package/dist/packages/agent-pi/src/jev-session-router.js +408 -0
  90. package/dist/packages/agent-pi/src/jev-tools.js +71 -0
  91. package/dist/packages/agent-pi/src/local-model.js +277 -0
  92. package/dist/packages/agent-pi/src/memory-tools.js +119 -0
  93. package/dist/packages/agent-pi/src/model.js +25 -0
  94. package/dist/packages/agent-pi/src/planning.js +206 -0
  95. package/dist/packages/agent-pi/src/resource-loader.js +23 -0
  96. package/dist/packages/agent-pi/src/review-tools.js +158 -0
  97. package/dist/packages/agent-pi/src/review-transition.js +73 -0
  98. package/dist/packages/agent-pi/src/review.js +40 -0
  99. package/dist/packages/agent-pi/src/routing.js +27 -0
  100. package/dist/packages/agent-pi/src/session-setup.js +118 -0
  101. package/dist/packages/agent-pi/src/shell-context.js +51 -0
  102. package/dist/packages/agent-pi/src/shell-policy.js +281 -0
  103. package/dist/packages/agent-pi/src/shell-safety.js +205 -0
  104. package/dist/packages/agent-pi/src/shell.js +121 -0
  105. package/dist/packages/agent-pi/src/snapshot-permissions.js +12 -0
  106. package/dist/packages/agent-pi/src/spike.js +41 -0
  107. package/dist/packages/agent-pi/src/task-tools.js +53 -0
  108. package/dist/packages/agent-pi/src/types.js +1 -0
  109. package/dist/packages/agent-pi/src/usage.js +30 -0
  110. package/dist/packages/agent-pi/src/worker.js +602 -0
  111. package/dist/packages/protocol/src/activity-summary.js +77 -0
  112. package/dist/packages/protocol/src/agents.js +301 -0
  113. package/dist/packages/protocol/src/browser-access.js +1 -0
  114. package/dist/packages/protocol/src/checks.js +40 -0
  115. package/dist/packages/protocol/src/child-sessions.js +28 -0
  116. package/dist/packages/protocol/src/command-policy.js +3 -0
  117. package/dist/packages/protocol/src/coordinator.js +135 -0
  118. package/dist/packages/protocol/src/delegation.js +40 -0
  119. package/dist/packages/protocol/src/git-diff.js +71 -0
  120. package/dist/packages/protocol/src/git-handoff.js +1 -0
  121. package/dist/packages/protocol/src/index.js +1 -0
  122. package/dist/packages/protocol/src/memory.js +46 -0
  123. package/dist/packages/protocol/src/metrics.js +70 -0
  124. package/dist/packages/protocol/src/planning.js +138 -0
  125. package/dist/packages/protocol/src/retrieval.js +36 -0
  126. package/dist/packages/protocol/src/reviewers.js +17 -0
  127. package/dist/packages/protocol/src/search.js +16 -0
  128. package/dist/packages/protocol/src/session-changes.js +29 -0
  129. package/dist/packages/protocol/src/session-router.js +123 -0
  130. package/dist/packages/protocol/src/shell-evaluator.js +43 -0
  131. package/dist/packages/protocol/src/task-graph.js +1 -0
  132. package/dist/packages/protocol/src/token-usage.js +17 -0
  133. package/dist/packages/protocol/src/user-questions.js +106 -0
  134. package/package.json +71 -0
  135. package/vendor/lancedb/NODEJS_THIRD_PARTY_LICENSES.md +668 -0
  136. package/vendor/lancedb/RUST_THIRD_PARTY_LICENSES.html +14607 -0
  137. package/vendor/lancedb/dist/arrow.d.ts +296 -0
  138. package/vendor/lancedb/dist/arrow.js +1145 -0
  139. package/vendor/lancedb/dist/arrow_type.d.ts +9 -0
  140. package/vendor/lancedb/dist/arrow_type.js +29 -0
  141. package/vendor/lancedb/dist/connection.d.ts +508 -0
  142. package/vendor/lancedb/dist/connection.js +298 -0
  143. package/vendor/lancedb/dist/embedding/embedding_function.d.ts +103 -0
  144. package/vendor/lancedb/dist/embedding/embedding_function.js +192 -0
  145. package/vendor/lancedb/dist/embedding/index.d.ts +37 -0
  146. package/vendor/lancedb/dist/embedding/index.js +108 -0
  147. package/vendor/lancedb/dist/embedding/openai.d.ts +16 -0
  148. package/vendor/lancedb/dist/embedding/openai.js +81 -0
  149. package/vendor/lancedb/dist/embedding/registry.d.ts +94 -0
  150. package/vendor/lancedb/dist/embedding/registry.js +221 -0
  151. package/vendor/lancedb/dist/embedding/transformers.d.ts +36 -0
  152. package/vendor/lancedb/dist/embedding/transformers.js +110 -0
  153. package/vendor/lancedb/dist/header.d.ts +162 -0
  154. package/vendor/lancedb/dist/header.js +217 -0
  155. package/vendor/lancedb/dist/index.d.ts +246 -0
  156. package/vendor/lancedb/dist/index.js +176 -0
  157. package/vendor/lancedb/dist/indices.d.ts +721 -0
  158. package/vendor/lancedb/dist/indices.js +166 -0
  159. package/vendor/lancedb/dist/materialized_view.d.ts +69 -0
  160. package/vendor/lancedb/dist/materialized_view.js +112 -0
  161. package/vendor/lancedb/dist/merge.d.ts +104 -0
  162. package/vendor/lancedb/dist/merge.js +120 -0
  163. package/vendor/lancedb/dist/native.d.ts +1193 -0
  164. package/vendor/lancedb/dist/native.js +688 -0
  165. package/vendor/lancedb/dist/oauth.d.ts +66 -0
  166. package/vendor/lancedb/dist/oauth.js +15 -0
  167. package/vendor/lancedb/dist/otel.d.ts +26 -0
  168. package/vendor/lancedb/dist/otel.js +114 -0
  169. package/vendor/lancedb/dist/permutation.d.ts +143 -0
  170. package/vendor/lancedb/dist/permutation.js +184 -0
  171. package/vendor/lancedb/dist/query.d.ts +663 -0
  172. package/vendor/lancedb/dist/query.js +966 -0
  173. package/vendor/lancedb/dist/rerankers/index.d.ts +5 -0
  174. package/vendor/lancedb/dist/rerankers/index.js +19 -0
  175. package/vendor/lancedb/dist/rerankers/rrf.d.ts +14 -0
  176. package/vendor/lancedb/dist/rerankers/rrf.js +28 -0
  177. package/vendor/lancedb/dist/sanitize.d.ts +32 -0
  178. package/vendor/lancedb/dist/sanitize.js +544 -0
  179. package/vendor/lancedb/dist/scannable.d.ts +92 -0
  180. package/vendor/lancedb/dist/scannable.js +200 -0
  181. package/vendor/lancedb/dist/schema.d.ts +16 -0
  182. package/vendor/lancedb/dist/schema.js +387 -0
  183. package/vendor/lancedb/dist/table.d.ts +1069 -0
  184. package/vendor/lancedb/dist/table.js +498 -0
  185. package/vendor/lancedb/dist/util.d.ts +14 -0
  186. package/vendor/lancedb/dist/util.js +77 -0
  187. package/vendor/lancedb/license_header.txt +2 -0
  188. package/vendor/lancedb/package.json +56 -0
  189. package/vendor/transformers/LICENSE +202 -0
  190. package/vendor/transformers/dist/transformers.cjs +30844 -0
  191. package/vendor/transformers/dist/transformers.mjs +31404 -0
  192. package/vendor/transformers/package.json +55 -0
  193. package/vendor/transformers/types/backends/onnx.d.ts +30 -0
  194. package/vendor/transformers/types/configs.d.ts +85 -0
  195. package/vendor/transformers/types/env.d.ts +110 -0
  196. package/vendor/transformers/types/generation/configuration_utils.d.ts +320 -0
  197. package/vendor/transformers/types/generation/logits_process.d.ts +354 -0
  198. package/vendor/transformers/types/generation/logits_sampler.d.ts +51 -0
  199. package/vendor/transformers/types/generation/parameters.d.ts +47 -0
  200. package/vendor/transformers/types/generation/stopping_criteria.d.ts +81 -0
  201. package/vendor/transformers/types/generation/streamers.d.ts +81 -0
  202. package/vendor/transformers/types/models/whisper/common_whisper.d.ts +8 -0
  203. package/vendor/transformers/types/models/whisper/generation_whisper.d.ts +76 -0
  204. package/vendor/transformers/types/models.d.ts +3684 -0
  205. package/vendor/transformers/types/ops/registry.d.ts +11 -0
  206. package/vendor/transformers/types/pipelines.d.ts +2402 -0
  207. package/vendor/transformers/types/processors.d.ts +924 -0
  208. package/vendor/transformers/types/tokenizers.d.ts +990 -0
  209. package/vendor/transformers/types/transformers.d.ts +13 -0
  210. package/vendor/transformers/types/utils/audio.d.ts +130 -0
  211. package/vendor/transformers/types/utils/constants.d.ts +2 -0
  212. package/vendor/transformers/types/utils/core.d.ts +98 -0
  213. package/vendor/transformers/types/utils/data-structures.d.ts +236 -0
  214. package/vendor/transformers/types/utils/devices.d.ts +18 -0
  215. package/vendor/transformers/types/utils/dtypes.d.ts +19 -0
  216. package/vendor/transformers/types/utils/generic.d.ts +11 -0
  217. package/vendor/transformers/types/utils/hub.d.ts +152 -0
  218. package/vendor/transformers/types/utils/image.d.ts +119 -0
  219. package/vendor/transformers/types/utils/maths.d.ts +280 -0
  220. package/vendor/transformers/types/utils/tensor.d.ts +418 -0
@@ -0,0 +1,663 @@
1
+ import { Table as ArrowTable, type IntoVector, RecordBatch } from "./arrow";
2
+ import { type IvfPqOptions } from "./indices";
3
+ import { JsFullTextQuery, RecordBatchIterator as NativeBatchIterator, Query as NativeQuery, Table as NativeTable, TakeQuery as NativeTakeQuery, VectorQuery as NativeVectorQuery } from "./native";
4
+ import { Reranker } from "./rerankers";
5
+ export declare function RecordBatchIterator(promisedInner: Promise<NativeBatchIterator>): AsyncGenerator<RecordBatch<any>, void, unknown>;
6
+ /**
7
+ * Options that control the behavior of a particular query execution
8
+ */
9
+ export interface QueryExecutionOptions {
10
+ /**
11
+ * The maximum number of rows to return in a single batch
12
+ *
13
+ * Batches may have fewer rows if the underlying data is stored
14
+ * in smaller chunks.
15
+ */
16
+ maxBatchLength?: number;
17
+ /**
18
+ * Timeout for query execution in milliseconds
19
+ */
20
+ timeoutMs?: number;
21
+ }
22
+ export type AnalyzePlanDistributedMetrics = "aggregate" | "per_worker" | "full";
23
+ export interface ColumnOrdering {
24
+ columnName: string;
25
+ ascending?: boolean;
26
+ nullsFirst?: boolean;
27
+ }
28
+ /**
29
+ * Options that control the behavior of a full text search
30
+ */
31
+ export interface FullTextSearchOptions {
32
+ /**
33
+ * The columns to search
34
+ *
35
+ * If not specified, all indexed columns will be searched.
36
+ * For now, only one column can be searched.
37
+ */
38
+ columns?: string | string[];
39
+ }
40
+ /** Common methods supported by all query types
41
+ *
42
+ * @see {@link Query}
43
+ * @see {@link VectorQuery}
44
+ *
45
+ * @hideconstructor
46
+ */
47
+ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery | NativeTakeQuery> implements AsyncIterable<RecordBatch> {
48
+ protected inner: NativeQueryType | Promise<NativeQueryType>;
49
+ /**
50
+ * @hidden
51
+ */
52
+ protected constructor(inner?: NativeQueryType | Promise<NativeQueryType>);
53
+ /**
54
+ * @hidden
55
+ */
56
+ protected doCall(fn: (inner: NativeQueryType) => void): void;
57
+ /**
58
+ * Return the native query used by the next terminal operation.
59
+ *
60
+ * @hidden
61
+ */
62
+ protected getInner(): Promise<NativeQueryType>;
63
+ /**
64
+ * Return only the specified columns.
65
+ *
66
+ * By default a query will return all columns from the table. However, this can have
67
+ * a very significant impact on latency. LanceDb stores data in a columnar fashion. This
68
+ * means we can finely tune our I/O to select exactly the columns we need.
69
+ *
70
+ * As a best practice you should always limit queries to the columns that you need. If you
71
+ * pass in an array of column names then only those columns will be returned.
72
+ *
73
+ * You can also use this method to create new "dynamic" columns based on your existing columns.
74
+ * For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
75
+ * seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
76
+ *
77
+ * To create dynamic columns you can pass in a Map<string, string>. A column will be returned
78
+ * for each entry in the map. The key provides the name of the column. The value is
79
+ * an SQL string used to specify how the column is calculated.
80
+ *
81
+ * For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
82
+ * input to this method would be:
83
+ * @example
84
+ * new Map([["combined", "a + b"], ["c", "c"]])
85
+ *
86
+ * Columns will always be returned in the order given, even if that order is different than
87
+ * the order used when adding the data.
88
+ *
89
+ * Note that you can pass in a `Record<string, string>` (e.g. an object literal). This method
90
+ * uses `Object.entries` which should preserve the insertion order of the object. However,
91
+ * object insertion order is easy to get wrong and `Map` is more foolproof.
92
+ */
93
+ select(columns: string[] | Map<string, string> | Record<string, string> | string): this;
94
+ /**
95
+ * Whether to return the row id in the results.
96
+ *
97
+ * This column can be used to match results between different queries. For
98
+ * example, to match results from a full text search and a vector search in
99
+ * order to perform hybrid search.
100
+ */
101
+ withRowId(): this;
102
+ /**
103
+ * @hidden
104
+ */
105
+ protected nativeExecute(options?: Partial<QueryExecutionOptions>): Promise<NativeBatchIterator>;
106
+ /**
107
+ * Execute the query and return the results as an @see {@link AsyncIterator}
108
+ * of @see {@link RecordBatch}.
109
+ *
110
+ * By default, LanceDb will use many threads to calculate results and, when
111
+ * the result set is large, multiple batches will be processed at one time.
112
+ * This readahead is limited however and backpressure will be applied if this
113
+ * stream is consumed slowly (this constrains the maximum memory used by a
114
+ * single query)
115
+ *
116
+ */
117
+ protected execute(options?: Partial<QueryExecutionOptions>): AsyncGenerator<RecordBatch<any>, void, unknown>;
118
+ /**
119
+ * @hidden
120
+ */
121
+ [Symbol.asyncIterator](): AsyncIterator<RecordBatch<any>>;
122
+ /** Collect the results as an Arrow @see {@link ArrowTable}. */
123
+ toArrow(options?: Partial<QueryExecutionOptions>): Promise<ArrowTable>;
124
+ /** Collect the results as an array of objects. */
125
+ toArray(options?: Partial<QueryExecutionOptions>): Promise<any[]>;
126
+ /**
127
+ * Generates an explanation of the query execution plan.
128
+ *
129
+ * @example
130
+ * import * as lancedb from "@lancedb/lancedb"
131
+ * const db = await lancedb.connect("./.lancedb");
132
+ * const table = await db.createTable("my_table", [
133
+ * { vector: [1.1, 0.9], id: "1" },
134
+ * ]);
135
+ * const plan = await table.query().nearestTo([0.5, 0.2]).explainPlan();
136
+ *
137
+ * @param verbose - If true, provides a more detailed explanation. Defaults to false.
138
+ * @returns A Promise that resolves to a string containing the query execution plan explanation.
139
+ */
140
+ explainPlan(verbose?: boolean): Promise<string>;
141
+ /**
142
+ * Executes the query and returns the physical query plan annotated with runtime metrics.
143
+ *
144
+ * This is useful for debugging and performance analysis, as it shows how the query was executed
145
+ * and includes metrics such as elapsed time, rows processed, and I/O statistics.
146
+ *
147
+ * @example
148
+ * import * as lancedb from "@lancedb/lancedb"
149
+ *
150
+ * const db = await lancedb.connect("./.lancedb");
151
+ * const table = await db.createTable("my_table", [
152
+ * { vector: [1.1, 0.9], id: "1" },
153
+ * ]);
154
+ *
155
+ * const plan = await table.query().nearestTo([0.5, 0.2]).analyzePlan();
156
+ *
157
+ * Example output (with runtime metrics inlined):
158
+ * AnalyzeExec verbose=true, metrics=[]
159
+ * ProjectionExec: expr=[id@3 as id, vector@0 as vector, _distance@2 as _distance], metrics=[output_rows=1, elapsed_compute=3.292µs]
160
+ * Take: columns="vector, _rowid, _distance, (id)", metrics=[output_rows=1, elapsed_compute=66.001µs, batches_processed=1, bytes_read=8, iops=1, requests=1]
161
+ * CoalesceBatchesExec: target_batch_size=1024, metrics=[output_rows=1, elapsed_compute=3.333µs]
162
+ * GlobalLimitExec: skip=0, fetch=10, metrics=[output_rows=1, elapsed_compute=167ns]
163
+ * FilterExec: _distance@2 IS NOT NULL, metrics=[output_rows=1, elapsed_compute=8.542µs]
164
+ * SortExec: TopK(fetch=10), expr=[_distance@2 ASC NULLS LAST], metrics=[output_rows=1, elapsed_compute=63.25µs, row_replacements=1]
165
+ * KNNVectorDistance: metric=l2, metrics=[output_rows=1, elapsed_compute=114.333µs, output_batches=1]
166
+ * LanceScan: uri=/path/to/data, projection=[vector], row_id=true, row_addr=false, ordered=false, metrics=[output_rows=1, elapsed_compute=103.626µs, bytes_read=549, iops=2, requests=2]
167
+ *
168
+ * @param distributedMetrics - How distributed worker metrics are displayed for remote query plans.
169
+ * Defaults to `"aggregate"`.
170
+ * @returns A query execution plan with runtime metrics for each step.
171
+ */
172
+ analyzePlan(distributedMetrics?: AnalyzePlanDistributedMetrics): Promise<string>;
173
+ /**
174
+ * Returns the schema of the output that will be returned by this query.
175
+ *
176
+ * This can be used to inspect the types and names of the columns that will be
177
+ * returned by the query before executing it.
178
+ *
179
+ * @returns An Arrow Schema describing the output columns.
180
+ */
181
+ outputSchema(): Promise<import("./arrow").Schema>;
182
+ }
183
+ export declare class StandardQueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery> extends QueryBase<NativeQueryType> implements ExecutableQuery {
184
+ constructor(inner?: NativeQueryType | Promise<NativeQueryType>);
185
+ /**
186
+ * A filter statement to be applied to this query.
187
+ *
188
+ * The filter should be supplied as an SQL query string. For example:
189
+ * @example
190
+ * x > 10
191
+ * y > 0 AND y < 100
192
+ * x > 5 OR y = 'test'
193
+ *
194
+ * Filtering performance can often be improved by creating a scalar index
195
+ * on the filter column(s).
196
+ *
197
+ * Calling this multiple times combines the filters with a logical AND rather
198
+ * than replacing the previous filter.
199
+ */
200
+ where(predicate: string): this;
201
+ /**
202
+ * A filter statement to be applied to this query.
203
+ * @see where
204
+ * @deprecated Use `where` instead
205
+ */
206
+ filter(predicate: string): this;
207
+ fullTextSearch(query: string | FullTextQuery, options?: Partial<FullTextSearchOptions>): this;
208
+ /**
209
+ * Set the maximum number of results to return.
210
+ *
211
+ * By default, a plain search has no limit. If this method is not
212
+ * called then every valid row from the table will be returned.
213
+ */
214
+ limit(limit: number): this;
215
+ /**
216
+ * Set the number of rows to skip before returning results.
217
+ *
218
+ * This is useful for pagination.
219
+ */
220
+ offset(offset: number): this;
221
+ /**
222
+ * Sort the results by the specified column(s).
223
+ * @returns This query builder.
224
+ */
225
+ orderBy(ordering: ColumnOrdering | ColumnOrdering[]): this;
226
+ /**
227
+ * Skip searching un-indexed data. This can make search faster, but will miss
228
+ * any data that is not yet indexed.
229
+ *
230
+ * Use {@link Table#optimize} to index all un-indexed data.
231
+ */
232
+ fastSearch(): this;
233
+ /**
234
+ * Control MemWAL read routing for this query.
235
+ *
236
+ * By default (unset), when the table carries a MemWAL write spec (see
237
+ * {@link Table#setLsmWriteSpec}), reads are routed through the LSM scanner so
238
+ * they also return data written via the `mergeInsert` LSM path that has not yet
239
+ * been compacted into the base table (the active/frozen in-memory memtables and
240
+ * the flushed generations), deduplicated by primary key; a table without a spec
241
+ * reads the base table.
242
+ *
243
+ * @param enable - `true` forces the LSM scanner and errors if the table has no
244
+ * MemWAL write spec. `false` bypasses the MemWAL and reads the base table only,
245
+ * even when a spec is present.
246
+ *
247
+ * Note: the LSM scanner does not support every query shape (e.g. reranking,
248
+ * hybrid search, `orderBy`). On a MemWAL table those shapes error unless
249
+ * `useLsm(false)` is set, because a base-only read would silently exclude
250
+ * un-compacted MemWAL data.
251
+ */
252
+ useLsm(enable: boolean): this;
253
+ }
254
+ /**
255
+ * An interface for a query that can be executed
256
+ *
257
+ * Supported by all query types
258
+ */
259
+ export interface ExecutableQuery {
260
+ }
261
+ /**
262
+ * A builder used to construct a vector search
263
+ *
264
+ * This builder can be reused to execute the query many times.
265
+ *
266
+ * @see {@link Query#nearestTo}
267
+ *
268
+ * @hideconstructor
269
+ */
270
+ export declare class VectorQuery extends StandardQueryBase<NativeVectorQuery> {
271
+ /**
272
+ * @hidden
273
+ */
274
+ constructor(inner: NativeVectorQuery | Promise<NativeVectorQuery>);
275
+ /**
276
+ * @hidden
277
+ */
278
+ protected doVectorCall(fn: (inner: NativeVectorQuery) => void): void;
279
+ /**
280
+ * Set the number of partitions to search (probe)
281
+ *
282
+ * This argument is only used when the vector column has an IVF PQ index.
283
+ * If there is no index then this value is ignored.
284
+ *
285
+ * The IVF stage of IVF PQ divides the input into partitions (clusters) of
286
+ * related values.
287
+ *
288
+ * The partition whose centroids are closest to the query vector will be
289
+ * exhaustiely searched to find matches. This parameter controls how many
290
+ * partitions should be searched.
291
+ *
292
+ * Increasing this value will increase the recall of your query but will
293
+ * also increase the latency of your query. The default value is 20. This
294
+ * default is good for many cases but the best value to use will depend on
295
+ * your data and the recall that you need to achieve.
296
+ *
297
+ * For best results we recommend tuning this parameter with a benchmark against
298
+ * your actual data to find the smallest possible value that will still give
299
+ * you the desired recall.
300
+ *
301
+ * For more fine grained control over behavior when you have a very narrow filter
302
+ * you can use `minimumNprobes` and `maximumNprobes`. This method sets both
303
+ * the minimum and maximum to the same value.
304
+ */
305
+ nprobes(nprobes: number): VectorQuery;
306
+ /**
307
+ * Set the minimum number of probes used.
308
+ *
309
+ * This controls the minimum number of partitions that will be searched. This
310
+ * parameter will impact every query against a vector index, regardless of the
311
+ * filter. See `nprobes` for more details. Higher values will increase recall
312
+ * but will also increase latency.
313
+ */
314
+ minimumNprobes(minimumNprobes: number): VectorQuery;
315
+ /**
316
+ * Set the maximum number of probes used.
317
+ *
318
+ * This controls the maximum number of partitions that will be searched. If this
319
+ * number is greater than minimumNprobes then the excess partitions will _only_ be
320
+ * searched if we have not found enough results. This can be useful when there is
321
+ * a narrow filter to allow these queries to spend more time searching and avoid
322
+ * potential false negatives.
323
+ */
324
+ maximumNprobes(maximumNprobes: number): VectorQuery;
325
+ distanceRange(lowerBound?: number, upperBound?: number): VectorQuery;
326
+ /**
327
+ * Set the number of candidates to consider during the search
328
+ *
329
+ * This argument is only used when the vector column has an HNSW index.
330
+ * If there is no index then this value is ignored.
331
+ *
332
+ * Increasing this value will increase the recall of your query but will
333
+ * also increase the latency of your query. The default value is 1.5*limit.
334
+ */
335
+ ef(ef: number): VectorQuery;
336
+ /**
337
+ * Set the vector column to query
338
+ *
339
+ * This controls which column is compared to the query vector supplied in
340
+ * the call to @see {@link Query#nearestTo}
341
+ *
342
+ * This parameter must be specified if the table has more than one column
343
+ * whose data type is a fixed-size-list of floats.
344
+ */
345
+ column(column: string): VectorQuery;
346
+ /**
347
+ * Set the distance metric to use
348
+ *
349
+ * When performing a vector search we try and find the "nearest" vectors according
350
+ * to some kind of distance metric. This parameter controls which distance metric to
351
+ * use. See @see {@link IvfPqOptions.distanceType} for more details on the different
352
+ * distance metrics available.
353
+ *
354
+ * Note: if there is a vector index then the distance type used MUST match the distance
355
+ * type used to train the vector index. If this is not done then the results will be
356
+ * invalid.
357
+ *
358
+ * By default "l2" is used.
359
+ */
360
+ distanceType(distanceType: Required<IvfPqOptions>["distanceType"]): VectorQuery;
361
+ /**
362
+ * A multiplier to control how many additional rows are taken during the refine step
363
+ *
364
+ * This argument is only used when the vector column has an IVF PQ index.
365
+ * If there is no index then this value is ignored.
366
+ *
367
+ * An IVF PQ index stores compressed (quantized) values. They query vector is compared
368
+ * against these values and, since they are compressed, the comparison is inaccurate.
369
+ *
370
+ * This parameter can be used to refine the results. It can improve both improve recall
371
+ * and correct the ordering of the nearest results.
372
+ *
373
+ * To refine results LanceDb will first perform an ANN search to find the nearest
374
+ * `limit` * `refine_factor` results. In other words, if `refine_factor` is 3 and
375
+ * `limit` is the default (10) then the first 30 results will be selected. LanceDb
376
+ * then fetches the full, uncompressed, values for these 30 results. The results are
377
+ * then reordered by the true distance and only the nearest 10 are kept.
378
+ *
379
+ * Note: there is a difference between calling this method with a value of 1 and never
380
+ * calling this method at all. Calling this method with any value will have an impact
381
+ * on your search latency. When you call this method with a `refine_factor` of 1 then
382
+ * LanceDb still needs to fetch the full, uncompressed, values so that it can potentially
383
+ * reorder the results.
384
+ *
385
+ * Note: if this method is NOT called then the distances returned in the _distance column
386
+ * will be approximate distances based on the comparison of the quantized query vector
387
+ * and the quantized result vectors. This can be considerably different than the true
388
+ * distance between the query vector and the actual uncompressed vector.
389
+ */
390
+ refineFactor(refineFactor: number): VectorQuery;
391
+ /**
392
+ * If this is called then filtering will happen after the vector search instead of
393
+ * before.
394
+ *
395
+ * By default filtering will be performed before the vector search. This is how
396
+ * filtering is typically understood to work. This prefilter step does add some
397
+ * additional latency. Creating a scalar index on the filter column(s) can
398
+ * often improve this latency. However, sometimes a filter is too complex or scalar
399
+ * indices cannot be applied to the column. In these cases postfiltering can be
400
+ * used instead of prefiltering to improve latency.
401
+ *
402
+ * Post filtering applies the filter to the results of the vector search. This means
403
+ * we only run the filter on a much smaller set of data. However, it can cause the
404
+ * query to return fewer than `limit` results (or even no results) if none of the nearest
405
+ * results match the filter.
406
+ *
407
+ * Post filtering happens during the "refine stage" (described in more detail in
408
+ * @see {@link VectorQuery#refineFactor}). This means that setting a higher refine
409
+ * factor can often help restore some of the results lost by post filtering.
410
+ */
411
+ postfilter(): VectorQuery;
412
+ /**
413
+ * If this is called then any vector index is skipped
414
+ *
415
+ * An exhaustive (flat) search will be performed. The query vector will
416
+ * be compared to every vector in the table. At high scales this can be
417
+ * expensive. However, this is often still useful. For example, skipping
418
+ * the vector index can give you ground truth results which you can use to
419
+ * calculate your recall to select an appropriate value for nprobes.
420
+ */
421
+ bypassVectorIndex(): VectorQuery;
422
+ addQueryVector(vector: IntoVector): VectorQuery;
423
+ rerank(reranker: Reranker): VectorQuery;
424
+ }
425
+ /**
426
+ * Create a string query whose vector/FTS routing is resolved against the active
427
+ * table schema when the query executes.
428
+ *
429
+ * @hidden
430
+ */
431
+ export declare function createAutoQuery(table: NativeTable, query: string, columns: string[] | null, getVector: (metadata: string) => Promise<Awaited<IntoVector>>): AutoQuery;
432
+ /**
433
+ * A query that returns a subset of the rows in the table.
434
+ *
435
+ * @hideconstructor
436
+ */
437
+ export declare class TakeQuery extends QueryBase<NativeTakeQuery> {
438
+ constructor(inner: NativeTakeQuery);
439
+ /**
440
+ * Control MemWAL read routing for this take query.
441
+ *
442
+ * `false` bypasses the MemWAL and reads the base table only — the escape hatch,
443
+ * since take-by-row-id/offset is not supported on the LSM scanner and, on a
444
+ * MemWAL table, auto-routes to it and errors otherwise.
445
+ *
446
+ * @param enable - `false` reads the base table only.
447
+ */
448
+ useLsm(enable: boolean): this;
449
+ }
450
+ /**
451
+ * A builder for automatic string searches.
452
+ *
453
+ * Automatic search determines whether to use full-text or vector search from
454
+ * the table revision selected for each execution. This builder exposes the
455
+ * common operations supported by both query families.
456
+ *
457
+ * @hideconstructor
458
+ */
459
+ export declare class AutoQuery extends StandardQueryBase<NativeQuery | NativeVectorQuery> {
460
+ private readonly createInner;
461
+ private readonly calls;
462
+ /** @hidden */
463
+ constructor(createInner: () => Promise<NativeQuery | NativeVectorQuery>);
464
+ /** @hidden */
465
+ protected doCall(fn: (inner: NativeQuery | NativeVectorQuery) => void): void;
466
+ /** @hidden */
467
+ protected getInner(): Promise<NativeQuery | NativeVectorQuery>;
468
+ }
469
+ /** A builder for LanceDB queries.
470
+ *
471
+ * @see {@link Table#query}, {@link Table#search}
472
+ *
473
+ * @hideconstructor
474
+ */
475
+ export declare class Query extends StandardQueryBase<NativeQuery> {
476
+ /**
477
+ * @hidden
478
+ */
479
+ constructor(tbl: NativeTable);
480
+ /**
481
+ * Find the nearest vectors to the given query vector.
482
+ *
483
+ * This converts the query from a plain query to a vector query.
484
+ *
485
+ * This method will attempt to convert the input to the query vector
486
+ * expected by the embedding model. If the input cannot be converted
487
+ * then an error will be thrown.
488
+ *
489
+ * By default, there is no embedding model, and the input should be
490
+ * an array-like object of numbers (something that can be used as input
491
+ * to Float32Array.from)
492
+ *
493
+ * If there is only one vector column (a column whose data type is a
494
+ * fixed size list of floats) then the column does not need to be specified.
495
+ * If there is more than one vector column you must use
496
+ * @see {@link VectorQuery#column} to specify which column you would like
497
+ * to compare with.
498
+ *
499
+ * If no index has been created on the vector column then a vector query
500
+ * will perform a distance comparison between the query vector and every
501
+ * vector in the database and then sort the results. This is sometimes
502
+ * called a "flat search"
503
+ *
504
+ * For small databases, with a few hundred thousand vectors or less, this can
505
+ * be reasonably fast. In larger databases you should create a vector index
506
+ * on the column. If there is a vector index then an "approximate" nearest
507
+ * neighbor search (frequently called an ANN search) will be performed. This
508
+ * search is much faster, but the results will be approximate.
509
+ *
510
+ * The query can be further parameterized using the returned builder. There
511
+ * are various ANN search parameters that will let you fine tune your recall
512
+ * accuracy vs search latency.
513
+ *
514
+ * Vector searches always have a `limit`. If `limit` has not been called then
515
+ * a default `limit` of 10 will be used. @see {@link Query#limit}
516
+ */
517
+ nearestTo(vector: IntoVector): VectorQuery;
518
+ nearestToText(query: string | FullTextQuery, columns?: string[]): Query;
519
+ }
520
+ /**
521
+ * Enum representing the types of full-text queries supported.
522
+ *
523
+ * - `Match`: Performs a full-text search for terms in the query string.
524
+ * - `MatchPhrase`: Searches for an exact phrase match in the text.
525
+ * - `Boost`: Boosts the relevance score of specific terms in the query.
526
+ * - `MultiMatch`: Searches across multiple fields for the query terms.
527
+ */
528
+ export declare enum FullTextQueryType {
529
+ Match = "match",
530
+ MatchPhrase = "match_phrase",
531
+ Boost = "boost",
532
+ MultiMatch = "multi_match",
533
+ Boolean = "boolean"
534
+ }
535
+ /**
536
+ * Enum representing the logical operators used in full-text queries.
537
+ *
538
+ * - `And`: All terms must match.
539
+ * - `Or`: At least one term must match.
540
+ */
541
+ export declare enum Operator {
542
+ And = "AND",
543
+ Or = "OR"
544
+ }
545
+ /**
546
+ * Enum representing the occurrence of terms in full-text queries.
547
+ *
548
+ * - `Must`: The term must be present in the document.
549
+ * - `Should`: The term should contribute to the document score, but is not required.
550
+ * - `MustNot`: The term must not be present in the document.
551
+ */
552
+ export declare enum Occur {
553
+ Should = "SHOULD",
554
+ Must = "MUST",
555
+ MustNot = "MUST_NOT"
556
+ }
557
+ /**
558
+ * Represents a full-text query interface.
559
+ * This interface defines the structure and behavior for full-text queries,
560
+ * including methods to retrieve the query type and convert the query to a dictionary format.
561
+ */
562
+ export interface FullTextQuery {
563
+ /**
564
+ * Returns the inner query object.
565
+ * This is the underlying query object used by the database engine.
566
+ * @ignore
567
+ */
568
+ inner: JsFullTextQuery;
569
+ /**
570
+ * The type of the full-text query.
571
+ */
572
+ queryType(): FullTextQueryType;
573
+ }
574
+ export declare function instanceOfFullTextQuery(obj: any): obj is FullTextQuery;
575
+ export declare class MatchQuery implements FullTextQuery {
576
+ /** @ignore */
577
+ readonly inner: JsFullTextQuery;
578
+ /**
579
+ * Creates an instance of MatchQuery.
580
+ *
581
+ * @param query - The text query to search for.
582
+ * @param column - The name of the column to search within.
583
+ * @param options - Optional parameters for the match query.
584
+ * - `boost`: The boost factor for the query (default is 1.0).
585
+ * - `fuzziness`: The fuzziness level for the query (default is 0).
586
+ * - `maxExpansions`: The maximum number of terms to consider for fuzzy matching (default is 50).
587
+ * - `operator`: The logical operator to use for combining terms in the query (default is "OR").
588
+ * - `prefixLength`: The number of beginning characters being unchanged for fuzzy matching.
589
+ */
590
+ constructor(query: string, column: string, options?: {
591
+ boost?: number;
592
+ fuzziness?: number;
593
+ maxExpansions?: number;
594
+ operator?: Operator;
595
+ prefixLength?: number;
596
+ });
597
+ queryType(): FullTextQueryType;
598
+ }
599
+ export declare class PhraseQuery implements FullTextQuery {
600
+ /** @ignore */
601
+ readonly inner: JsFullTextQuery;
602
+ /**
603
+ * Creates an instance of `PhraseQuery`.
604
+ *
605
+ * @param query - The phrase to search for in the specified column.
606
+ * @param column - The name of the column to search within.
607
+ * @param options - Optional parameters for the phrase query.
608
+ * - `slop`: The maximum number of intervening unmatched positions allowed between words in the phrase (default is 0).
609
+ */
610
+ constructor(query: string, column: string, options?: {
611
+ slop?: number;
612
+ });
613
+ queryType(): FullTextQueryType;
614
+ }
615
+ export declare class BoostQuery implements FullTextQuery {
616
+ /** @ignore */
617
+ readonly inner: JsFullTextQuery;
618
+ /**
619
+ * Creates an instance of BoostQuery.
620
+ * The boost returns documents that match the positive query,
621
+ * but penalizes those that match the negative query.
622
+ * the penalty is controlled by the `negativeBoost` parameter.
623
+ *
624
+ * @param positive - The positive query that boosts the relevance score.
625
+ * @param negative - The negative query that reduces the relevance score.
626
+ * @param options - Optional parameters for the boost query.
627
+ * - `negativeBoost`: The boost factor for the negative query (default is 0.0).
628
+ */
629
+ constructor(positive: FullTextQuery, negative: FullTextQuery, options?: {
630
+ negativeBoost?: number;
631
+ });
632
+ queryType(): FullTextQueryType;
633
+ }
634
+ export declare class MultiMatchQuery implements FullTextQuery {
635
+ /** @ignore */
636
+ readonly inner: JsFullTextQuery;
637
+ /**
638
+ * Creates an instance of MultiMatchQuery.
639
+ *
640
+ * @param query - The text query to search for across multiple columns.
641
+ * @param columns - An array of column names to search within.
642
+ * @param options - Optional parameters for the multi-match query.
643
+ * - `boosts`: An array of boost factors for each column (default is 1.0 for all).
644
+ * - `operator`: The logical operator to use for combining terms in the query (default is "OR").
645
+ */
646
+ constructor(query: string, columns: string[], options?: {
647
+ boosts?: number[];
648
+ operator?: Operator;
649
+ });
650
+ queryType(): FullTextQueryType;
651
+ }
652
+ export declare class BooleanQuery implements FullTextQuery {
653
+ /** @ignore */
654
+ readonly inner: JsFullTextQuery;
655
+ /**
656
+ * Creates an instance of BooleanQuery.
657
+ *
658
+ * @param queries - An array of (Occur, FullTextQuery objects) to combine.
659
+ * Occur specifies whether the query must match, or should match.
660
+ */
661
+ constructor(queries: [Occur, FullTextQuery][]);
662
+ queryType(): FullTextQueryType;
663
+ }