Skip to content

Commit

Permalink
No more model_id warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinb committed Nov 15, 2024
1 parent e8112b3 commit 20bf2f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion llama_stack/apis/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Any, Dict, List, Literal, Optional, Protocol, runtime_checkable

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

Expand Down Expand Up @@ -37,6 +37,8 @@ class ModelInput(CommonModelFields):
provider_id: Optional[str] = None
provider_model_id: Optional[str] = None

model_config = ConfigDict(protected_namespaces=())


@runtime_checkable
class Models(Protocol):
Expand Down
14 changes: 9 additions & 5 deletions llama_stack/distribution/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,16 @@ def main(

impl_method = getattr(impl, endpoint.name)

getattr(app, endpoint.method)(endpoint.route, response_model=None)(
create_dynamic_typed_route(
impl_method,
endpoint.method,
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore", category=UserWarning, module="pydantic._internal._fields"
)
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"])
for endpoint in endpoints:
Expand Down

0 comments on commit 20bf2f5

Please sign in to comment.