-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Implement RDF Graph and RDF QA Chain #6050
Conversation
@lifan0127 @hwchase17 are you still working on this? |
Hello @hwchase17, Let me know how I can help incorporate this feature. |
# [SPARQL](https://www.w3.org/TR/rdf-sparql-query/) for [LangChain](https://github.com/hwchase17/langchain) ## Description LangChain support for knowledge graphs relying on W3C standards using RDFlib: SPARQL/ RDF(S)/ OWL with special focus on RDF \ * Works with local files, files from the web, and SPARQL endpoints * Supports both SELECT and UPDATE queries * Includes both a Jupyter notebook with an example and integration tests ## Contribution compared to related PRs and discussions * [Wikibase agent](#2690) - uses SPARQL, but specifically for wikibase querying * [Cypher qa](#5078) - graph DB question answering for Neo4J via Cypher * [PR 6050](#6050) - tries something similar, but does not cover UPDATE queries and supports only RDF * Discussions on [w3c mailing list](mailto:semantic-web@w3.org) related to the combination of LLMs (specifically ChatGPT) and knowledge graphs ## Dependencies * [RDFlib](https://github.com/RDFLib/rdflib) ## Tag maintainer Graph database related to memory -> @hwchase17
hey @lifan0127, apologies for the delay and thanks for the contribution! seems like there's some overlap with #7165, curious if that covers this use case or if there's extra functionality in this pr |
@baskaryan Hey, note that this PR was created long before #7165. Nevertheless, I think we can close it now that #7165 has been merged. |
# [SPARQL](https://www.w3.org/TR/rdf-sparql-query/) for [LangChain](https://github.com/hwchase17/langchain) ## Description LangChain support for knowledge graphs relying on W3C standards using RDFlib: SPARQL/ RDF(S)/ OWL with special focus on RDF \ * Works with local files, files from the web, and SPARQL endpoints * Supports both SELECT and UPDATE queries * Includes both a Jupyter notebook with an example and integration tests ## Contribution compared to related PRs and discussions * [Wikibase agent](langchain-ai#2690) - uses SPARQL, but specifically for wikibase querying * [Cypher qa](langchain-ai#5078) - graph DB question answering for Neo4J via Cypher * [PR 6050](langchain-ai#6050) - tries something similar, but does not cover UPDATE queries and supports only RDF * Discussions on [w3c mailing list](mailto:semantic-web@w3.org) related to the combination of LLMs (specifically ChatGPT) and knowledge graphs ## Dependencies * [RDFlib](https://github.com/RDFLib/rdflib) ## Tag maintainer Graph database related to memory -> @hwchase17
This pull request adds support for RDF Graph-based QA Chain. It uses the same signature and provides similar functionalities as the current Neo4j and Nebula implementations.
In theory, any RDF stores that support the W3C SPARQL Query Language 1.1 standard can be used, although only a few were tested during the development.
https://github.com/lifan0127/langchain/blob/rdf-graph/docs/modules/chains/examples/graph_rdf_qa.ipynb
This approach will not scale well for large, public RDF databases such as Wikidata, but that is a more general problem that requires more research.
cc @hwchase17