Elffuss BraidHub

kikocis/llama-stack public

566afbf5da2b · 1.1 KiBRawPermalink
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2# All rights reserved.
3#
4# This source code is licensed under the terms described in the LICENSE file in
5# the root directory of this source tree.
6
7from datetime import datetime
8from typing import Any, List, Optional, Protocol
9
10from llama_models.schema_utils import json_schema_type, webmethod
11from pydantic import BaseModel
12
13
14@json_schema_type
15class ControlPlaneValue(BaseModel):
16 key: str
17 value: Any
18 expiration: Optional[datetime] = None
19
20
21@json_schema_type
22class ControlPlane(Protocol):
23 @webmethod(route="/control_plane/set")
24 async def set(
25 self, key: str, value: Any, expiration: Optional[datetime] = None
26 ) -> None: ...
27
28 @webmethod(route="/control_plane/get", method="GET")
29 async def get(self, key: str) -> Optional[ControlPlaneValue]: ...
30
31 @webmethod(route="/control_plane/delete")
32 async def delete(self, key: str) -> None: ...
33
34 @webmethod(route="/control_plane/range", method="GET")
35 async def range(self, start_key: str, end_key: str) -> List[ControlPlaneValue]: ...