Skip to content

Commit

Permalink
Nolan/collections summary (#1685)
Browse files Browse the repository at this point in the history
* Add document summary to extraction process

* Collection summarization and inclusion in community generation

* Add test, fix mypy

* Clean up

* Fix test with new required body, remove print statements and add check
  • Loading branch information
NolanTrem authored Dec 11, 2024
1 parent d84aa43 commit 87222ec
Show file tree
Hide file tree
Showing 37 changed files with 206 additions and 1,062 deletions.
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ repos:
types: [python]
pass_filenames: false

- repo: local
hooks:
- id: check-print-statements
name: Check for print statements
entry: bash -c 'echo "Checking for print statements..." && find . -name "*.py" ! -path "./py/cli/*" ! -path "./py/core/examples/*" ! -path "./py/migrations/*" ! -path "./py/tests/*" | xargs grep -n "print(" || exit 0 && echo "Found print statements!" && exit 1'
language: system
types: [python]
pass_filenames: false

- repo: local
hooks:
- id: isort
Expand Down
12 changes: 12 additions & 0 deletions js/sdk/__tests__/CollectionsIntegrationSuperUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,26 @@ describe("r2rClient V3 Collections Integration Tests", () => {
test("Retrieve collection", async () => {
const response = await client.collections.retrieve({ id: collectionId });
expect(response.results).toBeDefined();
expect(response.results.id).toBe(collectionId);
expect(response.results.name).toBe("Test Collection");
expect(response.results.description).toBeNull();
});

test("Update collection", async () => {
const response = await client.collections.update({
id: collectionId,
name: "Updated Test Collection",
generateDescription: true,
});
expect(response.results).toBeDefined();
}, 10000);

test("Retrieve updated collection", async () => {
const response = await client.collections.retrieve({ id: collectionId });
expect(response.results).toBeDefined();
expect(response.results.id).toBe(collectionId);
expect(response.results.name).toBe("Updated Test Collection");
expect(response.results.description).toBeDefined();
});

test("Ingest document and assign to collection", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe("r2rClient V3 System Integration Tests User", () => {

expect(response.results.document_id).toBeDefined();
user1DocumentId = response.results.document_id;
}, 10000);
}, 15000);

test("Create document as user 2 with file path", async () => {
const response = await user2Client.documents.create({
Expand All @@ -126,7 +126,7 @@ describe("r2rClient V3 System Integration Tests User", () => {

expect(response.results.document_id).toBeDefined();
user2DocumentId = response.results.document_id;
}, 10000);
}, 15000);

test("Retrieve document as user 1", async () => {
const response = await user1Client.documents.retrieve({
Expand Down
2 changes: 2 additions & 0 deletions js/sdk/__tests__/GraphsIntegrationSuperUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ describe("r2rClient V3 Graphs Integration Tests", () => {
predicate: "falls in love with",
object: "Dunia",
objectId: entity2Id,
description: "Razumikhn and Dunia are central to the story",
});

relationshipId = response.results.id;
Expand All @@ -236,6 +237,7 @@ describe("r2rClient V3 Graphs Integration Tests", () => {
expect(response.results.subject).toBe("Razumikhin");
expect(response.results.object).toBe("Dunia");
expect(response.results.predicate).toBe("falls in love with");
expect(response.results.description).toBe("Razumikhn and Dunia are central to the story");
});

test("Retrieve the relationship", async () => {
Expand Down
Loading

0 comments on commit 87222ec

Please sign in to comment.