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

community[minor]: Implement addGraphDocuments method for neo4j graph #4761

Merged
merged 15 commits into from
Mar 26, 2024

Conversation

easwee
Copy link
Contributor

@easwee easwee commented Mar 14, 2024

Porting over add_graph_documents method from python.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 14, 2024
Copy link

vercel bot commented Mar 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 6:34pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Mar 20, 2024 6:34pm

@easwee easwee changed the title [WIP] Implement addGraphDocuments method for neo4j graph Implement addGraphDocuments method for neo4j graph Mar 18, 2024
@easwee easwee marked this pull request as ready for review March 18, 2024 20:35
@@ -1,19 +1,37 @@
/* eslint-disable no-process-env */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there! 👋 This is a friendly flag to highlight that the recent change in the PR adds, accesses, and requires environment variables via process.env. It's important for maintainers to review this change to ensure proper handling of environment variables. Keep up the great work! 🚀

@jacoblee93 jacoblee93 changed the title Implement addGraphDocuments method for neo4j graph community[minor]: Implement addGraphDocuments method for neo4j graph Mar 18, 2024
@@ -1,4 +1,6 @@
import neo4j, { RoutingControl } from "neo4j-driver";
import { createHash } from "crypto";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is intended to work in web environments (e.g. Next.js) but I would suggest using this:

import { insecureHash } from "@langchain/core/utils/hash";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use insecureHash

}
}

export class GraphDocument extends Serializable {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this extend Document instead? It will be a bit more interchangeable with other RAG pipeline things in the framework if we do it that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated - please review

@tomasonjo
Copy link
Contributor

LGTM


relationships: Relationship[];

source: Document;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnest this since we're now extending Document directly? Otherwise there's no point

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically implement pageContent and metadata

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would consisteny between python and JS be a higher priority? IMO, there is not much value in extending the doc for rag, as we never use the graph doc in retrieval setting, it's only used for ingestion atm. Even if we wanted to use it in retrieval, it would need custom components since none use nodes or rels atm

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fine by me.

@jacoblee93
Copy link
Collaborator

Really sorry for the delay - see above.

@jacoblee93 jacoblee93 added the question Further information is requested label Mar 24, 2024
@jacoblee93
Copy link
Collaborator

Thank you for your patience!

@jacoblee93 jacoblee93 added lgtm PRs that are ready to be merged as-is and removed question Further information is requested labels Mar 26, 2024
@jacoblee93 jacoblee93 merged commit 4ecea7f into langchain-ai:main Mar 26, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases lgtm PRs that are ready to be merged as-is size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants