Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in document chunks #921

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 42 additions & 34 deletions js/sdk/__tests__/r2rClientIntegrationSuperUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ const fs = require("fs");

const baseUrl = "http://localhost:8000";

/**
* raskolnikov.txt should have an id of `f9f61fc8-079c-52d0-910a-c657958e385b`
* karamozov.txt should have an id of `73749580-1ade-50c6-8fbe-a5e9e87783c8`
* myshkin.txt should have an id of `2e05b285-2746-5778-9e4a-e293db92f3be`
*/

describe("r2rClient Integration Tests", () => {
let client: r2rClient;

Expand Down Expand Up @@ -43,17 +49,17 @@ describe("r2rClient Integration Tests", () => {
await expect(client.ingestFiles(files)).resolves.not.toThrow();
});

// test("Update files", async () => {
// const updated_file = [
// { path: "examples/data/folder/myshkin.txt", name: "super_myshkin.txt" },
// ];
// await expect(
// client.updateFiles(updated_file, {
// document_ids: ["2e05b285-2746-5778-9e4a-e293db92f3be"],
// metadatas: [{ title: "updated_karamozov.txt" }],
// }),
// ).resolves.not.toThrow();
// });
test("Update files", async () => {
const updated_file = [
{ path: "examples/data/folder/myshkin.txt", name: "super_myshkin.txt" },
];
await expect(
client.updateFiles(updated_file, {
document_ids: ["2e05b285-2746-5778-9e4a-e293db92f3be"],
metadatas: [{ title: "updated_karamozov.txt" }],
}),
).resolves.not.toThrow();
});

test("Search documents", async () => {
await expect(client.search("test")).resolves.not.toThrow();
Expand Down Expand Up @@ -111,6 +117,7 @@ describe("r2rClient Integration Tests", () => {
// expect(fullResponse.length).toBeGreaterThan(0);
// }, 30000);

// Deletes raskolnikov.txt
test("Delete document", async () => {
await expect(
client.delete({
Expand All @@ -124,33 +131,31 @@ describe("r2rClient Integration Tests", () => {
// await expect(client.logs()).resolves.not.toThrow();
// });

// TODO: verfiy that this works, blocked by R2R logging issues
// test("App settings", async () => {
// await expect(client.appSettings()).resolves.not.toThrow();
// });
test("App settings", async () => {
await expect(client.appSettings()).resolves.not.toThrow();
});

// test("Get analytics", async () => {
// const filterCriteria: Record<string, any> | string = {
// filters: {
// search_latencies: "search_latency",
// },
// };
test("Get analytics", async () => {
const filterCriteria: Record<string, any> | string = {
filters: {
search_latencies: "search_latency",
},
};

// const analysisTypes: Record<string, any> | string = {
// analysis_types: {
// search_latencies: ["basic_statistics", "search_latency"],
// },
// };
const analysisTypes: Record<string, any> | string = {
analysis_types: {
search_latencies: ["basic_statistics", "search_latency"],
},
};

// await expect(
// client.analytics(filterCriteria, analysisTypes),
// ).resolves.not.toThrow();
// });
await expect(
client.analytics(filterCriteria, analysisTypes),
).resolves.not.toThrow();
});

// TODO: Fix in R2R, 'PostgresRelationalDBProvider' object has no attribute 'get_users_overview')
// test("Get users overview", async () => {
// await expect(client.usersOverview()).resolves.not.toThrow();
// });
test("Get users overview", async () => {
await expect(client.usersOverview()).resolves.not.toThrow();
});

test("Get documents overview", async () => {
await expect(client.documentsOverview()).resolves.not.toThrow();
Expand All @@ -163,10 +168,13 @@ describe("r2rClient Integration Tests", () => {
});

test("Clean up remaining documents", async () => {
// Deletes karamozov.txt
await expect(
client.delete({ document_id: "73749580-1ade-50c6-8fbe-a5e9e87783c8" }),
).resolves.toBe("");


// Deletes myshkin.txt
await expect(
client.delete({ document_id: "2e05b285-2746-5778-9e4a-e293db92f3be" }),
).resolves.toBe("");
Expand Down
75 changes: 44 additions & 31 deletions js/sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.15",
"@types/uuid": "^10.0.0",
"jest": "^29.7.0",
Expand Down
Loading
Loading