Skip to content

Commit 7a60144

Browse files
committed
adherence
1 parent 70851aa commit 7a60144

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

tools/azure-sdk-tools/linting_tools/lint_test_bench/pylint_test_bench.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from azure.identity import get_bearer_token_provider
99
from pathlib import Path
1010
from datetime import datetime
11-
from azure.ai.evaluation import GroundednessEvaluator
11+
from azure.ai.evaluation import GroundednessEvaluator, TaskAdherenceEvaluator
1212
from pylint.lint import Run
1313

1414
token_provider = get_bearer_token_provider(
@@ -229,9 +229,12 @@ def evaluate_fixes(file_path, original_content, fixed_content):
229229

230230
# Use the evaluate function with the JSONL file
231231
eval = GroundednessEvaluator(model_config=model_config)
232+
adehere = TaskAdherenceEvaluator(model_config=model_config, threshold=3)
233+
232234

233235
evaluation_result = eval(context=FILE_PROMPT + f"Fix pylint issues in this code:\n\n{original_content}", response=fixed_content)
234-
EVAL_RESULTS[pylint_name] = evaluation_result
236+
adherence_result = adehere(query=FILE_PROMPT + f"Fix pylint issues in this code:\n\n{original_content}", response=fixed_content)
237+
EVAL_RESULTS[pylint_name] = evaluation_result , adherence_result
235238

236239
# Example usage
237240
if __name__ == "__main__":
@@ -278,8 +281,9 @@ def evaluate_fixes(file_path, original_content, fixed_content):
278281
if key in EVAL_RESULTS:
279282
f.write(f"Evaluation Results for {key}:")
280283
f.write("\n")
281-
f.write(f"Groundedness Score: {EVAL_RESULTS[key]}")
284+
f.write(f"Evaluation Score: {EVAL_RESULTS[key][0]}")
282285
f.write("\n")
286+
f.write(f"Evaluation Score: {EVAL_RESULTS[key][1]}")
283287
f.write("\n")
284288
f.write("-----"*80)
285289
f.write("\n")

tools/azure-sdk-tools/linting_tools/lint_test_bench/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ azure-identity
22
openai
33
pylint==3.2.7
44
azure-core
5-
../../azure-sdk-tools/tools/pylint-extensions/azure-pylint-guidelines-checker/ -e .
5+
../../../../../azure-sdk-tools/tools/pylint-extensions/azure-pylint-guidelines-checker/ -e .

0 commit comments

Comments
 (0)