File size: 3,545 Bytes
ea021ab
87f2cd6
 
ea021ab
87f2cd6
 
ea021ab
 
 
 
 
 
 
 
 
 
 
30a60fb
dcfefc7
87f2cd6
 
 
ea021ab
 
 
 
 
 
 
 
 
87f2cd6
ea021ab
 
 
87f2cd6
ea021ab
87f2cd6
ea021ab
 
87f2cd6
 
 
 
ea021ab
87f2cd6
ea021ab
87f2cd6
 
ea021ab
87f2cd6
 
 
 
ea021ab
87f2cd6
 
 
 
 
ea021ab
87f2cd6
ea021ab
 
87f2cd6
 
 
ea021ab
 
 
 
87f2cd6
ea021ab
 
87f2cd6
 
 
ea021ab
87f2cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
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)
![Gemini_Generated_Image_h25dizh25dizh25d (3)](https://cdn-uploads.huggingface.co/production/uploads/64c0e071e9263c783d548178/xXKYApaqL9hZyfSeSN3zP.png)

[**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}, 
}
```