Skip to content

Commit 9f39a60

Browse files
authored
Add backend to ragas main (#2174)
Hello! Kicking off API migration first with this PR, it primarily: 1. Moves the backend to ragas main 2. Rename imports 3. Moves tests from experimental to ragas main This is a cascading PR i.e. you are expected to review and merge #2173 before reviewing this
1 parent e8181bd commit 9f39a60

File tree

19 files changed

+34
-32
lines changed

19 files changed

+34
-32
lines changed

β€ŽCLAUDE.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ The experimental features are now integrated into the main ragas package:
162162
To use experimental features:
163163
```python
164164
from ragas.experimental import Dataset, experiment
165-
from ragas.experimental.backends import get_registry
165+
from ragas.backends import get_registry
166166
```
167167

168168
## Debugging Logs

β€Žragas/pyproject.tomlβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ ai-frameworks = ["haystack-ai"]
5757

5858
test = []
5959
[project.entry-points."ragas.backends"]
60-
"local/csv" = "ragas.experimental.backends.local_csv:LocalCSVBackend"
61-
"local/jsonl" = "ragas.experimental.backends.local_jsonl:LocalJSONLBackend"
62-
"inmemory" = "ragas.experimental.backends.inmemory:InMemoryBackend"
63-
"gdrive" = "ragas.experimental.backends.gdrive_backend:GDriveBackend"
60+
"local/csv" = "ragas.backends.local_csv:LocalCSVBackend"
61+
"local/jsonl" = "ragas.backends.local_jsonl:LocalJSONLBackend"
62+
"inmemory" = "ragas.backends.inmemory:InMemoryBackend"
63+
"gdrive" = "ragas.backends.gdrive_backend:GDriveBackend"
6464

6565
[project.scripts]
6666
ragas-experimental = "ragas.experimental.cli:app"

β€Žragas/src/ragas/__init__.pyβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
from ragas.evaluation import evaluate
44
from ragas.run_config import RunConfig
55

6+
# Backend imports
7+
from ragas import backends
8+
69
try:
710
from ._version import version as __version__
811
except ImportError:
@@ -19,6 +22,7 @@
1922
"cacher",
2023
"CacheInterface",
2124
"DiskCacheBackend",
25+
"backends",
2226
]
2327

2428

ragas/src/ragas/experimental/backends/README.md renamed to ragas/src/ragas/backends/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Registry (dict-like) β†’ Backend (implements BaseBackend) β†’ Storage
1717

1818
**1. Implement BaseBackend:**
1919
```python
20-
from ragas.experimental.backends.base import BaseBackend
20+
from ragas.backends.base import BaseBackend
2121

2222
class MyBackend(BaseBackend):
2323
def __init__(self, connection_string: str):
@@ -43,7 +43,7 @@ class MyBackend(BaseBackend):
4343

4444
**3. Use:**
4545
```python
46-
from ragas.experimental.backends import get_registry
46+
from ragas.backends import get_registry
4747
registry = get_registry()
4848
backend = registry["my_backend"](connection_string="...")
4949
```
@@ -69,7 +69,7 @@ def list_experiments() -> List[str]
6969

7070
**Dict-like interface:**
7171
```python
72-
from ragas.experimental.backends import get_registry
72+
from ragas.backends import get_registry
7373

7474
registry = get_registry()
7575
print(registry) # {'local/csv': <class 'LocalCSVBackend'>, ...}
@@ -182,7 +182,7 @@ my-backend-plugin/
182182
**Install & use:**
183183
```bash
184184
pip install my-backend-plugin
185-
python -c "from ragas.experimental.backends import get_registry; print(get_registry())"
185+
python -c "from ragas.backends import get_registry; print(get_registry())"
186186
```
187187

188188
## Registry Internals
@@ -195,7 +195,7 @@ python -c "from ragas.experimental.backends import get_registry; print(get_regis
195195

196196
**Debugging:**
197197
```python
198-
from ragas.experimental.backends import get_registry
198+
from ragas.backends import get_registry
199199
registry = get_registry()
200200

201201
# Check what's available
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
Β (0)