mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
No more model_id warnings
This commit is contained in:
parent
e8112b31ab
commit
20bf2f50c2
2 changed files with 12 additions and 6 deletions
|
@ -7,7 +7,7 @@
|
||||||
from typing import Any, Dict, List, Literal, Optional, Protocol, runtime_checkable
|
from typing import Any, Dict, List, Literal, Optional, Protocol, runtime_checkable
|
||||||
|
|
||||||
from llama_models.schema_utils import json_schema_type, webmethod
|
from llama_models.schema_utils import json_schema_type, webmethod
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
|
||||||
from llama_stack.apis.resource import Resource, ResourceType
|
from llama_stack.apis.resource import Resource, ResourceType
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ class ModelInput(CommonModelFields):
|
||||||
provider_id: Optional[str] = None
|
provider_id: Optional[str] = None
|
||||||
provider_model_id: Optional[str] = None
|
provider_model_id: Optional[str] = None
|
||||||
|
|
||||||
|
model_config = ConfigDict(protected_namespaces=())
|
||||||
|
|
||||||
|
|
||||||
@runtime_checkable
|
@runtime_checkable
|
||||||
class Models(Protocol):
|
class Models(Protocol):
|
||||||
|
|
|
@ -369,12 +369,16 @@ def main(
|
||||||
|
|
||||||
impl_method = getattr(impl, endpoint.name)
|
impl_method = getattr(impl, endpoint.name)
|
||||||
|
|
||||||
getattr(app, endpoint.method)(endpoint.route, response_model=None)(
|
with warnings.catch_warnings():
|
||||||
create_dynamic_typed_route(
|
warnings.filterwarnings(
|
||||||
impl_method,
|
"ignore", category=UserWarning, module="pydantic._internal._fields"
|
||||||
endpoint.method,
|
)
|
||||||
|
getattr(app, endpoint.method)(endpoint.route, response_model=None)(
|
||||||
|
create_dynamic_typed_route(
|
||||||
|
impl_method,
|
||||||
|
endpoint.method,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
cprint(f"Serving API {api_str}", "white", attrs=["bold"])
|
cprint(f"Serving API {api_str}", "white", attrs=["bold"])
|
||||||
for endpoint in endpoints:
|
for endpoint in endpoints:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue