Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a1cb769
upgrade to llama-stack 0.3.0.
dmaniloff Oct 10, 2025
abf61a3
Use SamplingParams in wrappers.
dmaniloff Oct 13, 2025
b8cfeae
Conditionally include remote if dependencies are installed.
dmaniloff Oct 13, 2025
d6e39ed
Update basic_demo notebook and constants for Ragas evaluation.
dmaniloff Oct 13, 2025
7c39ed9
uv sync.
dmaniloff Oct 13, 2025
ee7c63e
Use constants for provider types in inline and remote providers.
dmaniloff Oct 13, 2025
8314f45
Update README & docs.
dmaniloff Oct 13, 2025
7f5a56c
Update pandas dependency to version <2.3.0 in pyproject.toml and uv.l…
dmaniloff Oct 14, 2025
73e0496
Pin to LLS 0.2.23.
dmaniloff Oct 14, 2025
36e613c
Version bump.
dmaniloff Oct 14, 2025
af80f2f
revert changes to provider.py
dmaniloff Oct 15, 2025
3b9ec66
Update dependencies in pyproject.toml: remove llama-stack-client, upg…
dmaniloff Oct 15, 2025
e1b82aa
revert changes to pyproject.
dmaniloff Oct 15, 2025
a95e028
revert changes to uv.lock
dmaniloff Oct 15, 2025
ca9c978
Merge branch 'main' into openai-api-downgrade-pandas
dmaniloff Oct 15, 2025
cb233cb
revert changes to provider.py modules.
dmaniloff Oct 15, 2025
79453f4
revert changes to vscode config.
dmaniloff Oct 15, 2025
c487948
revert distro & demo changes.
dmaniloff Oct 15, 2025
5a055bb
revert changes to constants.py
dmaniloff Oct 15, 2025
0d14b2a
revert doc changes.
dmaniloff Oct 15, 2025
6982453
part of revert changes to constants.py.
dmaniloff Oct 15, 2025
ab62532
version bump.
dmaniloff Oct 15, 2025
405c110
Merge branch 'main' into openai-api-downgrade-pandas
dmaniloff Oct 16, 2025
208c880
Update llama-stack dependency to allow versions >=0.2.23 in pyproject…
dmaniloff Oct 16, 2025
34cbd69
Merge branch 'main' into openai-api-downgrade-pandas
dmaniloff Oct 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,12 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Debug Ragas Distribution -- Remote",
"name": "Debug Ragas Distribution",
"type": "debugpy",
"request": "launch",
"module": "llama_stack.cli.llama",
"args": ["stack", "run", "distribution/run-remote.yaml"],
"cwd": "${workspaceFolder}",
"envFile": "${workspaceFolder}/.env",
"justMyCode": false
},
{
"name": "Debug Ragas Distribution -- Inline",
"type": "debugpy",
"request": "launch",
"module": "llama_stack.cli.llama",
"args": ["stack", "run", "distribution/run-inline.yaml"],
"args": ["stack", "run", "distribution/run.yaml"],
"cwd": "${workspaceFolder}",
"envFile": "${workspaceFolder}/.env",
"justMyCode": false
Expand Down
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This repository implements [Ragas](https://github.com/explodinggradients/ragas)
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.

There are two versions of the provider:
- `inline`: runs the Ragas evaluation in the same process as the Llama Stack server.
- `remote`: runs the Ragas evaluation in a remote process, using Kubeflow Pipelines.
- `inline`: runs the Ragas evaluation in the same process as the Llama Stack server. This is always available with the base installation.
- `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]`.

## Prerequisites
- Python 3.12
Expand All @@ -41,12 +41,29 @@ There are two versions of the provider:
```
- 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.

### Remote provider (default)
### Inline provider (default with base installation)

Create a `.env` file with the required environment variable:
```bash
EMBEDDING_MODEL=ollama/all-minilm:l6-v2
```

Run the server:
```bash
dotenv run uv run llama stack run distribution/run.yaml
```

### Remote provider (requires optional dependencies)

First install the remote dependencies:
```bash
uv pip install -e ".[remote]"
```

Create a `.env` file with the following:
```bash
# Required for both inline and remote
EMBEDDING_MODEL=all-MiniLM-L6-v2
EMBEDDING_MODEL=ollama/all-minilm:l6-v2

# Required for remote provider
KUBEFLOW_LLAMA_STACK_URL=<your-llama-stack-url>
Expand All @@ -73,22 +90,9 @@ Where:

Run the server:
```bash
dotenv run uv run llama stack run distribution/run-remote.yaml
```

### Inline provider (need to specify `.inline` in the module name)

Create a `.env` file with the required environment variable:
```bash
EMBEDDING_MODEL=all-MiniLM-L6-v2
```

Run the server:
```bash
dotenv run uv run llama stack run distribution/run-inline.yaml
dotenv run uv run llama stack run distribution/run.yaml
```

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.

## Usage
See the demos in the `demos` directory.
711 changes: 447 additions & 264 deletions demos/remote_demo.ipynb → demos/basic_demo.ipynb

Large diffs are not rendered by default.

880 changes: 0 additions & 880 deletions demos/inline_demo.ipynb

This file was deleted.

61 changes: 0 additions & 61 deletions distribution/run-inline.yaml

This file was deleted.

11 changes: 8 additions & 3 deletions distribution/run-remote.yaml → distribution/run.yaml
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nathan-weinberg I will post a PR to the distro to reflect these naming (provider_id/type) changes.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ apis:
- datasetio
providers:
eval:
- provider_id: trustyai_ragas
provider_type: remote::trustyai_ragas
- provider_id: trustyai_ragas_remote
provider_type: remote::trustyai_ragas_remote
module: llama_stack_provider_ragas
config:
embedding_model: ${env.EMBEDDING_MODEL}
Expand All @@ -20,7 +20,12 @@ providers:
pipelines_endpoint: ${env.KUBEFLOW_PIPELINES_ENDPOINT}
namespace: ${env.KUBEFLOW_NAMESPACE}
llama_stack_url: ${env.KUBEFLOW_LLAMA_STACK_URL}
base_image: ${env.KUBEFLOW_BASE_IMAGE}
base_image: ${env.KUBEFLOW_BASE_IMAGE:=}
- provider_id: trustyai_ragas_inline
provider_type: inline::trustyai_ragas_inline
module: llama_stack_provider_ragas.inline
config:
embedding_model: ${env.EMBEDDING_MODEL}
datasetio:
- provider_id: localfs
provider_type: inline::localfs
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ The goal is to provide all of Ragas' evaluation functionality over Llama Stack's

There are two versions of the provider:

* `remote`: runs the Ragas evaluation in a remote process, using Kubeflow Pipelines. This is the *default* when using the module-based import.
* `inline`: runs the Ragas evaluation in the same process as the Llama Stack server.
* `inline`: runs the Ragas evaluation in the same process as the Llama Stack server. This is always available with the base installation.
* `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]`.

== Getting Started

Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/inline-provider.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ The inline provider is setup in the following lines of the `run-inline.yaml`:
[,yaml]
----
eval:
- provider_id: trustyai_ragas
provider_type: inline::trustyai_ragas
- provider_id: trustyai_ragas_inline
provider_type: inline::trustyai_ragas_inline
module: llama_stack_provider_ragas.inline
config:
embedding_model: ${env.EMBEDDING_MODEL}
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/remote-provider.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ The remote provider is setup in the following lines of the `run-remote.yaml`:
[,yaml]
----
eval:
- provider_id: trustyai_ragas
provider_type: remote::trustyai_ragas
module: llama_stack_provider_ragas.remote # can also just be llama_stack_provider_ragas and it will default to remote
- provider_id: trustyai_ragas_remote
provider_type: remote::trustyai_ragas_remote
module: llama_stack_provider_ragas.remote
config:
embedding_model: ${env.EMBEDDING_MODEL}
kubeflow_config:
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ authors = [
keywords = ["llama-stack", "ragas", "evaluation"]
dependencies = [
"setuptools-scm",
"llama-stack==0.2.23",
Comment thread
dmaniloff marked this conversation as resolved.
"llama-stack @ git+https://github.com/llamastack/llama-stack.git",
"llama-stack-client @ git+https://github.com/llamastack/llama-stack-client-python.git",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace w/ 0.3.0 once ready.

"greenlet==3.2.4", # inline/files/localfs errors saying greenlet not found
"ragas==0.3.0",
"pandas==2.3.0",
Expand Down Expand Up @@ -84,8 +85,10 @@ ignore = [
"C901", # too complex
]

[tool.hatch.metadata]
allow-direct-references = true

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only temporary to allow git+https://github.com in the dependencies.

[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
Expand Down
4 changes: 3 additions & 1 deletion src/llama_stack_provider_ragas/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
faithfulness,
)

PROVIDER_ID_INLINE = "trustyai_ragas_inline"
PROVIDER_ID_REMOTE = "trustyai_ragas_remote"

METRIC_MAPPING = {
metric_func.name: metric_func
for metric_func in [
Expand All @@ -20,7 +23,6 @@
# "rouge_score": RougeScore(),
]
}

AVAILABLE_METRICS = list(METRIC_MAPPING.keys())

# Kubeflow ConfigMap keys and defaults for base image resolution
Expand Down
4 changes: 3 additions & 1 deletion src/llama_stack_provider_ragas/inline/provider.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from llama_stack.providers.datatypes import Api, InlineProviderSpec, ProviderSpec

from ..constants import PROVIDER_ID_INLINE


def get_provider_spec() -> ProviderSpec:
return InlineProviderSpec(
api=Api.eval,
provider_type="inline::trustyai_ragas",
provider_type=f"inline::{PROVIDER_ID_INLINE}",
pip_packages=["ragas==0.3.0"],
config_class="llama_stack_provider_ragas.config.RagasProviderInlineConfig",
module="llama_stack_provider_ragas.inline",
Expand Down
Loading