Skip to content

Commit

Permalink
fix: fix the errors happenning for pydantic v2
Browse files Browse the repository at this point in the history
Signed-off-by: TomeHirata <tomu.hirata@gmail.com>
  • Loading branch information
TomeHirata committed Jan 18, 2024
1 parent 7736327 commit bd3e0ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mlflow/deployments/server/app.py
Expand Up @@ -83,7 +83,7 @@ async def parse_request_schema(request: Request, cls: Type[BaseModel]) -> BaseMo
try:
return cls(**payload)
except ValidationError as e:
raise RequestValidationError(e.raw_errors)
raise RequestValidationError(e.errors())


def _create_chat_endpoint(config: RouteConfig):
Expand Down
5 changes: 3 additions & 2 deletions mlflow/gateway/config.py
Expand Up @@ -400,10 +400,11 @@ def validate_route_type(cls, value):
raise MlflowException.invalid_parameter_value(f"The route_type '{value}' is not supported.")

@validator("limit", pre=True)
def validate_limit(cls, value: Optional[Limit]):
def validate_limit(cls, value):
if value:
limit = Limit(**value)
try:
parse(f"{value.calls}/{value.renewal_period}")
parse(f"{limit.calls}/{limit.renewal_period}")
except ValueError:
raise MlflowException.invalid_parameter_value(
"Failed to parse the rate limit configuration."
Expand Down

0 comments on commit bd3e0ae

Please sign in to comment.