![LightRAG Logo](https://raw.githubusercontent.com/SylphAI-Inc/LightRAG/main/docs/source/_static/images/LightRAG-logo-doc.jpeg)
### ⚡⚡⚡ The PyTorch Library for Large language Model (LLM) Applications ⚡⚡⚡
*LightRAG* helps developers with both building and optimizing *Retriever-Agent-Generator (RAG)* pipelines.
It is *light*, *modular*, and *robust*.
**PyTorch**
```python
import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.conv2 = nn.Conv2d(32, 64, 3, 1)
self.dropout1 = nn.Dropout2d(0.25)
self.dropout2 = nn.Dropout2d(0.5)
self.fc1 = nn.Linear(9216, 128)
self.fc2 = nn.Linear(128, 10)
def forward(self, x):
x = self.conv1(x)
x = self.conv2(x)
x = self.dropout1(x)
x = self.dropout2(x)
x = self.fc1(x)
return self.fc2(x)
```
**LightRAG**
```python
from lightrag.core import Component, Generator
from lightrag.components.model_client import GroqAPIClient
from lightrag.utils import setup_env #noqa
class SimpleQA(Component):
def __init__(self):
super().__init__()
template = r"""<SYS>
You are a helpful assistant.
</SYS>
User: {{input_str}}
You:
"""
self.generator = Generator(
model_client=GroqAPIClient(),
model_kwargs={"model": "llama3-8b-8192"},
template=template,
)
def call(self, query):
return self.generator({"input_str": query})
async def acall(self, query):
return await self.generator.acall({"input_str": query})
```
## Quick Install
Install LightRAG with pip:
```bash
pip install lightrag
```
Please refer to the [full installation guide](https://lightrag.sylph.ai/get_started/installation.html) for more details.
# Documentation
LightRAG full documentation available at [lightrag.sylph.ai](https://lightrag.sylph.ai/):
- [Introduction](https://lightrag.sylph.ai/)
- [Full installation guide](https://lightrag.sylph.ai/get_started/installation.html)
- [Design philosophy](https://lightrag.sylph.ai/developer_notes/lightrag_design_philosophy.html): Design based on three principles: Simplicity over complexity, Quality over quantity, and Optimizing over building.
- [Class hierarchy](https://lightrag.sylph.ai/developer_notes/class_hierarchy.html): We have no more than two levels of subclasses. The bare minimum abstraction provides developers with maximum customizability and simplicity.
- [Tutorials](https://lightrag.sylph.ai/developer_notes/index.html): Learn the `why` and `how-to` (customize and integrate) behind each core part within the `LightRAG` library.
- [API reference](https://lightrag.sylph.ai/apis/index.html)
## Contributors
[![contributors](https://contrib.rocks/image?repo=SylphAI-Inc/LightRAG&max=2000)](https://github.com/SylphAI-Inc/LightRAG/graphs/contributors)
# Citation
```bibtex
@software{Yin2024LightRAG,
author = {Li Yin},
title = {{LightRAG: The PyTorch Library for Large Language Model (LLM) Applications}},
month = {7},
year = {2024},
doi = {10.5281/zenodo.12639531},
url = {https://github.com/SylphAI-Inc/LightRAG}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/SylphAI-Inc/LightRAG",
"name": "lightrag",
"maintainer": "Xiaoyi Gu",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": "xiaoyi@sylphai.com",
"keywords": "LLM, NLP, RAG, devtools, retrieval, agent",
"author": "Li Yin",
"author_email": "li@sylphai.com",
"download_url": "https://files.pythonhosted.org/packages/1e/65/156762f91198eab5cc21f333a2e8ebcaa944350b2b9c2d1103aef14570a1/lightrag-0.0.0a13.tar.gz",
"platform": null,
"description": "![LightRAG Logo](https://raw.githubusercontent.com/SylphAI-Inc/LightRAG/main/docs/source/_static/images/LightRAG-logo-doc.jpeg)\n\n\n### \u26a1\u26a1\u26a1 The PyTorch Library for Large language Model (LLM) Applications \u26a1\u26a1\u26a1\n\n*LightRAG* helps developers with both building and optimizing *Retriever-Agent-Generator (RAG)* pipelines.\nIt is *light*, *modular*, and *robust*.\n\n\n\n**PyTorch**\n\n```python\nimport torch\nimport torch.nn as nn\n\nclass Net(nn.Module):\n def __init__(self):\n super(Net, self).__init__()\n self.conv1 = nn.Conv2d(1, 32, 3, 1)\n self.conv2 = nn.Conv2d(32, 64, 3, 1)\n self.dropout1 = nn.Dropout2d(0.25)\n self.dropout2 = nn.Dropout2d(0.5)\n self.fc1 = nn.Linear(9216, 128)\n self.fc2 = nn.Linear(128, 10)\n\n def forward(self, x):\n x = self.conv1(x)\n x = self.conv2(x)\n x = self.dropout1(x)\n x = self.dropout2(x)\n x = self.fc1(x)\n return self.fc2(x)\n```\n\n**LightRAG**\n\n```python\n\nfrom lightrag.core import Component, Generator\nfrom lightrag.components.model_client import GroqAPIClient\nfrom lightrag.utils import setup_env #noqa\n\nclass SimpleQA(Component):\n def __init__(self):\n super().__init__()\n template = r\"\"\"<SYS>\n You are a helpful assistant.\n </SYS>\n User: {{input_str}}\n You:\n \"\"\"\n self.generator = Generator(\n model_client=GroqAPIClient(),\n model_kwargs={\"model\": \"llama3-8b-8192\"},\n template=template,\n )\n\n def call(self, query):\n return self.generator({\"input_str\": query})\n\n async def acall(self, query):\n return await self.generator.acall({\"input_str\": query})\n```\n\n## Quick Install\n\nInstall LightRAG with pip:\n\n```bash\npip install lightrag\n```\n\nPlease refer to the [full installation guide](https://lightrag.sylph.ai/get_started/installation.html) for more details.\n\n\n\n# Documentation\n\nLightRAG full documentation available at [lightrag.sylph.ai](https://lightrag.sylph.ai/):\n\n- [Introduction](https://lightrag.sylph.ai/)\n- [Full installation guide](https://lightrag.sylph.ai/get_started/installation.html)\n- [Design philosophy](https://lightrag.sylph.ai/developer_notes/lightrag_design_philosophy.html): Design based on three principles: Simplicity over complexity, Quality over quantity, and Optimizing over building.\n- [Class hierarchy](https://lightrag.sylph.ai/developer_notes/class_hierarchy.html): We have no more than two levels of subclasses. The bare minimum abstraction provides developers with maximum customizability and simplicity.\n- [Tutorials](https://lightrag.sylph.ai/developer_notes/index.html): Learn the `why` and `how-to` (customize and integrate) behind each core part within the `LightRAG` library.\n- [API reference](https://lightrag.sylph.ai/apis/index.html)\n\n\n\n## Contributors\n\n[![contributors](https://contrib.rocks/image?repo=SylphAI-Inc/LightRAG&max=2000)](https://github.com/SylphAI-Inc/LightRAG/graphs/contributors)\n\n# Citation\n\n```bibtex\n@software{Yin2024LightRAG,\n author = {Li Yin},\n title = {{LightRAG: The PyTorch Library for Large Language Model (LLM) Applications}},\n month = {7},\n year = {2024},\n doi = {10.5281/zenodo.12639531},\n url = {https://github.com/SylphAI-Inc/LightRAG}\n}\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The 'PyTorch' library for LLM applications. RAG=Retriever-Agent-Generator.",
"version": "0.0.0a13",
"project_urls": {
"Homepage": "https://github.com/SylphAI-Inc/LightRAG",
"Repository": "https://github.com/SylphAI-Inc/LightRAG"
},
"split_keywords": [
"llm",
" nlp",
" rag",
" devtools",
" retrieval",
" agent"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "44ad68ac76f3ba2eabff578f720b2b191104d9f3c60459a91d6725c4b48cd3dc",
"md5": "280c5fade040b76bbaea16dd3acf3871",
"sha256": "84f3b05b413d4b6b14ee190e65570b0415917a183239c6476f32966982e6efd7"
},
"downloads": -1,
"filename": "lightrag-0.0.0a13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "280c5fade040b76bbaea16dd3acf3871",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 147304,
"upload_time": "2024-07-05T02:58:41",
"upload_time_iso_8601": "2024-07-05T02:58:41.125523Z",
"url": "https://files.pythonhosted.org/packages/44/ad/68ac76f3ba2eabff578f720b2b191104d9f3c60459a91d6725c4b48cd3dc/lightrag-0.0.0a13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1e65156762f91198eab5cc21f333a2e8ebcaa944350b2b9c2d1103aef14570a1",
"md5": "b2009e277a6e61b1e6713edaea0b7a99",
"sha256": "00ce405ba5a830b39f5275d2fd971e99c0c909a31dbb3d512140ff929f24f510"
},
"downloads": -1,
"filename": "lightrag-0.0.0a13.tar.gz",
"has_sig": false,
"md5_digest": "b2009e277a6e61b1e6713edaea0b7a99",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 114297,
"upload_time": "2024-07-05T02:58:42",
"upload_time_iso_8601": "2024-07-05T02:58:42.671849Z",
"url": "https://files.pythonhosted.org/packages/1e/65/156762f91198eab5cc21f333a2e8ebcaa944350b2b9c2d1103aef14570a1/lightrag-0.0.0a13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-05 02:58:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SylphAI-Inc",
"github_project": "LightRAG",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "lightrag"
}