mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-09 13:14:39 +00:00
feat(vector-io): implement global default embedding model configuration (Issue #2729)
- Add VectorStoreConfig with global default_embedding_model and default_embedding_dimension - Support environment variables LLAMA_STACK_DEFAULT_EMBEDDING_MODEL and LLAMA_STACK_DEFAULT_EMBEDDING_DIMENSION - Implement precedence: explicit model > global default > clear error (no fallback) - Update VectorIORouter with _resolve_embedding_model() precedence logic - Remove non-deterministic 'first model in run.yaml' fallback behavior - Add vector_store_config to StackRunConfig and all distribution templates - Include comprehensive unit tests for config loading and router precedence - Update documentation with configuration examples and usage patterns - Fix error messages to include 'Failed to' prefix per coding standards Resolves deterministic vector store creation by eliminating unpredictable fallbacks and providing clear configuration options at the stack level.
This commit is contained in:
parent
8422bd102a
commit
17fbd21c0d
7 changed files with 243 additions and 8 deletions
26
tests/unit/common/test_vector_store_config.py
Normal file
26
tests/unit/common/test_vector_store_config.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from llama_stack.apis.common.vector_store_config import VectorStoreConfig
|
||||
|
||||
|
||||
def test_defaults():
|
||||
cfg = VectorStoreConfig()
|
||||
assert cfg.default_embedding_model is None
|
||||
assert cfg.default_embedding_dimension is None
|
||||
|
||||
|
||||
def test_env_loading(monkeypatch):
|
||||
monkeypatch.setenv("LLAMA_STACK_DEFAULT_EMBEDDING_MODEL", "test-model")
|
||||
monkeypatch.setenv("LLAMA_STACK_DEFAULT_EMBEDDING_DIMENSION", "123")
|
||||
|
||||
cfg = VectorStoreConfig()
|
||||
assert cfg.default_embedding_model == "test-model"
|
||||
assert cfg.default_embedding_dimension == 123
|
||||
|
||||
# Clean up
|
||||
monkeypatch.delenv("LLAMA_STACK_DEFAULT_EMBEDDING_MODEL", raising=False)
|
||||
monkeypatch.delenv("LLAMA_STACK_DEFAULT_EMBEDDING_DIMENSION", raising=False)
|
Loading…
Add table
Add a link
Reference in a new issue