Elffuss BraidHub

kikocis/llama-stack public

main · 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 typing import List, Optional, Protocol
8
9from llama_models.llama3.api.datatypes import Model
10
11from llama_models.schema_utils import json_schema_type, webmethod
12from pydantic import BaseModel, Field
13
14from llama_stack.distribution.datatypes import GenericProviderConfig
15
16
17@json_schema_type
18class ModelServingSpec(BaseModel):
19 llama_model: Model = Field(
20 description="All metadatas associated with llama model (defined in llama_models.models.sku_list).",
21 )
22 provider_config: GenericProviderConfig = Field(
23 description="Provider config for the model, including provider_id, and corresponding config. ",
24 )
25
26
27class Models(Protocol):
28 @webmethod(route="/models/list", method="GET")
29 async def list_models(self) -> List[ModelServingSpec]: ...
30
31 @webmethod(route="/models/get", method="GET")
32 async def get_model(self, core_model_id: str) -> Optional[ModelServingSpec]: ...