From 418a25aea9748d3826f270300a8b4e9701ad2c86 Mon Sep 17 00:00:00 2001 From: skamenan7 Date: Wed, 13 Aug 2025 17:13:57 -0400 Subject: [PATCH] docs: improve vector store config documentation and fix test isolation --- docs/source/distributions/configuration.md | 19 ++++++++++++++++--- tests/unit/common/test_vector_store_config.py | 5 ++++- .../unit/router/test_embedding_precedence.py | 4 ++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/source/distributions/configuration.md b/docs/source/distributions/configuration.md index 4132cab79..62f11cc30 100644 --- a/docs/source/distributions/configuration.md +++ b/docs/source/distributions/configuration.md @@ -688,13 +688,26 @@ shields: ... ``` -### Global Vector-Store Defaults +## Global Vector Store Defaults -You can provide a *stack-level* default embedding model that will be used whenever a new vector-store is created and the caller does **not** specify an `embedding_model` parameter. +You can provide a stack-level default embedding model that will be used whenever a new vector store is created and the caller does not specify an `embedding_model` parameter. -Add a top-level block next to `models:` and `vector_io:` in your build/run YAML: +Add a top-level `vector_store_config` block at the root of your build/run YAML, alongside other root-level keys such as `models`, `shields`, `server`, and `metadata_store`: ```yaml +# ... other configuration sections ... +metadata_store: + namespace: null + type: sqlite + db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/registry.db +models: +- metadata: {} + model_id: ${env.INFERENCE_MODEL} + provider_id: ollama + provider_model_id: null +shields: [] +server: + port: 8321 vector_store_config: default_embedding_model: ${env.LLAMA_STACK_DEFAULT_EMBEDDING_MODEL:=all-MiniLM-L6-v2} # optional - if omitted, defaults to 384 diff --git a/tests/unit/common/test_vector_store_config.py b/tests/unit/common/test_vector_store_config.py index 76e2372be..2b45fa5b9 100644 --- a/tests/unit/common/test_vector_store_config.py +++ b/tests/unit/common/test_vector_store_config.py @@ -7,7 +7,10 @@ from llama_stack.apis.common.vector_store_config import VectorStoreConfig -def test_defaults(): +def test_defaults(monkeypatch): + # ensure env is clean to avoid flaky defaults + monkeypatch.delenv("LLAMA_STACK_DEFAULT_EMBEDDING_MODEL", raising=False) + monkeypatch.delenv("LLAMA_STACK_DEFAULT_EMBEDDING_DIMENSION", raising=False) config = VectorStoreConfig() assert config.default_embedding_model is None assert config.default_embedding_dimension is None diff --git a/tests/unit/router/test_embedding_precedence.py b/tests/unit/router/test_embedding_precedence.py index 27c039865..5f8d81e05 100644 --- a/tests/unit/router/test_embedding_precedence.py +++ b/tests/unit/router/test_embedding_precedence.py @@ -5,9 +5,13 @@ # the root directory of this source tree. +import pytest + from llama_stack.apis.models import ModelType from llama_stack.core.routers.vector_io import VectorIORouter +pytestmark = pytest.mark.asyncio + class _DummyModel: def __init__(self, identifier: str, dim: int):