move from /v1 to /v1alpha. also move POST /test to GET /health

This commit is contained in:
Raghotham Murthy 2025-10-27 13:05:27 -07:00
parent 4306ecdbe7
commit 659e6ee86c
3 changed files with 12 additions and 12 deletions

View file

@ -9,7 +9,7 @@ from typing import Any, Protocol, runtime_checkable
from pydantic import BaseModel from pydantic import BaseModel
from llama_stack.apis.providers.connection import ProviderConnectionInfo 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.providers.datatypes import HealthResponse
from llama_stack.schema_utils import json_schema_type, webmethod from llama_stack.schema_utils import json_schema_type, webmethod
@ -152,7 +152,7 @@ class Providers(Protocol):
# ===== Dynamic Provider Management Methods ===== # ===== 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( async def register_provider(
self, self,
api: str, 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( async def update_provider(
self, self,
api: str, 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: async def unregister_provider(self, api: str, provider_id: str) -> None:
"""Unregister a dynamic provider. """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) @webmethod(route="/admin/providers/{api}/{provider_id}/health", method="GET", level=LLAMA_STACK_API_V1ALPHA)
async def test_provider_connection(self, api: str, provider_id: str) -> TestProviderConnectionResponse: async def health(self, api: str, provider_id: str) -> TestProviderConnectionResponse:
"""Test a provider connection. """Check provider health.
Execute a health check on a provider to verify it is reachable and functioning. Execute a health check on a provider to verify it is reachable and functioning.
:param api: API namespace the provider implements. :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. :returns: TestProviderConnectionResponse with health status.
""" """
... ...

View file

@ -592,8 +592,8 @@ class ProviderImpl(Providers):
logger.error(f"Failed to unregister provider {provider_id}: {e}") logger.error(f"Failed to unregister provider {provider_id}: {e}")
raise RuntimeError(f"Failed to unregister provider: {e}") from e raise RuntimeError(f"Failed to unregister provider: {e}") from e
async def test_provider_connection(self, api: str, provider_id: str) -> TestProviderConnectionResponse: async def health(self, api: str, provider_id: str) -> TestProviderConnectionResponse:
"""Test a provider connection.""" """Check provider health."""
# Check if provider exists (static or dynamic) # Check if provider exists (static or dynamic)
provider_impl = None provider_impl = None

View file

@ -257,7 +257,7 @@ class TestDynamicProviderManagement:
) )
# Test connection # 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 # Verify response
assert response.success is True assert response.success is True
@ -282,7 +282,7 @@ class TestDynamicProviderManagement:
) )
# Test connection # Test connection
response = await provider_impl.test_provider_connection( response = await provider_impl.health(
api=Api.inference.value, provider_id="test-unhealthy" api=Api.inference.value, provider_id="test-unhealthy"
) )