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

add rag_with_knowledge_graphs_neo4j notebook & index #187

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

dcarpintero
Copy link
Contributor

What does this PR do?

Add a new notebook: 'rag_with_knowledge_graphs_neo4j'.

This notebook demonstrates how to:

  • Build a knowledge graph in Neo4j related to research publications using a synthetic dataset,
  • Project a subset of our data fields into a high-dimensional vector space using an embedding,
  • Construct a vector index on those embeddings to enable similarity search,
  • Extract insights from our graph using natural language by easily converting user queries into statements with

Who can review?

@merveenoyan and @stevhliu.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@@ -0,0 +1,644 @@
{
Copy link
Member

@stevhliu stevhliu Sep 4, 2024

Choose a reason for hiding this comment

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

Nice diagram!


Reply via ReviewNB

@@ -0,0 +1,644 @@
{
Copy link
Member

@stevhliu stevhliu Sep 4, 2024

Choose a reason for hiding this comment

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

"Set up a Neo4j instance"


Reply via ReviewNB

@@ -0,0 +1,644 @@
{
Copy link
Member

@stevhliu stevhliu Sep 4, 2024

Choose a reason for hiding this comment

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

"Now we construct a vector..."


Reply via ReviewNB

@@ -0,0 +1,644 @@
{
Copy link
Member

@stevhliu stevhliu Sep 4, 2024

Choose a reason for hiding this comment

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

"Langchain RetrievalWA creates a question-answering (QA) chain using the above vector index as a retriever."


Reply via ReviewNB

@@ -0,0 +1,644 @@
{
Copy link
Member

@stevhliu stevhliu Sep 4, 2024

Choose a reason for hiding this comment

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

"Knowledge graphs are excellent for making connections between entities,"


Reply via ReviewNB

@@ -0,0 +1,644 @@
{
Copy link
Member

@stevhliu stevhliu Sep 4, 2024

Choose a reason for hiding this comment

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

What exactly are these risks? May be clearer to spell them out explicitly.


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added "[...] risks such as unintended access or modification of sensitive data in the database."

@@ -0,0 +1,644 @@
{
Copy link
Member

@stevhliu stevhliu Sep 4, 2024

Choose a reason for hiding this comment

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

"Let's find out which researcher has the most peer collaborations."

"Here, we need to start from..."


Reply via ReviewNB

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, this was a very interesting read! 🤗

@dcarpintero
Copy link
Contributor Author

Thanks a lot @stevhliu - Your suggestions have been incorporated into the PR. Please let me know if there are any further improvements needed.

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Once @merveenoyan has had a look and approves, we can merge :)

@@ -0,0 +1,644 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Sep 6, 2024

Choose a reason for hiding this comment

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

no need to do numbering/subnumbering I think it would disrupt reading


Reply via ReviewNB

@@ -0,0 +1,644 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Sep 6, 2024

Choose a reason for hiding this comment

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

can you explain what a Cypher statement is with a small sentence, you mention it on top as well, might be good for beginners


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a short explanation "[...] generates Cypher statements (queries for graph databases like Neo4j) from user input [...]"

Copy link
Collaborator

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

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

mostly nits, then we can get it merged :)

@dcarpintero
Copy link
Contributor Author

Thanks @merveenoyan - I have incorportated your suggestions into the PR.

Copy link
Collaborator

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

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

thank you!

@merveenoyan
Copy link
Collaborator

@dcarpintero there should've been some merge conflicts coming from main to here but there isn't, seems interesting. Can you merge main to this branch manually?
the CI fails because we recently merged another notebook called multiagent web assistant, I think either the file isn't there or it isn't in toctree

@dcarpintero
Copy link
Contributor Author

@merveenoyan thanks for the heads-up
I just manually merged main into this branch - please let me know in case there is still an issue with CI

@stevhliu stevhliu merged commit cde42a4 into huggingface:main Sep 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants