mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-05 18:22:41 +00:00
add version endpoint
This commit is contained in:
parent
11332c39b1
commit
b28e4002c9
2 changed files with 19 additions and 1 deletions
|
@ -29,6 +29,11 @@ class HealthInfo(BaseModel):
|
||||||
# TODO: add a provider level status
|
# TODO: add a provider level status
|
||||||
|
|
||||||
|
|
||||||
|
@json_schema_type
|
||||||
|
class VersionInfo(BaseModel):
|
||||||
|
version: str
|
||||||
|
|
||||||
|
|
||||||
@runtime_checkable
|
@runtime_checkable
|
||||||
class Inspect(Protocol):
|
class Inspect(Protocol):
|
||||||
@webmethod(route="/providers/list", method="GET")
|
@webmethod(route="/providers/list", method="GET")
|
||||||
|
@ -39,3 +44,6 @@ class Inspect(Protocol):
|
||||||
|
|
||||||
@webmethod(route="/health", method="GET")
|
@webmethod(route="/health", method="GET")
|
||||||
async def health(self) -> HealthInfo: ...
|
async def health(self) -> HealthInfo: ...
|
||||||
|
|
||||||
|
@webmethod(route="/version", method="GET")
|
||||||
|
async def version(self) -> VersionInfo: ...
|
||||||
|
|
|
@ -4,11 +4,18 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from importlib.metadata import version
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.apis.inspect import HealthInfo, Inspect, ProviderInfo, RouteInfo
|
from llama_stack.apis.inspect import (
|
||||||
|
HealthInfo,
|
||||||
|
Inspect,
|
||||||
|
ProviderInfo,
|
||||||
|
RouteInfo,
|
||||||
|
VersionInfo,
|
||||||
|
)
|
||||||
from llama_stack.distribution.datatypes import StackRunConfig
|
from llama_stack.distribution.datatypes import StackRunConfig
|
||||||
from llama_stack.distribution.server.endpoints import get_all_api_endpoints
|
from llama_stack.distribution.server.endpoints import get_all_api_endpoints
|
||||||
|
|
||||||
|
@ -65,3 +72,6 @@ class DistributionInspectImpl(Inspect):
|
||||||
|
|
||||||
async def health(self) -> HealthInfo:
|
async def health(self) -> HealthInfo:
|
||||||
return HealthInfo(status="OK")
|
return HealthInfo(status="OK")
|
||||||
|
|
||||||
|
async def version(self) -> VersionInfo:
|
||||||
|
return VersionInfo(version=version("llama-stack"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue