From 659e6ee86cb5e386f585579a19ac7bf4b96a99d4 Mon Sep 17 00:00:00 2001 From: Raghotham Murthy Date: Mon, 27 Oct 2025 13:05:27 -0700 Subject: [PATCH] move from /v1 to /v1alpha. also move POST /test to GET /health --- llama_stack/apis/providers/providers.py | 16 ++++++++-------- llama_stack/core/providers.py | 4 ++-- tests/unit/core/test_dynamic_providers.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/llama_stack/apis/providers/providers.py b/llama_stack/apis/providers/providers.py index 38d7c4843..a927de667 100644 --- a/llama_stack/apis/providers/providers.py +++ b/llama_stack/apis/providers/providers.py @@ -9,7 +9,7 @@ from typing import Any, Protocol, runtime_checkable from pydantic import BaseModel from llama_stack.apis.providers.connection import ProviderConnectionInfo -from llama_stack.apis.version import LLAMA_STACK_API_V1 +from llama_stack.apis.version import LLAMA_STACK_API_V1, LLAMA_STACK_API_V1ALPHA from llama_stack.providers.datatypes import HealthResponse from llama_stack.schema_utils import json_schema_type, webmethod @@ -152,7 +152,7 @@ class Providers(Protocol): # ===== Dynamic Provider Management Methods ===== - @webmethod(route="/admin/providers/{api}", method="POST", level=LLAMA_STACK_API_V1) + @webmethod(route="/admin/providers/{api}", method="POST", level=LLAMA_STACK_API_V1ALPHA) async def register_provider( self, api: str, @@ -175,7 +175,7 @@ class Providers(Protocol): """ ... - @webmethod(route="/admin/providers/{api}/{provider_id}", method="PUT", level=LLAMA_STACK_API_V1) + @webmethod(route="/admin/providers/{api}/{provider_id}", method="PUT", level=LLAMA_STACK_API_V1ALPHA) async def update_provider( self, api: str, @@ -196,7 +196,7 @@ class Providers(Protocol): """ ... - @webmethod(route="/admin/providers/{api}/{provider_id}", method="DELETE", level=LLAMA_STACK_API_V1) + @webmethod(route="/admin/providers/{api}/{provider_id}", method="DELETE", level=LLAMA_STACK_API_V1ALPHA) async def unregister_provider(self, api: str, provider_id: str) -> None: """Unregister a dynamic provider. @@ -208,14 +208,14 @@ class Providers(Protocol): """ ... - @webmethod(route="/admin/providers/{api}/{provider_id}/test", method="POST", level=LLAMA_STACK_API_V1) - async def test_provider_connection(self, api: str, provider_id: str) -> TestProviderConnectionResponse: - """Test a provider connection. + @webmethod(route="/admin/providers/{api}/{provider_id}/health", method="GET", level=LLAMA_STACK_API_V1ALPHA) + async def health(self, api: str, provider_id: str) -> TestProviderConnectionResponse: + """Check provider health. Execute a health check on a provider to verify it is reachable and functioning. :param api: API namespace the provider implements. - :param provider_id: ID of the provider to test. + :param provider_id: ID of the provider to check. :returns: TestProviderConnectionResponse with health status. """ ... diff --git a/llama_stack/core/providers.py b/llama_stack/core/providers.py index aa1834d46..a1a78f286 100644 --- a/llama_stack/core/providers.py +++ b/llama_stack/core/providers.py @@ -592,8 +592,8 @@ class ProviderImpl(Providers): logger.error(f"Failed to unregister provider {provider_id}: {e}") raise RuntimeError(f"Failed to unregister provider: {e}") from e - async def test_provider_connection(self, api: str, provider_id: str) -> TestProviderConnectionResponse: - """Test a provider connection.""" + async def health(self, api: str, provider_id: str) -> TestProviderConnectionResponse: + """Check provider health.""" # Check if provider exists (static or dynamic) provider_impl = None diff --git a/tests/unit/core/test_dynamic_providers.py b/tests/unit/core/test_dynamic_providers.py index c7f3c5f05..f66b7c2f9 100644 --- a/tests/unit/core/test_dynamic_providers.py +++ b/tests/unit/core/test_dynamic_providers.py @@ -257,7 +257,7 @@ class TestDynamicProviderManagement: ) # Test connection - response = await provider_impl.test_provider_connection(api=Api.inference.value, provider_id="test-health") + response = await provider_impl.health(api=Api.inference.value, provider_id="test-health") # Verify response assert response.success is True @@ -282,7 +282,7 @@ class TestDynamicProviderManagement: ) # Test connection - response = await provider_impl.test_provider_connection( + response = await provider_impl.health( api=Api.inference.value, provider_id="test-unhealthy" )