| --- |
| language: |
| - en |
| license: apache-2.0 |
| size_categories: |
| - n<10K |
| task_categories: |
| - text-retrieval |
| tags: |
| - r-language |
| - chromadb |
| - tool-retrieval |
| - data-science |
| - llm-agent |
| --- |
| |
| # R-Package Knowledge Base (RPKB) |
|  |
|
|
| [**Project Page**](https://ama-cmfai.github.io/DARE_webpage/) | [**Paper**](https://huggingface.co/papers/2603.04743) | [**GitHub**](https://github.com/AMA-CMFAI/DARE) |
|
|
| This database is the official pre-computed **ChromaDB vector database** for the paper: *[DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval](https://huggingface.co/papers/2603.04743)*. |
|
|
| It contains **8,191 high-quality R functions** meticulously curated from CRAN, complete with extracted statistical metadata (Data Profiles) and pre-computed embeddings generated by the **[DARE model](https://huggingface.co/Stephen-SMJ/DARE-R-Retriever)**. |
|
|
| ## π Database Overview |
| - **Database Engine:** ChromaDB |
| - **Total Documents:** 8,191 R functions |
| - **Embedding Model:** `Stephen-SMJ/DARE-R-Retriever` |
| - **Primary Use Case:** Tool retrieval for LLM Agents executing data science and statistical workflows in R. |
|
|
| ## π Quick Start (Zero-Configuration Inference) |
|
|
| You can easily download and load this database into your own Agentic workflows using the `huggingface_hub` and `chromadb` libraries. |
|
|
| ### 1. Installation |
| ```bash |
| pip install huggingface_hub chromadb sentence-transformers torch |
| ``` |
|
|
| ### 2. Run the DARE Retriever |
| The following script automatically downloads the DARE model and the RPKB database from Hugging Face and performs a distribution-aware search. |
|
|
| ```python |
| from huggingface_hub import snapshot_download |
| from sentence_transformers import SentenceTransformer |
| import chromadb |
| import torch |
| import os |
| |
| # 1. Load DARE Model |
| device = "cuda" if torch.cuda.is_available() else "cpu" |
| model = SentenceTransformer("Stephen-SMJ/DARE-R-Retriever", trust_remote_code=False) |
| model.to(device) |
| |
| # 2. Download and Connect to RPKB Database |
| db_dir = "./rpkb_db" |
| if not os.path.exists(os.path.join(db_dir, "DARE_db")): |
| print("Downloading RPKB Database from Hugging Face...") |
| snapshot_download(repo_id="Stephen-SMJ/RPKB", repo_type="dataset", local_dir=db_dir, allow_patterns="DARE_db/*") |
| |
| client = chromadb.PersistentClient(path=os.path.join(db_dir, "DARE_db")) |
| collection = client.get_collection(name="inference") |
| |
| # 3. Perform Search |
| query = "I have a sparse matrix with high dimensionality. I need to perform PCA." |
| query_embedding = model.encode(query, convert_to_tensor=False).tolist() |
| |
| results = collection.query( |
| query_embeddings=[query_embedding], |
| n_results=3, |
| include=["documents", "metadatas"] |
| ) |
| |
| # Display Results |
| for rank, (doc_id, meta) in enumerate(zip(results['ids'][0], results['metadatas'][0])): |
| print(f"[{rank + 1}] Package: {meta.get('package_name')} :: Function: {meta.get('function_name')}") |
| ``` |
|
|
| ## π Citation |
|
|
| If you find DARE, RPKB, or RCodingAgent useful in your research, please cite our work: |
|
|
| ```bibtex |
| @article{sun2026dare, |
| title={DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval}, |
| author={Maojun Sun and Yue Wu and Yifei Xie and Ruijian Han and Binyan Jiang and Defeng Sun and Yancheng Yuan and Jian Huang}, |
| year={2026}, |
| eprint={2603.04743}, |
| archivePrefix={arXiv}, |
| primaryClass={cs.IR}, |
| url={https://arxiv.org/abs/2603.04743}, |
| } |
| ``` |