@@ -4,24 +4,13 @@ This PoC demonstrates how Agent Builder can use the `kbn/evals` Python SDK for d
44management, experiment tracing, and evaluator score ingestion—capabilities previously
55handled through Opik—and how to build custom evaluators.
66
7- ## 1. Dependencies
8-
9- ` run2.py ` uses external Orca evaluators. Clone the ` orca ` repo as a sibling of
10- ` elastic-evals-sdk-python/ ` so the layout is:
11-
12- ```
13- ── elastic-evals-sdk-python/
14- ── orca/
15- ```
16-
17- ## 2. Python environment
7+ ## 1. Python environment
188
199From the SDK repo root:
2010
2111``` bash
2212uv sync --group dev --extra runner --extra poc
2313source .venv/bin/activate
24- uv pip install --editable ../orca
2514```
2615
2716Register the venv as a Jupyter kernel. Only needed if your notebook/IDE doesn't pick up ` .venv ` automatically:
@@ -30,7 +19,7 @@ Register the venv as a Jupyter kernel. Only needed if your notebook/IDE doesn't
3019uv run --no-sync python -m ipykernel install --user --name elastic-evals-poc
3120```
3221
33- ## 3 . Secrets
22+ ## 2 . Secrets
3423
3524Create ` .env ` next to ` .env.example ` :
3625
@@ -39,19 +28,18 @@ cp examples/opik_vs_elastic/.env.example examples/opik_vs_elastic/.env
3928```
4029
4130Set the local URLs, ` ELASTICSEARCH_API_KEY ` , ` KIBANA_API_KEY ` , ` CONNECTOR_ID ` ,
42- and ` EVALUATION_CONNECTOR_ID ` . The Opik variables are used when ` run2.py ` runs
43- the tracked external Orca evaluators. Retrieve internal credentials from Vault
44- when needed:
31+ and ` EVALUATION_CONNECTOR_ID ` . Retrieve internal credentials from Vault when
32+ needed:
4533
4634``` bash
4735VAULT_ADDR=https://secrets.elastic.co:8200 vault login --method oidc
4836```
4937
5038The public Hugging Face dataset does not require an API key.
5139
52- ## 4 . Data source and sample size
40+ ## 3 . Data source and sample size
5341
54- Set these values near the top of the script before running it :
42+ Set these values near the top of the script you're running:
5543
5644``` python
5745USE_ENTIRE_DATASET = False
@@ -65,19 +53,30 @@ files. `DATASET_SAMPLE_SIZE` is ignored when `USE_ENTIRE_DATASET` is `True`.
6553The entire knowledge base is always indexed.
6654
6755The available examples and their order may differ between Hugging Face and GCS.
68- ` run.py ` defaults to 10 examples and ` run2.py ` defaults to 3 .
56+ Both scripts default to 10 examples.
6957
70- ## 5 . GCP access
58+ ## 4 . GCP access
7159
7260Only needed when ` USE_GCP = True ` . Authenticate with your ` @elastic.co ` account:
7361
7462``` bash
7563gcloud auth application-default login
7664```
7765
78- ## 6 . Local stack
66+ ## 5 . Local stack
7967
80- Use a separate terminal for each service and leave it running.
68+ The steps below run from a local Kibana checkout. If you don't have one already,
69+ clone [ elastic/kibana] ( https://github.com/elastic/kibana ) and bootstrap it:
70+
71+ ``` bash
72+ git clone https://github.com/elastic/kibana.git
73+ cd kibana
74+ nvm use
75+ yarn kbn bootstrap
76+ ```
77+
78+ Run the remaining commands from that ` kibana ` directory, using a separate
79+ terminal for each service and leaving it running.
8180
8281In ` kibana/config/kibana.dev.yml ` , enable evals and OTLP tracing:
8382
@@ -100,7 +99,6 @@ uiSettings:
10099### Elasticsearch
101100
102101` ` ` bash
103- cd /Users/mafaldasavelho/Documents/work-repos/kibana-fork/kibana
104102nvm use
105103yarn es snapshot --license trial
106104```
@@ -118,7 +116,6 @@ curl --user elastic:changeme \
118116Start Docker Desktop, then run:
119117
120118``` bash
121- cd /Users/mafaldasavelho/Documents/work-repos/kibana-fork/kibana
122119nvm use
123120node scripts/edot_collector.js
124121```
@@ -134,7 +131,6 @@ docker ps \
134131### Kibana
135132
136133``` bash
137- cd /Users/mafaldasavelho/Documents/work-repos/kibana-fork/kibana
138134nvm use
139135node scripts/kibana --dev --verbose
140136```
@@ -149,7 +145,7 @@ curl --silent --show-error \
149145 http://localhost:5601/dev/api/status
150146```
151147
152- ## 7 . Elasticsearch API key
148+ ## 6 . Elasticsearch API key
153149
154150Both scripts authenticate to Elasticsearch and Kibana. Create an API key against
155151the local cluster and paste the ` encoded ` field into both
@@ -164,7 +160,9 @@ This step is optional if both variables already contain a valid key for the
164160current cluster. API keys are cluster-specific, so a key from a previous local
165161Elasticsearch snapshot returns ` 401 ` .
166162
167- ## 8. Run the PoC
163+ ## 7. Run the PoC
164+
165+ Run both scripts from the SDK repo root.
168166
169167### ` run.py ` : managed workflow
170168
@@ -173,15 +171,14 @@ Demonstrates the higher-level workflow. It uses
173171run SDK-side and custom evaluators, and ingest their scores.
174172
175173``` bash
176- cd /Users/mafaldasavelho/Documents/work-repos/kibana-fork/evals-python-sdk/elastic-evals-sdk-python
177174uv run --no-sync python -m examples.opik_vs_elastic.run
178175```
179176
180177### ` run2.py ` : granular workflow
181178
182179Demonstrates the lower-level workflow without ` run_experiment() ` . It directly
183- coordinates the Dataset, Evaluators, and Score Ingestion APIs, runs the custom
184- Document Recall evaluator, and attaches external Orca scores .
180+ coordinates the Dataset, Evaluators, and Score Ingestion APIs, and runs the
181+ custom Document Recall evaluator alongside the Kibana ones .
185182
186183``` bash
187184uv run --no-sync python -m examples.opik_vs_elastic.run2
0 commit comments