The 'PyTorch' library for LLM applications. RAG=Retriever-Agent-Generator.
Project description
⚡ The PyTorch Library for Large Language Model Applications ⚡
LightRAG helps developers with both building and optimizing Retriever-Agent-Generator (RAG) pipelines. It is light, modular, and robust.
PyTorch
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
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:
pip install lightrag
Please refer to the full installation guide for more details.
Documentation
LightRAG full documentation available at lightrag.sylph.ai:
- Introduction
- Full installation guide
- Design philosophy: Design based on three principles: Simplicity over complexity, Quality over quantity, and Optimizing over building.
- Class hierarchy: We have no more than two levels of subclasses. The bare minimum abstraction provides developers with maximum customizability and simplicity.
- Tutorials: Learn the
why
andhow-to
(customize and integrate) behind each core part within theLightRAG
library. - API reference
Contributors
Citation
@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}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lightrag-0.0.0a16.tar.gz
(116.4 kB
view hashes)
Built Distribution
lightrag-0.0.0a16-py3-none-any.whl
(149.9 kB
view hashes)
Close
Hashes for lightrag-0.0.0a16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd27df13bdf7d28523f9b5066f2f4ca5f47bbe88944f721acc69b1c6c469f842 |
|
MD5 | a7e32f0f6f0e1c21d5c1f61ea6189640 |
|
BLAKE2b-256 | fac998d39e88964a37ec8b50c677f87785a9844b68cac1d45e5cc5833a2bfdc4 |