add test cases for customizer

This commit is contained in:
Ubuntu 2025-03-06 19:34:02 +00:00 committed by raspawar
parent c71e2a0d87
commit 6a0c38f123
3 changed files with 51 additions and 1 deletions

View file

@ -77,7 +77,11 @@ providers:
post_training:
- provider_id: nvidia-customizer
provider_type: remote::nvidia
config: {}
config:
customizer_url: ${env.NVIDIA_CUSTOMIZER_URL:}
user_id: ${env.NVIDIA_USER_ID:}
project_id: ${env.NVIDIA_PROJECT_ID:}
dataset_namespace: ${env.NVIDIA_DATASET_NAMESPACE:}
tool_runtime:
- provider_id: rag-runtime
provider_type: inline::rag-runtime

View file

@ -0,0 +1,5 @@
# 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.

View file

@ -0,0 +1,41 @@
# 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.
import pytest
POST_TRAINING_PROVIDER_TYPES = ["remote::nvidia"]
@pytest.fixture(scope="session")
def post_training_provider_available(llama_stack_client):
providers = llama_stack_client.providers.list()
post_training_providers = [p for p in providers if p.provider_type in POST_TRAINING_PROVIDER_TYPES]
return len(post_training_providers) > 0
def test_post_training_provider_registration(llama_stack_client, post_training_provider_available):
"""Check if post_training is in the api list.
This is a sanity check to ensure the provider is registered."""
if not post_training_provider_available:
pytest.skip("post training provider not available")
providers = llama_stack_client.providers.list()
post_training_providers = [p for p in providers if p.provider_type in POST_TRAINING_PROVIDER_TYPES]
assert len(post_training_providers) > 0
assert any("post_training" in provider.api for provider in post_training_providers)
def test_list_training_jobs(llama_stack_client, post_training_provider_available):
"""Check if the list_jobs method returns a list of jobs."""
if not post_training_provider_available:
pytest.skip("post training provider not available")
jobs = llama_stack_client.post_training.job.list()
assert jobs is not None
assert isinstance(jobs, list)