Skip to content

Commit 578cd03

Browse files
committed
chore(06-01): fix Hydra version_base and add config verification tests
- Change version_base from '1.1' to None for forward compatibility - Remove TODO comment explaining the quick fix - Remove TODO comment from config.yaml _self_ line - Add 3 new tests verifying config loads correctly, values unchanged, and no version_base warnings - All 96 tests pass (93 original + 3 new)
1 parent db17b2d commit 578cd03

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

.hydra_config/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
defaults:
2-
- _self_ # TODO: Silences the hydra version migration warning (PLEASE REVIEW FOR BREAKING CHANGES)
2+
- _self_
33
- chunker: ${oc.env:CHUNKER, recursive_splitter} # recursive_splitter
44
- retriever: ${oc.env:RETRIEVER_TYPE, single} # single # multiQuery # hyde
55
- rag: ChatBotRag

openrag/config/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def load_config(config_path=CONFIG_PATH, overrides=None) -> OmegaConf:
1616
if GlobalHydra.instance().is_initialized():
1717
GlobalHydra.instance().clear()
1818

19-
# TODO: I set the version base to 1.1 to silence the warning message, review how we want to handle versioning
20-
with initialize_config_dir(config_dir=str(config_path), job_name="config_loader", version_base="1.1"):
19+
# version_base=None uses current Hydra version defaults (forward compatible)
20+
with initialize_config_dir(config_dir=str(config_path), job_name="config_loader", version_base=None):
2121
config = compose(config_name="config", overrides=overrides)
2222

2323
config.paths.data_dir = Path(config.paths.data_dir).resolve()

openrag/config/test_config.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import warnings
2+
3+
from config import load_config
4+
5+
6+
def test_config_loads_successfully():
7+
"""Verify config loads and returns expected structure."""
8+
config = load_config()
9+
10+
assert config is not None
11+
assert hasattr(config, "llm")
12+
assert hasattr(config, "embedder")
13+
assert hasattr(config, "vectordb")
14+
assert hasattr(config, "paths")
15+
assert hasattr(config, "loader")
16+
17+
18+
def test_config_critical_values_unchanged():
19+
"""Verify critical config values match expected defaults."""
20+
config = load_config()
21+
22+
# LLM settings
23+
assert config.llm.temperature == 0.1
24+
25+
# Embedder settings
26+
assert config.embedder.provider == "openai"
27+
28+
# Vectordb settings (note: hybrid_search is a string 'True' due to oc.env without oc.decode)
29+
assert config.vectordb.hybrid_search == 'True'
30+
31+
# Loader settings (boolean because it uses oc.decode)
32+
assert config.loader.image_captioning is True
33+
34+
35+
def test_config_no_hydra_version_warnings():
36+
"""Verify no version_base warnings are emitted during config loading."""
37+
with warnings.catch_warnings(record=True) as captured_warnings:
38+
warnings.simplefilter("always")
39+
load_config()
40+
41+
# Check no warnings contain "version_base"
42+
for warning in captured_warnings:
43+
assert "version_base" not in str(warning.message).lower(), \
44+
f"Unexpected version_base warning: {warning.message}"

0 commit comments

Comments
 (0)