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
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20260601101913537242.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Fix whitespace-only LanceDB vector store db_uri fallback."
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ def _validate_vector_store_db_uri(self) -> None:
"""Validate the vector store configuration."""
store = self.vector_store
if store.type == VectorStoreType.LanceDB:
if not store.db_uri or store.db_uri.strip == "":
# Treat whitespace-only values the same as a missing db_uri.
if not store.db_uri or store.db_uri.strip() == "":
store.db_uri = graphrag_config_defaults.vector_store.db_uri
store.db_uri = str(Path(store.db_uri).resolve())

Expand Down
13 changes: 13 additions & 0 deletions tests/unit/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path
from unittest import mock

from graphrag.config.defaults import graphrag_config_defaults
from graphrag.config.load_config import load_config
from graphrag.config.models.graph_rag_config import GraphRagConfig

Expand All @@ -26,6 +27,18 @@ def test_default_config() -> None:
assert_graphrag_configs(actual, expected)


def test_lancedb_vector_store_whitespace_db_uri_uses_default() -> None:
actual = GraphRagConfig(
completion_models=DEFAULT_COMPLETION_MODELS, # type: ignore
embedding_models=DEFAULT_EMBEDDING_MODELS, # type: ignore
vector_store={"db_uri": " "},
)

# Whitespace-only values are equivalent to an omitted db_uri.
expected_db_uri = Path(graphrag_config_defaults.vector_store.db_uri).resolve()
assert actual.vector_store.db_uri == str(expected_db_uri)


@mock.patch.dict(os.environ, {"CUSTOM_API_KEY": FAKE_API_KEY}, clear=True)
def test_load_minimal_config() -> None:
cwd = Path.cwd()
Expand Down