Skip to content

Commit

Permalink
Expand param types to inc None and register dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-shunned committed Sep 18, 2024
1 parent dc6558f commit db17304
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aiod_registry/schema.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import builtins
from pathlib import Path
from typing import Optional, Union
from urllib.parse import urlparse
Expand Down Expand Up @@ -29,7 +30,7 @@
),
]
ParamValue = Annotated[
Union[str, int, float, bool, list[Union[str, int, float, bool]]],
Union[str, int, float, bool, None, list[Union[str, int, float, bool]]],
Field(
...,
description="Default parameter value. If a list, the parameters will be treated as dropdown choices, where the first is the default. The type of the first element will be used to determine the type of the parameter.",
Expand Down Expand Up @@ -68,7 +69,8 @@ class ModelParam(StrictModel):
arg_name: Optional[str] = None
value: ParamValue
tooltip: Optional[str] = None
_dtype = None
dtype: Optional[str] = None # Used of default value is None
_dtype = None # Determined from value if given

@model_validator(mode="after")
def create_arg_name(self):
Expand Down

0 comments on commit db17304

Please sign in to comment.