Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions nemo_retriever/src/nemo_retriever/service/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ def start(
None, "--gpu-devices", help="Comma-separated GPU device IDs (overrides YAML)."
),
db_path: Optional[str] = typer.Option(None, "--db-path", help="SQLite database path (overrides YAML)."),
results_dir: Optional[str] = typer.Option(
None,
"--results-dir",
help="Directory for per-job result JSON files (overrides YAML).",
),
lancedb_uri: Optional[str] = typer.Option(
None,
"--lancedb-uri",
help="LanceDB URI for the embeddings table (overrides YAML).",
),
api_token: Optional[str] = typer.Option(
None,
"--api-token",
Expand Down Expand Up @@ -108,6 +118,10 @@ def start(
overrides["resources.gpu_devices"] = [d.strip() for d in gpu_devices.split(",") if d.strip()]
if db_path is not None:
overrides["database.path"] = db_path
if results_dir is not None:
overrides["processing.results_dir"] = results_dir
if lancedb_uri is not None:
overrides["vector_store.lancedb_uri"] = lancedb_uri
if api_token is not None:
overrides["auth.api_token"] = api_token
if drain_timeout_s is not None:
Expand Down
4 changes: 3 additions & 1 deletion nemo_retriever/src/nemo_retriever/service/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ProcessingConfig(BaseModel):
num_workers: int = 16
batch_size: int = 32
batch_timeout_s: float = 2.0
# Relative paths resolve against the current working directory.
results_dir: str = "retriever_results"


Expand Down Expand Up @@ -128,7 +129,8 @@ class VectorStoreConfig(BaseModel):

model_config = ConfigDict(extra="forbid")

lancedb_uri: str = "/var/lib/nemo-retriever/lancedb"
# Relative paths resolve against the current working directory.
lancedb_uri: str = "lancedb"
lancedb_table: str = "nv-ingest"
top_k: int = 10
vector_column_name: str = "vector"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ processing:
# Directory where per-job page results are written as JSON files.
# Each job gets a subdirectory: {results_dir}/{job_id}/. The results
# endpoint reads from here instead of SQLite for faster retrieval.
results_dir: "/home/local/jdyer/datasets/retriever_results"
#
# Relative paths resolve against the current working directory so
# `retriever service start` works out of the box on any host. The
# Helm chart overrides this to a path on the persistent volume.
results_dir: "retriever_results"

# Remote NIM microservice endpoints. When set, the pipeline calls these
# HTTP endpoints instead of loading GPU models locally. All four must
Expand Down Expand Up @@ -105,10 +109,11 @@ spool:
# to this table after every batch; the /v1/query endpoint reads from it.
# Both sides MUST point at the same URI + table for query to work.
#
# Override lancedb_uri for local development — the container default
# (/var/lib/nemo-retriever/lancedb) won't exist on the host.
# Relative paths resolve against the current working directory.
# Override via ./retriever-service.yaml or `--lancedb-uri` for any
# deployment that should keep its embeddings on a different volume.
vector_store:
lancedb_uri: "/home/local/jdyer/Development/NeMo-Retriever/lancedb"
lancedb_uri: "lancedb"
lancedb_table: "nv-ingest"
top_k: 10
vector_column_name: "vector"
Expand Down
35 changes: 35 additions & 0 deletions nemo_retriever/tests/test_service_bundled_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
# All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Tests for the bundled ``retriever-service.yaml`` shipped with the package."""

from __future__ import annotations

from pathlib import Path

from nemo_retriever.service.config import _bundled_yaml_path, load_config


def test_bundled_yaml_loads_cleanly():
bundled = _bundled_yaml_path()
assert bundled.is_file()
cfg = load_config(config_path=str(bundled))
assert cfg.processing.num_workers > 0
assert cfg.processing.results_dir
assert cfg.vector_store.lancedb_uri


def test_bundled_yaml_uses_cwd_relative_paths(tmp_path, monkeypatch):
"""`retriever service start` with no overrides must work in any cwd —
the bundled YAML's writable-state defaults must be relative.
"""
monkeypatch.chdir(tmp_path) # avoid picking up a stray ./retriever-service.yaml
cfg = load_config(config_path=None)

assert not Path(
cfg.processing.results_dir
).is_absolute(), f"bundled YAML pins absolute results_dir: {cfg.processing.results_dir!r}"
assert not Path(
cfg.vector_store.lancedb_uri
).is_absolute(), f"bundled YAML pins absolute lancedb_uri: {cfg.vector_store.lancedb_uri!r}"
Loading