Skip to content

Commit e184541

Browse files
are-cesclaude
andauthored
LCORE-1422: Inline RAG (BYOK) e2e tests (#1370)
* LCORE-1422: Inline RAG (BYOK) e2e tests - Add 6 e2e scenarios: query, streaming query, responses API, streaming responses API, referenced documents, RAG source registration - Add inline RAG configs for server, library, and prow modes - Add reusable "The service uses the {config} configuration" Background step - Fix BYOK RAG enrichment duplicate detection with env var references - Add after_feature safety net to restore config backups Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4b8a739 commit e184541

19 files changed

Lines changed: 370 additions & 20 deletions

docker-compose-library.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ services:
7171
- WATSONX_API_KEY=${WATSONX_API_KEY:-}
7272
# Enable debug logging if needed
7373
- LLAMA_STACK_LOGGING=${LLAMA_STACK_LOGGING:-}
74-
# FAISS test
74+
# FAISS test and inline RAG config
7575
- FAISS_VECTOR_STORE_ID=${FAISS_VECTOR_STORE_ID:-}
7676
healthcheck:
7777
test: ["CMD", "curl", "-f", "http://localhost:8080/liveness"]

docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ services:
8989
- TENANT_ID=${TENANT_ID:-}
9090
- CLIENT_ID=${CLIENT_ID:-}
9191
- CLIENT_SECRET=${CLIENT_SECRET:-}
92+
# FAISS vector store ID (used by inline RAG config)
93+
- FAISS_VECTOR_STORE_ID=${FAISS_VECTOR_STORE_ID:-}
9294
depends_on:
9395
llama-stack:
9496
condition: service_healthy

src/llama_stack_configuration.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ def construct_vector_stores_section(
184184
output = ls_config["registered_resources"]["vector_stores"].copy()
185185

186186
# append new vector_stores entries, skipping duplicates
187-
existing_store_ids = {vs.get("vector_store_id") for vs in output}
187+
# Resolve ${env.VAR} patterns so comparisons work when existing entries
188+
# use environment variable references and new entries have resolved values.
189+
existing_store_ids = {
190+
replace_env_vars(vs.get("vector_store_id", "")) for vs in output
191+
}
188192
added = 0
189193
for brag in byok_rag:
190194
if not brag.get("rag_id"):

test.containerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ COPY src ./src
2020
RUN uv sync --locked --no-install-project --group llslibdev
2121

2222
# Add virtual environment to PATH for llama command
23-
ENV PATH="/opt/app-root/.venv/bin:$PATH"
23+
ENV PATH="/opt/app-root/.venv/bin:$PATH" \
24+
PYTHONPATH="/opt/app-root/src"
2425

2526
# Set HOME directory so llama-stack uses /opt/app-root/src/.llama
2627
ENV HOME="/opt/app-root/src"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lightspeed Core Service (LCS)
2+
service:
3+
host: 0.0.0.0
4+
port: 8080
5+
auth_enabled: false
6+
workers: 1
7+
color_log: true
8+
access_log: true
9+
llama_stack:
10+
use_as_library_client: false
11+
url: http://${env.E2E_LLAMA_HOSTNAME}:8321
12+
api_key: xyzzy
13+
user_data_collection:
14+
feedback_enabled: true
15+
feedback_storage: "/tmp/data/feedback"
16+
transcripts_enabled: true
17+
transcripts_storage: "/tmp/data/transcripts"
18+
19+
conversation_cache:
20+
type: "sqlite"
21+
sqlite:
22+
db_path: "/tmp/data/conversation-cache.db"
23+
24+
authentication:
25+
module: "noop"
26+
27+
byok_rag:
28+
- rag_id: e2e-test-docs
29+
rag_type: inline::faiss
30+
embedding_model: sentence-transformers/all-mpnet-base-v2
31+
embedding_dimension: 768
32+
vector_db_id: ${env.FAISS_VECTOR_STORE_ID}
33+
db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db}
34+
score_multiplier: 1.0
35+
36+
rag:
37+
inline:
38+
- e2e-test-docs

tests/e2e/configs/run-ci.yaml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,7 @@ providers:
5858
- config: {} # Enable MCP (Model Context Protocol) support
5959
provider_id: model-context-protocol
6060
provider_type: remote::model-context-protocol
61-
vector_io:
62-
- config: # Define the storage backend for RAG
63-
persistence:
64-
namespace: vector_io::faiss
65-
backend: kv_rag
66-
provider_id: faiss
67-
provider_type: inline::faiss
61+
vector_io: []
6862
agents:
6963
- config:
7064
persistence:
@@ -111,9 +105,6 @@ storage:
111105
kv_default:
112106
type: kv_sqlite
113107
db_path: ${env.KV_STORE_PATH:=~/.llama/storage/kv_store.db}
114-
kv_rag: # Define the storage backend type for RAG
115-
type: kv_sqlite
116-
db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db}
117108
sql_default:
118109
type: sql_sqlite
119110
db_path: ${env.SQL_STORE_PATH:=~/.llama/storage/sql_store.db}
@@ -144,11 +135,7 @@ registered_resources:
144135
- shield_id: llama-guard
145136
provider_id: llama-guard
146137
provider_shield_id: openai/gpt-4o-mini
147-
vector_stores:
148-
- embedding_dimension: 768
149-
embedding_model: sentence-transformers/all-mpnet-base-v2
150-
provider_id: faiss
151-
vector_store_id: ${env.FAISS_VECTOR_STORE_ID}
138+
vector_stores: []
152139
datasets: []
153140
scoring_fns: []
154141
benchmarks: []

