mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-05 04:17:32 +00:00
skeleton models api
This commit is contained in:
parent
59af1c8fec
commit
68131afc86
9 changed files with 233 additions and 10 deletions
46
llama_stack/providers/impls/builtin/models/models.py
Normal file
46
llama_stack/providers/impls/builtin/models/models.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
# 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.
|
||||
import asyncio
|
||||
|
||||
from typing import AsyncIterator, Union
|
||||
|
||||
from llama_models.llama3.api.datatypes import StopReason
|
||||
from llama_models.sku_list import resolve_model
|
||||
|
||||
from llama_stack.apis.models import * # noqa: F403
|
||||
from llama_models.llama3.api.datatypes import * # noqa: F403
|
||||
from llama_models.datatypes import CoreModelId, Model
|
||||
from llama_models.sku_list import resolve_model
|
||||
|
||||
from .config import BuiltinImplConfig
|
||||
|
||||
DUMMY_MODELS_SPEC = ModelSpec(
|
||||
llama_model_metadata=resolve_model("Meta-Llama3.1-8B"),
|
||||
providers_spec={"inference": {"provider_type": "meta-reference"}},
|
||||
)
|
||||
|
||||
|
||||
class BuiltinModelsImpl(Models):
|
||||
def __init__(
|
||||
self,
|
||||
config: BuiltinImplConfig,
|
||||
) -> None:
|
||||
self.config = config
|
||||
self.models_list = [DUMMY_MODELS_SPEC]
|
||||
|
||||
async def initialize(self) -> None:
|
||||
pass
|
||||
|
||||
async def list_models(self) -> ModelsListResponse:
|
||||
return ModelsListResponse(models_list=self.models_list)
|
||||
|
||||
async def get_model(self, core_model_id: str) -> ModelsGetResponse:
|
||||
return ModelsGetResponse(core_model_spec=DUMMY_MODELS_SPEC)
|
||||
|
||||
async def register_model(
|
||||
self, model_id: str, api: str, provider_spec: Dict[str, str]
|
||||
) -> ModelsRegisterResponse:
|
||||
return ModelsRegisterResponse()
|
Loading…
Add table
Add a link
Reference in a new issue