Elffuss BraidHub

kikocis/llama-stack public

main · 919 BRawPermalink
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 typing import List, Optional, Protocol
8
9from llama_models.schema_utils import json_schema_type, webmethod
10from pydantic import BaseModel, Field
11
12from llama_stack.distribution.datatypes import GenericProviderConfig
13
14
15@json_schema_type
16class ShieldSpec(BaseModel):
17 shield_type: str
18 provider_config: GenericProviderConfig = Field(
19 description="Provider config for the model, including provider_id, and corresponding config. ",
20 )
21
22
23class Shields(Protocol):
24 @webmethod(route="/shields/list", method="GET")
25 async def list_shields(self) -> List[ShieldSpec]: ...
26
27 @webmethod(route="/shields/get", method="GET")
28 async def get_shield(self, shield_type: str) -> Optional[ShieldSpec]: ...