Skip to content

Commit

Permalink
support pagination (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasjacks0n authored Jun 13, 2024
1 parent c55c038 commit f3a6612
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -16,7 +16,7 @@
"type": "git",
"url": "git+https://github.com/tensorlakeai/indexify-typescript-client.git"
},
"author": "",
"author": "Lucas Jackson <[email protected]>",
"license": "ISC",
"bugs": {
"url": "https://github.com/tensorlakeai/indexify-typescript-client/issues"
Expand Down
4 changes: 2 additions & 2 deletions packages/langchain/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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": {
Expand Down
42 changes: 33 additions & 9 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<IContentMetadata[]> {
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);
Expand Down Expand Up @@ -317,9 +326,24 @@ class IndexifyClient {
}
}

async getTasks(extraction_graph?: string): Promise<ITask[]> {
async getTasks({
contentId,
extractionPolicyId,
startId,
limit,
}: {
contentId?: string;
extractionPolicyId?: string;
startId?: string;
limit?: number;
}): Promise<ITask[]> {
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;
}
Expand Down

0 comments on commit f3a6612

Please sign in to comment.