mirror of
https://github.com/meta-llama/llama-stack.git
synced 2026-01-03 09:22:17 +00:00
address comments
This commit is contained in:
parent
c03f7fe9be
commit
d19526ecd7
7 changed files with 127 additions and 124 deletions
|
|
@ -8,8 +8,8 @@ import pytest
|
|||
|
||||
from ..conftest import (
|
||||
get_provider_fixture_overrides,
|
||||
get_provider_fixtures_from_config,
|
||||
try_load_config_file_cached,
|
||||
get_provider_fixture_overrides_from_test_config,
|
||||
get_test_config_for_api,
|
||||
)
|
||||
from ..inference.fixtures import INFERENCE_FIXTURES
|
||||
from ..memory.fixtures import MEMORY_FIXTURES
|
||||
|
|
@ -87,25 +87,14 @@ def pytest_configure(config):
|
|||
|
||||
|
||||
def pytest_generate_tests(metafunc):
|
||||
test_config = try_load_config_file_cached(metafunc.config)
|
||||
(
|
||||
config_override_inference_models,
|
||||
config_override_safety_shield,
|
||||
custom_provider_fixtures,
|
||||
) = (None, None, None)
|
||||
if test_config is not None and test_config.agent is not None:
|
||||
config_override_inference_models = test_config.agent.fixtures.inference_models
|
||||
config_override_safety_shield = test_config.agent.fixtures.safety_shield
|
||||
custom_provider_fixtures = get_provider_fixtures_from_config(
|
||||
test_config.agent.fixtures.provider_fixtures, DEFAULT_PROVIDER_COMBINATIONS
|
||||
)
|
||||
|
||||
shield_id = config_override_safety_shield or metafunc.config.getoption(
|
||||
"--safety-shield"
|
||||
)
|
||||
inference_model = config_override_inference_models or [
|
||||
test_config = get_test_config_for_api(metafunc.config, "agents")
|
||||
shield_id = getattr(
|
||||
test_config, "safety_shield", None
|
||||
) or metafunc.config.getoption("--safety-shield")
|
||||
inference_models = getattr(test_config, "inference_models", None) or [
|
||||
metafunc.config.getoption("--inference-model")
|
||||
]
|
||||
|
||||
if "safety_shield" in metafunc.fixturenames:
|
||||
metafunc.parametrize(
|
||||
"safety_shield",
|
||||
|
|
@ -113,7 +102,7 @@ def pytest_generate_tests(metafunc):
|
|||
indirect=True,
|
||||
)
|
||||
if "inference_model" in metafunc.fixturenames:
|
||||
models = set(inference_model)
|
||||
models = set(inference_models)
|
||||
if safety_model := safety_model_from_shield(shield_id):
|
||||
models.add(safety_model)
|
||||
|
||||
|
|
@ -131,7 +120,9 @@ def pytest_generate_tests(metafunc):
|
|||
"tool_runtime": TOOL_RUNTIME_FIXTURES,
|
||||
}
|
||||
combinations = (
|
||||
custom_provider_fixtures
|
||||
get_provider_fixture_overrides_from_test_config(
|
||||
metafunc.config, "agents", DEFAULT_PROVIDER_COMBINATIONS
|
||||
)
|
||||
or get_provider_fixture_overrides(metafunc.config, available_fixtures)
|
||||
or DEFAULT_PROVIDER_COMBINATIONS
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import pytest
|
|||
from llama_stack.apis.agents import AgentConfig, Turn
|
||||
from llama_stack.apis.inference import SamplingParams, UserMessage
|
||||
from llama_stack.providers.datatypes import Api
|
||||
from llama_stack.providers.utils.kvstore import kvstore_impl, SqliteKVStoreConfig
|
||||
from llama_stack.providers.utils.kvstore import kvstore_impl
|
||||
from llama_stack.providers.utils.kvstore.config import SqliteKVStoreConfig
|
||||
|
||||
from .fixtures import pick_inference_model
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue