mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-03 19:57:35 +00:00
Rather than have a single `LLAMA_STACK_VERSION`, we need to have a `_V1`, `_V1ALPHA`, and `_V1BETA` constant. This also necessitated addition of `level` to the `WebMethod` so that routing can be handeled properly. For backwards compat, the `v1` routes are being kept around and marked as `deprecated`. When used, the server will log a deprecation warning. move: post_training to v1alpha as it is under heavy development and not near its final state eval: job scheduling is not implemented. Relies heavily on the datasetio API which is under development missing implementations of specific routes indicating the structure of those routes might change. Additionally eval depends on the inference API which is going to be deprecated, eval will likely need a major API surface change to conform to using completions properly Signed-off-by: Charlie Doern <cdoern@redhat.com>
83 lines
2.3 KiB
Python
83 lines
2.3 KiB
Python
# 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.
|
|
|
|
from typing import Protocol, runtime_checkable
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from llama_stack.apis.version import LLAMA_STACK_API_V1
|
|
from llama_stack.providers.datatypes import HealthStatus
|
|
from llama_stack.schema_utils import json_schema_type, webmethod
|
|
|
|
|
|
@json_schema_type
|
|
class RouteInfo(BaseModel):
|
|
"""Information about an API route including its path, method, and implementing providers.
|
|
|
|
:param route: The API endpoint path
|
|
:param method: HTTP method for the route
|
|
:param provider_types: List of provider types that implement this route
|
|
"""
|
|
|
|
route: str
|
|
method: str
|
|
provider_types: list[str]
|
|
|
|
|
|
@json_schema_type
|
|
class HealthInfo(BaseModel):
|
|
"""Health status information for the service.
|
|
|
|
:param status: Current health status of the service
|
|
"""
|
|
|
|
status: HealthStatus
|
|
|
|
|
|
@json_schema_type
|
|
class VersionInfo(BaseModel):
|
|
"""Version information for the service.
|
|
|
|
:param version: Version number of the service
|
|
"""
|
|
|
|
version: str
|
|
|
|
|
|
class ListRoutesResponse(BaseModel):
|
|
"""Response containing a list of all available API routes.
|
|
|
|
:param data: List of available route information objects
|
|
"""
|
|
|
|
data: list[RouteInfo]
|
|
|
|
|
|
@runtime_checkable
|
|
class Inspect(Protocol):
|
|
@webmethod(route="/inspect/routes", method="GET", level=LLAMA_STACK_API_V1)
|
|
async def list_routes(self) -> ListRoutesResponse:
|
|
"""List all available API routes with their methods and implementing providers.
|
|
|
|
:returns: Response containing information about all available routes.
|
|
"""
|
|
...
|
|
|
|
@webmethod(route="/health", method="GET", level=LLAMA_STACK_API_V1)
|
|
async def health(self) -> HealthInfo:
|
|
"""Get the current health status of the service.
|
|
|
|
:returns: Health information indicating if the service is operational.
|
|
"""
|
|
...
|
|
|
|
@webmethod(route="/version", method="GET", level=LLAMA_STACK_API_V1)
|
|
async def version(self) -> VersionInfo:
|
|
"""Get the version of the service.
|
|
|
|
:returns: Version information containing the service version number.
|
|
"""
|
|
...
|