langchain-rdf

🦉 Utilities to improve LLMs capabilities when working with SPARQL endpoints and RDF knowledge graphs, compatible with LangChain

https://github.com/vemonet/langchain-rdf

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: science.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

langchain llm rdf sparql
Last synced: 6 months ago · JSON representation ·

Repository

🦉 Utilities to improve LLMs capabilities when working with SPARQL endpoints and RDF knowledge graphs, compatible with LangChain

Basic Info
  • Host: GitHub
  • Owner: vemonet
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 71.3 KB
Statistics
  • Stars: 9
  • Watchers: 2
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Topics
langchain llm rdf sparql
Created about 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

# LangChain RDF [![Test package](https://github.com/vemonet/langchain-rdf/actions/workflows/test.yml/badge.svg)](https://github.com/vemonet/langchain-rdf/actions/workflows/test.yml) [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![code style - Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy)

Loaders and utils to work with RDF data using LangChain:

  • OntologyLoader: load OWL ontology classes and properties in your vectorstore
  • SparqlExamplesLoader: load SPARQL query examples to your vectorstore. SPARQL queries are retrieved from a SPARQL endpoint where they are stored using the SHACL ontology, with a human readable description.

📦️ Installation

This package requires Python >=3.8, install it from the git repository with:

bash pip install git+https://github.com/vemonet/langchain-rdf.git

🪄 Usage

[!NOTE]

Refer to LangChain documentation to figure out how to best integrate documents loaders to your stack, or check our complete notebook examples, using only open source components, running locally, with conversation memory:

OWL ontology loader

```python from langchain_rdf import OntologyLoader

loader = OntologyLoader("https://semanticscience.org/ontology/sio.owl", format="xml") documents = loader.load() print(len(documents)) ```

SPARQL query examples

```python from langchain_rdf import SparqlExamplesLoader

loader = SparqlExamplesLoader("https://sparql.uniprot.org/sparql/") documents = loader.load() print(len(documents)) ```

🧑‍💻 Development setup

The final section of the README is for if you want to run the package in development, and get involved by making a code contribution.

📥️ Clone

Clone the repository:

bash git clone https://github.com/vemonet/langchain-rdf cd langchain-rdf

🐣 Install dependencies

Install Hatch, this will automatically handle virtual environments and make sure all dependencies are installed when you run a script in the project:

bash pipx install hatch

☑️ Run tests

Make sure the existing tests still work by running the test suite and linting checks. Note that any pull requests to the fairworkflows repository on github will automatically trigger running of the test suite;

bash hatch run test

To display all logs when debugging:

bash hatch run test -s

♻️ Reset the environment

In case you are facing issues with dependencies not updating properly you can easily reset the virtual environment with:

bash hatch env prune

Manually trigger installing the dependencies in a local virtual environment:

bash hatch -v env create

🏷️ New release process

The deployment of new releases is done automatically by a GitHub Action workflow when a new release is created on GitHub. To release a new version:

  1. Make sure the PYPI_TOKEN secret has been defined in the GitHub repository (in Settings > Secrets > Actions). You can get an API token from PyPI at pypi.org/manage/account.
  2. Increment the version number in the pyproject.toml file in the root folder of the repository.

    bash hatch version fix

  3. Create a new release on GitHub, which will automatically trigger the publish workflow, and publish the new release to PyPI.

You can also build and publish from your computer:

bash hatch build hatch publish

Owner

  • Name: Vincent Emonet
  • Login: vemonet
  • Kind: user
  • Location: Maastricht, Netherlands
  • Company: @MaastrichtU-IDS

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - orcid: https://orcid.org/0000-0002-1501-1082
    email: vincent.emonet@gmail.com
    given-names: Vincent Emonet
    # affiliation: Institute of Data Science, Maastricht University
title: "LangChain RDF"
repository-code: https://github.com/vemonet/langchain-rdf
date-released: 2024-01-06
url: https://pypi.org/project/langchain-rdf
# doi: 10.48550/arXiv.2206.13787

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 15
  • Total Committers: 1
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Vincent Emonet v****t@g****m 15

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: 2 days
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • vemonet (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels