From 89a0528295c3d63a8b39751e72d9c444b779e1c9 Mon Sep 17 00:00:00 2001 From: Utkarsh_Pandya <35842105+utkarshpandya99@users.noreply.github.com> Date: Sun, 21 Apr 2024 09:30:55 +0000 Subject: [PATCH] Added prompt trial --- session_2/challenge/scripts/evaluate_lib.py | 2 +- .../challenge/submissions/baseline_copy.py | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 session_2/challenge/submissions/baseline_copy.py diff --git a/session_2/challenge/scripts/evaluate_lib.py b/session_2/challenge/scripts/evaluate_lib.py index 355979e..65cf395 100644 --- a/session_2/challenge/scripts/evaluate_lib.py +++ b/session_2/challenge/scripts/evaluate_lib.py @@ -5,7 +5,7 @@ import tqdm from scripts import model, registry from submissions import * # noqa: F401, F403 -from submissions import baseline # noqa: F401 +from submissions import baseline, baseline_copy # noqa: F401 def evaluate(dataset: list[tuple[str, bool]], prompt_name: str): diff --git a/session_2/challenge/submissions/baseline_copy.py b/session_2/challenge/submissions/baseline_copy.py new file mode 100644 index 0000000..c8f6b3e --- /dev/null +++ b/session_2/challenge/submissions/baseline_copy.py @@ -0,0 +1,34 @@ +"""Baseline submission for the job description classification challenge.""" + +from scripts import base, registry + + +@registry.register() +class Baseline(base.PromptSubmission): + """Baseline submission.""" + + def build_prompt(self, job_description: str) -> str: + """Builds a prompt for classification of job description.""" + prompt = f""" + + Say "YES" if the given job description is suitable for + a freshers other wise say "NO". + + {job_description}. + + """ + return prompt.strip() + + def parse_response(self, model_response: str) -> bool: + """Parses a response from the LLM to decide the final answer. + + Args: + model_response: Output of the llm for the given prompt. + + Returns: + True is the job_description is for a fresher otherwise False. + """ + model_response = model_response.lower() + if "yes" in model_response: + return True + return False