mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 15:23:51 +00:00
add control plane API
This commit is contained in:
parent
d1959e6889
commit
b31f0f6e4e
3 changed files with 44 additions and 0 deletions
7
llama_stack/apis/control_plane/__init__.py
Normal file
7
llama_stack/apis/control_plane/__init__.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
# 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 .control_plane import * # noqa: F401 F403
|
35
llama_stack/apis/control_plane/control_plane.py
Normal file
35
llama_stack/apis/control_plane/control_plane.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# 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 datetime import datetime
|
||||
from typing import Any, List, Optional, Protocol
|
||||
|
||||
from llama_models.schema_utils import json_schema_type, webmethod
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class ControlPlaneValue(BaseModel):
|
||||
key: str
|
||||
value: Any
|
||||
expiration: Optional[datetime] = None
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class ControlPlane(Protocol):
|
||||
@webmethod(route="/control_plane/set")
|
||||
async def set(
|
||||
self, key: str, value: Any, expiration: Optional[datetime] = None
|
||||
) -> None: ...
|
||||
|
||||
@webmethod(route="/control_plane/get", method="GET")
|
||||
async def get(self, key: str) -> Optional[ControlPlaneValue]: ...
|
||||
|
||||
@webmethod(route="/control_plane/delete")
|
||||
async def delete(self, key: str) -> None: ...
|
||||
|
||||
@webmethod(route="/control_plane/range", method="GET")
|
||||
async def range(self, start_key: str, end_key: str) -> List[ControlPlaneValue]: ...
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
from llama_models.llama3.api.datatypes import * # noqa: F403
|
||||
from llama_stack.apis.agents import * # noqa: F403
|
||||
from llama_stack.apis.control_plane import * # noqa: F403
|
||||
from llama_stack.apis.dataset import * # noqa: F403
|
||||
from llama_stack.apis.evals import * # noqa: F403
|
||||
from llama_stack.apis.inference import * # noqa: F403
|
||||
|
@ -21,6 +22,7 @@ from llama_stack.apis.safety import * # noqa: F403
|
|||
class LlamaStack(
|
||||
Inference,
|
||||
BatchInference,
|
||||
ControlPlane,
|
||||
Agents,
|
||||
RewardScoring,
|
||||
Safety,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue