docs: improve vector store config documentation and fix test isolation

This commit is contained in:
skamenan7 2025-08-13 17:13:57 -04:00 committed by Sumanth Kamenani
parent 68c8d9ace5
commit 418a25aea9
3 changed files with 24 additions and 4 deletions

View file

@ -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 ```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: vector_store_config:
default_embedding_model: ${env.LLAMA_STACK_DEFAULT_EMBEDDING_MODEL:=all-MiniLM-L6-v2} default_embedding_model: ${env.LLAMA_STACK_DEFAULT_EMBEDDING_MODEL:=all-MiniLM-L6-v2}
# optional - if omitted, defaults to 384 # optional - if omitted, defaults to 384

View file

@ -7,7 +7,10 @@
from llama_stack.apis.common.vector_store_config import VectorStoreConfig 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() config = VectorStoreConfig()
assert config.default_embedding_model is None assert config.default_embedding_model is None
assert config.default_embedding_dimension is None assert config.default_embedding_dimension is None

View file

@ -5,9 +5,13 @@
# the root directory of this source tree. # the root directory of this source tree.
import pytest
from llama_stack.apis.models import ModelType from llama_stack.apis.models import ModelType
from llama_stack.core.routers.vector_io import VectorIORouter from llama_stack.core.routers.vector_io import VectorIORouter
pytestmark = pytest.mark.asyncio
class _DummyModel: class _DummyModel:
def __init__(self, identifier: str, dim: int): def __init__(self, identifier: str, dim: int):