tests/e2e/configuration/library-mode/lightspeed-stack-auth-noop-token.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,16 @@ authentication:
2626
inference:
2727
default_provider: openai
2828
default_model: gpt-4o-mini
29+
30+
byok_rag:
31+
- rag_id: e2e-test-docs
32+
rag_type: inline::faiss
33+
embedding_model: sentence-transformers/all-mpnet-base-v2
34+
embedding_dimension: 768
35+
vector_db_id: ${env.FAISS_VECTOR_STORE_ID}
36+
db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db}
37+
score_multiplier: 1.0
38+
39+
rag:
40+
tool:
41+
- e2e-test-docs
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Lightspeed Core Service (LCS)
2+
service:
3+
host: 0.0.0.0
4+
port: 8080
5+
auth_enabled: false
6+
workers: 1
7+
color_log: true
8+
access_log: true
9+
llama_stack:
10+
use_as_library_client: true
11+
library_client_config_path: run.yaml
12+
user_data_collection:
13+
feedback_enabled: true
14+
feedback_storage: "/tmp/data/feedback"
15+
transcripts_enabled: true
16+
transcripts_storage: "/tmp/data/transcripts"
17+
18+
conversation_cache:
19+
type: "sqlite"
20+
sqlite:
21+
db_path: "/tmp/data/conversation-cache.db"
22+
23+
authentication:
24+
module: "noop"
25+
inference:
26+
default_provider: openai
27+
default_model: gpt-4o-mini
28+
29+
byok_rag:
30+
- rag_id: e2e-test-docs
31+
rag_type: inline::faiss
32+
embedding_model: sentence-transformers/all-mpnet-base-v2
33+
embedding_dimension: 768
34+
vector_db_id: ${env.FAISS_VECTOR_STORE_ID}
35+
db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db}
36+
score_multiplier: 1.0
37+
38+
rag:
39+
inline:
40+
- e2e-test-docs

tests/e2e/configuration/library-mode/lightspeed-stack.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ authentication:
2020
inference:
2121
default_provider: openai
2222
default_model: gpt-4o-mini
23+
byok_rag:
24+
- rag_id: e2e-test-docs
25+
rag_type: inline::faiss
26+
embedding_model: sentence-transformers/all-mpnet-base-v2
27+
embedding_dimension: 768
28+
vector_db_id: ${env.FAISS_VECTOR_STORE_ID}
29+
db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db}
30+
score_multiplier: 1.0
31+
32+
rag:
33+
tool:
34+
- e2e-test-docs
35+
2336
mcp_servers:
2437
# Mock server with client-provided auth - should appear in mcp-auth/client-options response
2538
- name: "github-api"

tests/e2e/configuration/server-mode/lightspeed-stack-auth-noop-token.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,16 @@ authentication:
3232
inference:
3333
default_provider: openai
3434
default_model: gpt-4o-mini
35+
36+
byok_rag:
37+
- rag_id: e2e-test-docs
38+
rag_type: inline::faiss
39+
embedding_model: sentence-transformers/all-mpnet-base-v2
40+
embedding_dimension: 768
41+
vector_db_id: ${env.FAISS_VECTOR_STORE_ID}
42+
db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db}
43+
score_multiplier: 1.0
44+
45+
rag:
46+
tool:
47+
- e2e-test-docs

0 commit comments

Comments
 (0)