Skip to content

Commit

Permalink
fix: allowed to add one positives or one negatives or both
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyjacquelin committed Dec 13, 2024
1 parent c7c71e9 commit 3a95688
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/app/schemas/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ def validate_model(self):
if self.is_good is None:
raise ValueError("For 'chat' feedback, 'is_good' is required.")
elif self.type == FeedbackType.evaluations:
if not self.positives or not self.negatives or self.note is None:
raise ValueError("For 'evaluations' feedback, 'positives', 'negatives', and 'note' are required.")
if self.note is None:
raise ValueError("For 'evaluations' feedback, 'note' is required.")
# At least one feedback list should be provided
if not self.positives and not self.negatives:
raise ValueError("For 'evaluations' feedback, at least 'positives' or 'negatives' is required.")
else:
raise ValueError("Feedback type must be either 'chat' or 'evaluations'.")

Expand Down

0 comments on commit 3a95688

Please sign in to comment.