From f3a6612d9f3560f79d62897123625b92b443bae0 Mon Sep 17 00:00:00 2001 From: Lucas Jackson Date: Wed, 12 Jun 2024 18:43:24 -0700 Subject: [PATCH] support pagination (#36) --- package.json | 4 ++-- packages/langchain/package.json | 4 ++-- src/client.ts | 42 ++++++++++++++++++++++++++------- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index e5a9cd1..6525065 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "getindexify", - "version": "0.0.44", + "version": "0.0.45", "description": "This is the TypeScript client for interacting with the Indexify service.", "main": "./dist/index.js", "module": "./dist/index.mjs", @@ -16,7 +16,7 @@ "type": "git", "url": "git+https://github.com/tensorlakeai/indexify-typescript-client.git" }, - "author": "", + "author": "Lucas Jackson ", "license": "ISC", "bugs": { "url": "https://github.com/tensorlakeai/indexify-typescript-client/issues" diff --git a/packages/langchain/package.json b/packages/langchain/package.json index 34167fe..59a2b79 100644 --- a/packages/langchain/package.json +++ b/packages/langchain/package.json @@ -1,6 +1,6 @@ { "name": "@getindexify/langchain", - "version": "0.0.34", + "version": "0.0.44", "description": "Langchain retriever for indexify client.", "main": "./dist/index.js", "module": "./dist/index.mjs", @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/tensorlakeai/indexify-typescript-client#readme", "dependencies": { - "getindexify": "^0.0.43", + "getindexify": "^0.0.44", "langchain": "^0.1.21" }, "devDependencies": { diff --git a/src/client.ts b/src/client.ts index b371f44..d9a392b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -214,8 +214,7 @@ class IndexifyClient { const data = { name: extractionGraph.name, extraction_policies: extractionGraph.extraction_policies, - } - console.log("create extraction graph", JSON.stringify(data.extraction_policies)); + }; const resp = await this.client.post("extraction_graphs", data); // update this.extractor_bindings @@ -225,16 +224,26 @@ class IndexifyClient { } async getExtractedContent({ - parent_id, + parentId, source, - labels_eq, + labelsEq, + startId, + limit, }: { - parent_id?: string; + parentId?: string; source?: string; - labels_eq?: string; + labelsEq?: string; + startId?: string; + limit?: number; } = {}): Promise { const resp = await this.client.get("content", { - params: { parent_id, labels_eq, source }, + params: { + parent_id: parentId, + labels_eq: labelsEq, + source, + start_id: startId, + limit, + }, }); return resp.data.content_list.map((content: IBaseContentMetadata) => { return this.baseContentToContentMetadata(content); @@ -317,9 +326,24 @@ class IndexifyClient { } } - async getTasks(extraction_graph?: string): Promise { + async getTasks({ + contentId, + extractionPolicyId, + startId, + limit, + }: { + contentId?: string; + extractionPolicyId?: string; + startId?: string; + limit?: number; + }): Promise { const resp = await this.client.get("tasks", { - params: { extraction_graph }, + params: { + content_id: contentId, + extraction_policy: extractionPolicyId, + start_id: startId, + limit, + }, }); return resp.data.tasks; }