Skip to content

Commit

Permalink
fix: dot not send empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
eliias committed Aug 21, 2024
1 parent c639996 commit a7b6dd4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions metarank/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit a7b6dd4

Please sign in to comment.