Skip to content
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
215 changes: 166 additions & 49 deletions docs/Gemfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions langtest/langtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ def __single_dataset_generate(self, dataset: list):
setattr(sample, "expected_results", v(sample.original))
for sample in m_data
]
(testcases[k]) = TestFactory.transform(
testcases[k] = TestFactory.transform(
self.task, dataset, tests, m_data=m_data
)

Expand All @@ -1556,7 +1556,7 @@ def __single_dataset_generate(self, dataset: list):
testcases = DataFactory.filter_curated_bias(tests_to_filter, dataset)
if len(tests.keys()) > 2:
tests = {k: v for k, v in tests.items() if k != "bias"}
(other_testcases) = TestFactory.transform(
other_testcases = TestFactory.transform(
self.task, dataset, tests, m_data=m_data
)
testcases.extend(other_testcases)
Expand Down
12 changes: 4 additions & 8 deletions langtest/metrics/prometheus_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ def get_prompt(self) -> str:
The prompt for the model.
"""
s, f = self.get_score_rubric()
prompt = dedent(
"""
prompt = dedent("""
###Task Description:
An instruction (might include an Input inside it), a response to evaluate, a reference answer that gets from {formatted_criteria_keys}, and a score rubric representing a evaluation criteria are given.
1. Write a detailed feedback that assess the quality of the response strictly based on the given score rubric, not evaluating in general.
Expand All @@ -244,8 +243,7 @@ def get_prompt(self) -> str:
{score_rubric}

###Feedback:
"""
)
""")
return prompt.format(
instruction=self.instruction,
response=self.response,
Expand Down Expand Up @@ -302,8 +300,7 @@ def get_prompt(self) -> str:
The prompt for the model.
"""
s, f = self.get_score_rubric()
prompt = dedent(
"""
prompt = dedent("""
###Task Description:
An instruction (might include an Input inside it), a response to evaluate, and a score rubric representing a evaluation criteria are given.
1. Write a detailed feedback that assess the quality of two responses strictly based on the given score rubric, not evaluating in general.
Expand All @@ -327,8 +324,7 @@ def get_prompt(self) -> str:
{score_rubric}

###Feedback:
"""
)
""")
return prompt.format(
instruction=self.instruction,
response_a=self.response_a,
Expand Down
6 changes: 2 additions & 4 deletions langtest/transform/clinical.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,7 @@ def transform(sample_list: List[Sample], *args, **kwargs):
else:
from textwrap import dedent

error_message = dedent(
"""
error_message = dedent("""
Attack model information is not provided in Configuration. Please provide the attack model information.
{
"medfuzz": {
Expand All @@ -970,8 +969,7 @@ def transform(sample_list: List[Sample], *args, **kwargs):
}
}
}
"""
).strip()
""").strip()

raise ValueError(error_message)

Expand Down
1 change: 0 additions & 1 deletion langtest/transform/robustness.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from ..utils.number_to_word import ConvertNumberToWord
from collections import defaultdict


inverted_ocr_typo_dict = defaultdict(list)
for k, v in ocr_typo_dict.items():
inverted_ocr_typo_dict[v].append(k)
Expand Down
2 changes: 1 addition & 1 deletion langtest/transform/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def get_ethnicity_representation_dict(data: List[Sample]) -> Dict[str, int]:

@staticmethod
def get_entity_representation_proportions(
entity_representation: Dict[str, int]
entity_representation: Dict[str, int],
) -> Dict[str, float]:
"""Calculates the proportions of each entity in the representation.

Expand Down
1 change: 0 additions & 1 deletion langtest/utils/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# from pkg_resources import resource_filename
from importlib import resources


LLM_DEFAULTS_CONFIG = {
"azure-openai": str(
resources.files("langtest").joinpath(
Expand Down
146 changes: 103 additions & 43 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ipdb = "^0.13.13"
pytest = "^7.4.0"
taskipy = "^1.11.0"
en-core-web-sm = { url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0.tar.gz" }
black = "^24.10.0"
black = ">=26.3.1"
pyproject-flake8 = "^7.0.0"
pre-commit = "^3.3.3"
pydocstyle = "^6.3.0"
Expand Down
1 change: 0 additions & 1 deletion tests/test_nlp_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from langtest import Harness
from langtest.utils.custom_types import Sample


task_configurations = [
{
"task": "ner",
Expand Down
Loading