Skip to main content

lightrag-client

Python SDK for the InfraX RAGservicer — hybrid knowledge-base (vector + graph + keyword) retrieval over REST.

Install

pip install lightrag-client

Quick Start

from lightrag_client import LightRAGClient

rs = LightRAGClient(base_url="http://localhost:9721", api_key="lr_xxx", tenant_id="market")

# Insert documents
rs.insert("market", "BTC 走势受美联储利率政策影响", "doc-1")
rs.insert_batch("market", [
    {"text": "DeFi TVL 回升", "doc_id": "doc-2"},
    {"text": "链上巨鲸增持", "doc_id": "doc-3"},
])

# Query (context retrieval, no LLM answer)
result = rs.query("market", "比特币走势")
print(result)

# Context-only retrieval with top_k
ctx = rs.retrieve("market", "利率", top_k=5)

# Documents
rs.list_documents("market", page=1, limit=20)
rs.delete("market", "doc-1")

Admin

# Tenants & API keys
rs.create_tenant("market", "Market Data", "default tenant")
rs.generate_api_key("market", "prod", expires_days=90)
rs.list_api_keys("market")

# Hot-reload LLM / Embedding config (no restart needed)
rs.update_config(llm={"api_key": "sk-new", "model": "deepseek-chat"})

All methods talk the standard InfraX envelope {code, message, data} and return the data payload on success; API failures raise LightRAGClientError with .status / .code / .message.

Requirements

  • Python >= 3.9
  • requests

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightrag_client-2.0.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lightrag_client-2.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file lightrag_client-2.0.0.tar.gz.

File metadata

  • Download URL: lightrag_client-2.0.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for lightrag_client-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9a3e3d1bb722c8f2d46228c6a45dc8f2ebf2ae9e77c820b07f93f33621c105a2
MD5 866ee810e14765c5f5f1e0d221fca021
BLAKE2b-256 b525e1adc3b81f8acd51a08fe5b3eeb072cfe3b7959b858083f8b6cb31732545

See more details on using hashes here.

File details

Details for the file lightrag_client-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lightrag_client-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3140777b0cde2d925dad3562d773221141d1dac15cd1dfacc18fdad1057051ed
MD5 d54445a86f167a710b9d11938bf00ae6
BLAKE2b-256 9cb7f565d481dc55e7dd5c95cc83cdba4b7dda3be4e1f1138ed0da295b6b9f37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page