Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add baseline_copy_copy #30

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion session_2/challenge/scripts/evaluate_lib.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""Library function for evaluating a prompt on a particular dataset."""

import logging

import tqdm
from scripts import model, registry
from submissions import * # noqa: F401, F403
from submissions import baseline, baseline_copy # noqa: F401
from submissions import baseline, baseline_copy, baseline_copy_copy # noqa: F401


def evaluate(dataset: list[tuple[str, bool]], prompt_name: str):

Check failure on line 11 in session_2/challenge/scripts/evaluate_lib.py

View workflow job for this annotation

GitHub Actions / build

Ruff (I001)

session_2/challenge/scripts/evaluate_lib.py:3:1: I001 Import block is un-sorted or un-formatted
"""Evaluates the prompt submission."""
# Loads a free gpt4 model.
llm = model.G4fModel()
Expand Down
34 changes: 34 additions & 0 deletions session_2/challenge/submissions/baseline_copy_copy.py
Original file line number Diff line number Diff line change
@@ -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
Loading