forked from phoenix-oss/llama-stack-mirror
feat: Add NVIDIA NeMo datastore (#1852)
# What does this PR do? Implemetation of NeMO Datastore register, unregister API. Open Issues: - provider_id gets set to `localfs` in client.datasets.register() as it is specified in routing_tables.py: DatasetsRoutingTable see: #1860 Currently I have passed `"provider_id":"nvidia"` in metadata and have parsed that in `DatasetsRoutingTable` (Not the best approach, but just a quick workaround to make it work for now.) ## Test Plan - Unit test cases: `pytest tests/unit/providers/nvidia/test_datastore.py` ```bash ========================================================== test session starts =========================================================== platform linux -- Python 3.10.0, pytest-8.3.5, pluggy-1.5.0 rootdir: /home/ubuntu/llama-stack configfile: pyproject.toml plugins: anyio-4.9.0, asyncio-0.26.0, nbval-0.11.0, metadata-3.1.1, html-4.1.1, cov-6.1.0 asyncio: mode=strict, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function collected 2 items tests/unit/providers/nvidia/test_datastore.py .. [100%] ============================================================ warnings summary ============================================================ ====================================================== 2 passed, 1 warning in 0.84s ====================================================== ``` cc: @dglogo, @mattf, @yanxi0830
This commit is contained in:
parent
c149cf2e0f
commit
e6bbf8d20b
17 changed files with 514 additions and 9 deletions
47
tests/integration/providers/nvidia/test_datastore.py
Normal file
47
tests/integration/providers/nvidia/test_datastore.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
# 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
|
||||
|
||||
# How to run this test:
|
||||
#
|
||||
# LLAMA_STACK_CONFIG="nvidia" pytest -v tests/integration/providers/nvidia/test_datastore.py
|
||||
|
||||
|
||||
# nvidia provider only
|
||||
@pytest.mark.parametrize(
|
||||
"provider_id",
|
||||
[
|
||||
"nvidia",
|
||||
],
|
||||
)
|
||||
def test_register_and_unregister(llama_stack_client, provider_id):
|
||||
purpose = "eval/messages-answer"
|
||||
source = {
|
||||
"type": "uri",
|
||||
"uri": "hf://datasets/llamastack/simpleqa?split=train",
|
||||
}
|
||||
dataset_id = f"test-dataset-{provider_id}"
|
||||
dataset = llama_stack_client.datasets.register(
|
||||
dataset_id=dataset_id,
|
||||
purpose=purpose,
|
||||
source=source,
|
||||
metadata={"provider_id": provider_id, "format": "json", "description": "Test dataset description"},
|
||||
)
|
||||
assert dataset.identifier is not None
|
||||
assert dataset.provider_id == provider_id
|
||||
assert dataset.identifier == dataset_id
|
||||
|
||||
dataset_list = llama_stack_client.datasets.list()
|
||||
provider_datasets = [d for d in dataset_list if d.provider_id == provider_id]
|
||||
assert any(provider_datasets)
|
||||
assert any(d.identifier == dataset_id for d in provider_datasets)
|
||||
|
||||
llama_stack_client.datasets.unregister(dataset.identifier)
|
||||
dataset_list = llama_stack_client.datasets.list()
|
||||
provider_datasets = [d for d in dataset_list if d.identifier == dataset.identifier]
|
||||
assert not any(provider_datasets)
|
Loading…
Add table
Add a link
Reference in a new issue