@tryformation/querylight-cli 0.2.1 → 0.2.3

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.
@@ -222,9 +222,44 @@ export type SearchResult = {
222
222
  lastChangedAt: string;
223
223
  metadata: Record<string, unknown>;
224
224
  };
225
+ export type SearchHitSource = {
226
+ chunkId: string;
227
+ documentId: string;
228
+ sourceId: string;
229
+ sourceType: SourceType;
230
+ sourceName?: string;
231
+ title: string;
232
+ uri: string;
233
+ headingPath: string[];
234
+ text: string;
235
+ snippet?: string;
236
+ normalizedPath?: string;
237
+ publicationDate?: string | null;
238
+ crawledAt?: string;
239
+ firstSeenAt: string;
240
+ lastSeenAt: string;
241
+ lastChangedAt: string;
242
+ metadata: Record<string, unknown>;
243
+ };
244
+ export type SearchHit = {
245
+ _index: string;
246
+ _id: string;
247
+ _score: number;
248
+ _source: SearchHitSource;
249
+ highlight?: Record<string, string[]>;
250
+ };
225
251
  export type SearchResponseData = {
226
252
  retrievalMode?: RetrievalMode;
227
- results: SearchResult[];
253
+ took: number;
254
+ hits: {
255
+ total: {
256
+ value: number;
257
+ relation: "eq";
258
+ };
259
+ max_score: number | null;
260
+ hits: SearchHit[];
261
+ };
262
+ aggregations?: Record<string, unknown>;
228
263
  };
229
264
  export type RelatedDocumentResult = {
230
265
  documentId: string;
@@ -1,4 +1,11 @@
1
1
  import type { SparseVectorModelConfig } from "../types/models.js";
2
+ type SparseExecOptions = {
3
+ encoding: BufferEncoding;
4
+ maxBuffer: number;
5
+ env: NodeJS.ProcessEnv;
6
+ };
7
+ type SparseExecFileSync = (file: string, args: string[], options: SparseExecOptions) => string;
8
+ export declare function setSparseExecFileSyncForTests(fn: SparseExecFileSync | null): void;
2
9
  export declare function resolveQliHomeDir(): string;
3
10
  export declare function resolveCacheDir(workspacePath: string, configuredPath: string): string;
4
11
  export declare function packageRootFromImportMeta(importMetaUrl: string): string;
@@ -18,3 +25,4 @@ export declare function getDenseTransformersRuntime(cacheDir: string): Promise<{
18
25
  };
19
26
  pipeline: typeof import("@huggingface/transformers").pipeline;
20
27
  }>;
28
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryformation/querylight-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Querylight CLI for building and querying local knowledge bases.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/formation-res/querylight-cli#readme",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@huggingface/transformers": "^3.8.1",
43
- "@tryformation/querylight-ts": "^0.10.0",
43
+ "@tryformation/querylight-ts": "^0.11.0",
44
44
  "cheerio": "^1.2.0",
45
45
  "cli-table3": "^0.6.5",
46
46
  "commander": "^14.0.3",
@@ -88,7 +88,11 @@ def encode_documents(model_id: str, top_tokens: int, documents):
88
88
 
89
89
 
90
90
  def main():
91
- payload = json.load(sys.stdin)
91
+ if len(sys.argv) > 1:
92
+ with open(sys.argv[1], encoding="utf-8") as handle:
93
+ payload = json.load(handle)
94
+ else:
95
+ payload = json.load(sys.stdin)
92
96
  action = payload["action"]
93
97
  model_id = payload["model_id"]
94
98
  if action == "download_only":