Skip to content

Commit

Permalink
Fix reading of few-shot example file for LLM categoriser
Browse files Browse the repository at this point in the history
  • Loading branch information
stijn-uva committed Jan 8, 2025
1 parent 9465cc2 commit 14c9fae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions processors/machine_learning/annotate_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def validate_query(query, request, user):
if not labels or len([l for l in labels if l.strip()]) < 2:
raise QueryParametersException("At least two labels should be provided for text classification.")
else:
file = request.files["option-category_file"]
file = request.files["option-category-file"]
if not file:
raise QueryParametersException(
"No label file provided. A label file is required when using few-shot classification.")
Expand All @@ -296,7 +296,7 @@ def validate_query(query, request, user):
has_header = csv.Sniffer().has_header(sample)
dialect = csv.Sniffer().sniff(sample, delimiters=(",", ";", "\t"))

reader = csv.reader(wrapped_file) if not has_header else csv.DictReader(wrapped_file)
reader = csv.reader(wrapped_file, dialect=dialect) if not has_header else csv.DictReader(wrapped_file)
row = next(reader)
if len(list(row)) != 2:
raise QueryParametersException("The label file must have exactly two columns.")
Expand Down

0 comments on commit 14c9fae

Please sign in to comment.