Skip to content

Commit 0b1cbf3

Browse files
authored
Merge pull request #37 from dmaniloff/return-providers-as-list
Return providers as list & conditionally enable remote based on installed deps.
2 parents d5eaa31 + ebd7075 commit 0b1cbf3

File tree

16 files changed

+638
-1266
lines changed

16 files changed

+638
-1266
lines changed

.vscode/launch.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,12 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
87
{
9-
"name": "Debug Ragas Distribution -- Remote",
8+
"name": "Debug Ragas Distribution",
109
"type": "debugpy",
1110
"request": "launch",
1211
"module": "llama_stack.cli.llama",
13-
"args": ["stack", "run", "distribution/run-remote.yaml"],
14-
"cwd": "${workspaceFolder}",
15-
"envFile": "${workspaceFolder}/.env",
16-
"justMyCode": false
17-
},
18-
{
19-
"name": "Debug Ragas Distribution -- Inline",
20-
"type": "debugpy",
21-
"request": "launch",
22-
"module": "llama_stack.cli.llama",
23-
"args": ["stack", "run", "distribution/run-inline.yaml"],
12+
"args": ["stack", "run", "distribution/run.yaml"],
2413
"cwd": "${workspaceFolder}",
2514
"envFile": "${workspaceFolder}/.env",
2615
"justMyCode": false

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ This repository implements [Ragas](https://github.com/explodinggradients/ragas)
1414
The goal is to provide all of Ragas' evaluation functionality over Llama Stack's eval API, while leveraging the Llama Stack's built-in APIs for inference (llms and embeddings), datasets, and benchmarks.
1515

1616
There are two versions of the provider:
17-
- `inline`: runs the Ragas evaluation in the same process as the Llama Stack server.
18-
- `remote`: runs the Ragas evaluation in a remote process, using Kubeflow Pipelines.
17+
- `inline`: runs the Ragas evaluation in the same process as the Llama Stack server. This is always available with the base installation.
18+
- `remote`: runs the Ragas evaluation in a remote process, using Kubeflow Pipelines. Only available when remote dependencies are installed with `pip install llama-stack-provider-ragas[remote]`.
1919

2020
## Prerequisites
2121
- Python 3.12
@@ -41,12 +41,29 @@ There are two versions of the provider:
4141
```
4242
- The sample LS distributions (one for inline and one for remote provider) is a simple LS distribution that uses Ollama for inference and embeddings. See the provider-specific sections below for setup and run commands.
4343
44-
### Remote provider (default)
44+
### Inline provider (default with base installation)
45+
46+
Create a `.env` file with the required environment variable:
47+
```bash
48+
EMBEDDING_MODEL=ollama/all-minilm:l6-v2
49+
```
50+
51+
Run the server:
52+
```bash
53+
dotenv run uv run llama stack run distribution/run.yaml
54+
```
55+
56+
### Remote provider (requires optional dependencies)
57+
58+
First install the remote dependencies:
59+
```bash
60+
uv pip install -e ".[remote]"
61+
```
4562
4663
Create a `.env` file with the following:
4764
```bash
4865
# Required for both inline and remote
49-
EMBEDDING_MODEL=all-MiniLM-L6-v2
66+
EMBEDDING_MODEL=ollama/all-minilm:l6-v2
5067
5168
# Required for remote provider
5269
KUBEFLOW_LLAMA_STACK_URL=<your-llama-stack-url>
@@ -75,22 +92,9 @@ Where:
7592
7693
Run the server:
7794
```bash
78-
dotenv run uv run llama stack run distribution/run-remote.yaml
79-
```
80-
81-
### Inline provider (need to specify `.inline` in the module name)
82-
83-
Create a `.env` file with the required environment variable:
84-
```bash
85-
EMBEDDING_MODEL=all-MiniLM-L6-v2
86-
```
87-
88-
Run the server:
89-
```bash
90-
dotenv run uv run llama stack run distribution/run-inline.yaml
95+
dotenv run uv run llama stack run distribution/run.yaml
9196
```
9297
93-
You will notice that `run-inline.yaml` file has the module name as `llama_stack_provider_ragas.inline`, in order to specify the inline provider.
9498
9599
## Usage
96100
See the demos in the `demos` directory.
Lines changed: 550 additions & 276 deletions
Large diffs are not rendered by default.

demos/inline_demo.ipynb

Lines changed: 0 additions & 880 deletions
This file was deleted.

distribution/run-inline.yaml

Lines changed: 0 additions & 61 deletions
This file was deleted.
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ apis:
99
- datasetio
1010
providers:
1111
eval:
12-
- provider_id: trustyai_ragas
12+
- provider_id: ${env.KUBEFLOW_LLAMA_STACK_URL:+trustyai_ragas_remote}
1313
provider_type: remote::trustyai_ragas
14-
module: llama_stack_provider_ragas
14+
module: llama_stack_provider_ragas.remote
1515
config:
1616
embedding_model: ${env.EMBEDDING_MODEL}
1717
kubeflow_config:
@@ -22,6 +22,11 @@ providers:
2222
llama_stack_url: ${env.KUBEFLOW_LLAMA_STACK_URL}
2323
base_image: ${env.KUBEFLOW_BASE_IMAGE}
2424
pipelines_api_token: ${env.KUBEFLOW_PIPELINES_TOKEN:=}
25+
- provider_id: ${env.EMBEDDING_MODEL:+trustyai_ragas_inline}
26+
provider_type: inline::trustyai_ragas
27+
module: llama_stack_provider_ragas.inline
28+
config:
29+
embedding_model: ${env.EMBEDDING_MODEL}
2530
datasetio:
2631
- provider_id: localfs
2732
provider_type: inline::localfs

docs/modules/ROOT/pages/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ The goal is to provide all of Ragas' evaluation functionality over Llama Stack's
1515

1616
There are two versions of the provider:
1717

18-
* `remote`: runs the Ragas evaluation in a remote process, using Kubeflow Pipelines. This is the *default* when using the module-based import.
19-
* `inline`: runs the Ragas evaluation in the same process as the Llama Stack server.
18+
* `inline`: runs the Ragas evaluation in the same process as the Llama Stack server. This is always available with the base installation.
19+
* `remote`: runs the Ragas evaluation in a remote process, using Kubeflow Pipelines. Only available when remote dependencies are installed with `pip install llama-stack-provider-ragas[remote]`.
2020

2121
== Getting Started
2222

docs/modules/ROOT/pages/inline-provider.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ The inline provider is setup in the following lines of the `run-inline.yaml`:
139139
[,yaml]
140140
----
141141
eval:
142-
- provider_id: trustyai_ragas
142+
- provider_id: trustyai_ragas_inline
143143
provider_type: inline::trustyai_ragas
144144
module: llama_stack_provider_ragas.inline
145145
config:

docs/modules/ROOT/pages/remote-provider.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ The remote provider is setup in the following lines of the `run-remote.yaml`:
201201
[,yaml]
202202
----
203203
eval:
204-
- provider_id: trustyai_ragas
204+
- provider_id: trustyai_ragas_remote
205205
provider_type: remote::trustyai_ragas
206-
module: llama_stack_provider_ragas.remote # can also just be llama_stack_provider_ragas and it will default to remote
206+
module: llama_stack_provider_ragas.remote
207207
config:
208208
embedding_model: ${env.EMBEDDING_MODEL}
209209
kubeflow_config:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "llama-stack-provider-ragas"
7-
version = "0.4.0"
7+
version = "0.4.1"
88
description = "Ragas evaluation as an out-of-tree Llama Stack provider"
99
readme = "README.md"
1010
requires-python = ">=3.12"

0 commit comments

Comments
 (0)