model_dump(exclude_unset=True) extra_data = {} if "password" in hero_data: password = hero_data["password"] hashed_password = hash_password(password) extra_data["hashed_password"] = hashed_password db_hero.sqlmodel_update(hero_data, update=extra_data) ...
model_dump(exclude_unset=True)) if "key" in props: props["key"] = AssetKey.from_user_string(props["key"]) return props class AssetSpecModel(_ResolvableAssetAttributesMixin, ResolvableModel[AssetSpec]): key: Annotated[Optional[str], ResolvableFieldInfo(output_type=AssetKey)] def resolve(self...
model_dump( mode='json', exclude_none=True, exclude_unset=True, exclude_defaults=True ) DictToModelValidator = convert_dict_to_model_validator_factory ModelToDictValidator = AfterValidator(convert_model_to_dict) class Child(SQLModel): one: int two: float class Custom(SQLModel): boolean: ...
model_dump(exclude_unset=True) db_hero.sqlmodel_update(hero_data) session.add(db_hero) session.commit() session.refresh(db_hero) return db_hero 👀 Full file preview Python 3.10+ from fastapi import FastAPI, HTTPException, Query from sqlmodel import Field, Session, SQLModel, create_engine...
yield"{}".format(chunk.model_dump_json(exclude_unset=True)) Expand All@@ -327,7 +333,7 @@ async def predict(model_id: str, params: dict): delta=DeltaMessage(), finish_reason="stop" ) chunk=ChatCompletionResponse(model=model_id,choices=[ ...
exclude: Union[IncEx, None] = None, context: Union[Dict[str, Any], None] = None, by_alias: bool = False, exclude_unset: bool = False, @@ -908,8 +913,8 @@ def model_dump( def dict( self, *, include: IncEx = None, exclude: IncEx = None, include: Union[IncEx, None] ...