diff --git a/metarank/client.py b/metarank/client.py index ddb43a6..f81e4db 100644 --- a/metarank/client.py +++ b/metarank/client.py @@ -17,7 +17,7 @@ def feedback(self, feedback_data: FeedbackSchema) -> FeedbackResponse: :param feedback_data: :return: """ - response = self.request("POST", "feedback", feedback_data.dict(exclude_none=True)) + response = self.request("POST", "feedback", feedback_data.model_dump(exclude_none=True, exclude_unset=True)) return FeedbackResponse(**response) def health_check(self) -> bool: @@ -37,7 +37,7 @@ def inference_encoder(self, name: str, inference_encoder_data: InferenceEncoderS :return: """ - response = self.request("POST", f"inference/encoder/{name}", inference_encoder_data.dict(exclude_none=True)) + response = self.request("POST", f"inference/encoder/{name}", inference_encoder_data.model_dump(exclude_none=True, exclude_unset=True)) return InferenceEncoderResponse(**response) def inference_cross(self, name: str, inference_cross_data: InferenceCrossSchema) -> InferenceCrossResponse: @@ -49,7 +49,7 @@ def inference_cross(self, name: str, inference_cross_data: InferenceCrossSchema) :return: """ - response = self.request("POST", f"inference/cross/{name}", inference_cross_data.dict(exclude_none=True)) + response = self.request("POST", f"inference/cross/{name}", inference_cross_data.model_dump(exclude_none=True, exclude_unset=True)) return InferenceCrossResponse(**response) def metrics(self) -> str: @@ -75,7 +75,7 @@ def rank(self, model_name: str, rank_data: RankSchema, explain: bool = False) -> if explain: endpoint = f"{endpoint}?explain=true" - response = self.request("POST", endpoint, data=rank_data.dict(exclude_none=True)) + response = self.request("POST", endpoint, data=rank_data.model_dump(exclude_none=True, exclude_unset=True)) return RankResponse(**response) def recommend(self, model_name: str, data: RecommendSchema) -> RecommendResponse: