{"id":18591877,"url":"https://github.com/sdsc-ordes/kg-llm-interface","last_synced_at":"2026-03-05T23:13:28.990Z","repository":{"id":178350883,"uuid":"629964602","full_name":"sdsc-ordes/kg-llm-interface","owner":"sdsc-ordes","description":"Langchain-powered natural language interface to knowledge-graphs.","archived":false,"fork":false,"pushed_at":"2025-02-17T12:15:31.000Z","size":1446,"stargazers_count":16,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-11T02:12:03.839Z","etag":null,"topics":["k8s","knowledge-graph","llm","question-answering","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdsc-ordes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-19T11:42:31.000Z","updated_at":"2025-03-17T06:59:55.000Z","dependencies_parsed_at":"2023-11-09T22:02:56.207Z","dependency_job_id":"f8eb7b18-d809-4039-a18d-1954bf5a3c74","html_url":"https://github.com/sdsc-ordes/kg-llm-interface","commit_stats":null,"previous_names":["sdsc-ord/kg-llm-interface","sdsc-ordes/kg-llm-interface"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sdsc-ordes/kg-llm-interface","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2Fkg-llm-interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2Fkg-llm-interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2Fkg-llm-interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2Fkg-llm-interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdsc-ordes","download_url":"https://codeload.github.com/sdsc-ordes/kg-llm-interface/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2Fkg-llm-interface/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30154479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"ssl_error","status_checked_at":"2026-03-05T22:39:24.771Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["k8s","knowledge-graph","llm","question-answering","rest-api"],"created_at":"2024-11-07T01:05:24.376Z","updated_at":"2026-03-05T23:13:28.974Z","avatar_url":"https://github.com/sdsc-ordes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kg-llm-interface\nLangchain-powered natural language interface to RDF knowledge-graphs.\n\n## Installation\n\nThis repository uses `uv` for package management. A Makefile rule is provided to install the dependencies:\n\n```bash\nmake install\n```\n\n## Configuration\n\nConfiguration variables are loaded from the `.env` file or environment variables. A template configuration file is provided in `.env.example`.\n\nThe chat configuration (`config.chat.ChatConfig`) uses OpenAI by default, however you can run this tool with open source LLMs using a framework such as llamafile, openllm or localGPT. When doing so, simply provide your LLM server url using `openai_api_base` and the model name using`model`.\n\n\n## Quickstart\n\nYou can read and run the [example notebook](aikg/notebooks/nl_sparql.ipynb) to get a quick overview of the system.\nThe notebook supports using the Openai API and can run locally on a laptop.\n\nTo run the notebook in a containerized environment, run:\n\n`make notebook`\n\n## Server\n\nThe server can be deployed as a standalone service using the script `scripts/standalone_server.sh`. It will start a uvicorn server on port 8001, use chromaDB in client-only mode and use an RDF file as knowledge graph. This should work for small datasets.\n\n\n## Pipelines\n\nPipelines are used to execute one-time operations for preparing data before the chat server can operate. They load their configuration from the `.env` file as well, but the variables can be overriden using yaml files (run with `--help` for more info).\n\n### Insert triples\n\n```mermaid\nflowchart LR\n    RDF[RDF file] --\u003e|insert_triples.py| SPARQL(SPARQL endpoint)\n```\n\nInsert data from an input RDF file to a SPARQL endpoint. The input file can be in any format supported by rdflib (ttl, json-ld, rdf/xlm, ...).\n\nLocation: [insert_triples.py](aikg/flows/insert_triples.py):\n\nSPARQL configuration can be overriden by providing a yaml file following the [aikg.config.sparql.SparqlConfig](aikg/config/sparql.py) schema:\n\n`python insert_triples --sparql-config-path sparql.yaml`\n\n```yaml\n# sparql.yaml\nendpoint: http://localhost:3030/ds/query\nuser: admin\npassword: admin\n```\n\nCLI usage: `python aikg/flows/insert_triples.py`\n\n### Chroma build\n\n```mermaid\nflowchart LR\n    SPARQL(SPARQL endpoint) --\u003e|chroma_build.py| CHROMA(ChromaDB)\n```\n\nBuild the chromaDB index from a SPARQL endpoint.\n\nLocation: [chroma_build.py](aikg/flows/chroma_build.py):\n\nCLI usage: `python aikg/flows/chroma_build.py`\n\nChroma and SPARQL configurations can be overriden by providing a yaml file following the [aikg.config.chroma.ChromaConfig](aikg/config/chroma.py) or [aikg.config.sparql.SparqlConfig](aikg/config/sparql.py) schemas respectively.\n\n\n## Containerized service\n\n:warning: WIP, not functional yet\n\nThe chat server can be deployed along with the front-end, SPARQL endpoint and chromaDB server using kubernetes.\n\n```mermaid\nsequenceDiagram\n    Front-end-\u003e\u003e+Chat server: question\n    Chat server-\u003e\u003e+ChromaDB: question\n    ChromaDB --\u003eChromaDB: embed\n    ChromaDB--\u003e\u003e-Chat server: ontology triples\n    Chat server--\u003eChat server: generate query\n    Chat server--\u003e\u003e+SPARQL endpoint: query\n    SPARQL endpoint--\u003eSPARQL endpoint: run query\n    SPARQL endpoint--\u003e\u003e-Chat server: result\n    Chat server--\u003e\u003e-Front-end: answer\n```\n\n## Contributing\n\nAll contributions are welcome. New functions and classes should have associated docstrings following the [numpy style guide](https://numpydoc.readthedocs.io/en/latest/format.html).\n\nThe code formatting standard we use is [black](https://github.com/psf/black), with `--line-length=79` to follow [PEP8](https://peps.python.org/pep-0008/) recommendations. We use [pytest](https://docs.pytest.org/en/7.2.x/) as our testing framework. This project uses [pyproject.toml](https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/) to define package information, requirements and tooling configuration.\n\nTests can be executed with `make test`. Tests use [testcontainers](https://testcontainers.com) to temporarily deploy the required services.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdsc-ordes%2Fkg-llm-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdsc-ordes%2Fkg-llm-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdsc-ordes%2Fkg-llm-interface/lists"}