From 31df7384003f3fa46b5a840812c51d0f4bfee9ce Mon Sep 17 00:00:00 2001 From: nextedoff Date: Mon, 2 Sep 2024 14:48:22 +0000 Subject: [PATCH] fix: mypy fix Signed-off-by: nextedoff --- app/backend/app.py | 2 +- app/backend/evaluation/config.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/backend/app.py b/app/backend/app.py index 86d35195bd..66dfe6d4a9 100644 --- a/app/backend/app.py +++ b/app/backend/app.py @@ -374,7 +374,7 @@ async def evaluate(auth_claims: dict[str, Any]): input_data_file = request_files.get("input_data") num_questions_str = request_form.get("num_questions", "") - num_questions = 0 if num_questions_str == "" else int(num_questions_str) + num_questions = None if num_questions_str == "" else int(num_questions_str) config = json.loads(request_form.get("config", "{}")) if input_data_file is not None: diff --git a/app/backend/evaluation/config.py b/app/backend/evaluation/config.py index d150ebfbb6..0c68a53b68 100644 --- a/app/backend/evaluation/config.py +++ b/app/backend/evaluation/config.py @@ -1,6 +1,7 @@ import json from dataclasses import dataclass from pathlib import Path +from typing import Optional from pyrit.prompt_target import PromptChatTarget @@ -29,7 +30,7 @@ class RedTeamingConfig: max_turns: int = 3 -def get_evaluation_config(enabled: bool, num_questions: int, target_url: str) -> EvaluationConfig: +def get_evaluation_config(enabled: bool, num_questions: Optional[int], target_url: str) -> EvaluationConfig: """Get the evaluation configuration.""" return EvaluationConfig(enabled=enabled, num_questions=num_questions, target_url=target_url)