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

(engsys) ci,fix: Fix Run Black falsely reporting success #38095

Merged
merged 2 commits into from
Oct 25, 2024

style: Run black

0685600
Select commit
Loading
Failed to load commit list.
Merged

(engsys) ci,fix: Fix Run Black falsely reporting success #38095

style: Run black
0685600
Select commit
Loading
Failed to load commit list.
Azure Pipelines / python - pullrequest succeeded Oct 25, 2024 in 23m 52s

Build #20241025.6 had test failures

Details

Tests

  • Failed: 2 (0.03%)
  • Passed: 6,208 (87.81%)
  • Other: 860 (12.16%)
  • Total: 7,070
Code coverage

  • 939 of 3760 lines covered (24.97%)

Annotations

Check failure on line 1 in test_optional_inputs_with_data[True]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_optional_inputs_with_data[True]

azure.ai.evaluation._exceptions.EvaluationException: (InternalError) [('/tmp/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v/process_log/process_stderr_0.log', '/mnt/vss/_work/1/s/sdk/evaluation/azure-ai-evaluation/.tox/mindependency/.promptflow/.runs/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v_20241025_165815_387458/snapshot/process_log/process_stderr_0.log', "[Errno 2] No such file or directory: '/tmp/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v/process_log/process_stderr_0.log'"), ('/tmp/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v/process_log/process_stderr_1.log', '/mnt/vss/_work/1/s/sdk/evaluation/azure-ai-evaluation/.tox/mindependency/.promptflow/.runs/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v_20241025_165815_387458/snapshot/process_log/process_stderr_1.log', "[Errno 2] No such file or directory: '/tmp/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v/process_log/process_stderr_1.log'"), ('/tmp/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v/process_log/process_stderr_2.log', '/mnt/vss/_work/1/s/sdk/evaluation/azure-ai-evaluation/.tox/mindependency/.promptflow/.runs/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v_20241025_165815_387458/snapshot/process_log/process_stderr_2.log', "[Errno 2] No such file or directory: '/tmp/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v/process_log/process_stderr_2.log'"), (<DirEntry 'process_log'>, '/mnt/vss/_work/1/s/sdk/evaluation/azure-ai-evaluation/.tox/mindependency/.promptflow/.runs/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v_20241025_165815_387458/snapshot/process_log', "[Errno 2] No such file or directory: '/tmp/test_evaluators_test_inputs_evaluators_noinputeval_mgk5g71v/process_log'")]
Raw output
data = '/mnt/vss/_work/1/s/sdk/evaluation/azure-ai-evaluation/tests/unittests/data/questions.jsonl'
evaluators = {'half': <test_evaluators.test_inputs_evaluators.HalfOptionalEval object at 0x7f5a2781fd50>, 'no': <test_evaluators.te...tEval object at 0x7f5a278313d0>, 'opt': <test_evaluators.test_inputs_evaluators.OptionalEval object at 0x7f5a278303d0>}
evaluation_name = None, target = None, evaluator_config = None
azure_ai_project = None, output_path = None, kwargs = {'_use_pf_client': True}

    def evaluate(
        *,
        data: Union[str, os.PathLike],
        evaluators: Dict[str, Callable],
        evaluation_name: Optional[str] = None,
        target: Optional[Callable] = None,
        evaluator_config: Optional[Dict[str, EvaluatorConfig]] = None,
        azure_ai_project: Optional[AzureAIProject] = None,
        output_path: Optional[Union[str, os.PathLike]] = None,
        **kwargs,
    ) -> EvaluationResult:
        """Evaluates target or data with built-in or custom evaluators. If both target and data are provided,
            data will be run through target function and then results will be evaluated.
    
        :keyword data: Path to the data to be evaluated or passed to target if target is set.
            Only .jsonl format files are supported.  `target` and `data` both cannot be None. Required.
        :paramtype data: str
        :keyword evaluators: Evaluators to be used for evaluation. It should be a dictionary with key as alias for evaluator
            and value as the evaluator function. Required.
        :paramtype evaluators: Dict[str, Callable]
        :keyword evaluation_name: Display name of the evaluation.
        :paramtype evaluation_name: Optional[str]
        :keyword target: Target to be evaluated. `target` and `data` both cannot be None
        :paramtype target: Optional[Callable]
        :keyword evaluator_config: Configuration for evaluators. The configuration should be a dictionary with evaluator
            names as keys and a values that are dictionaries containing the column mappings. The column mappings should
            be a dictionary with keys as the column names in the evaluator input and values as the column names in the
            input data or data generated by target.
        :paramtype evaluator_config: Optional[Dict[str, ~azure.ai.evaluation.EvaluatorConfig]]
        :keyword output_path: The local folder or file path to save evaluation results to if set. If folder path is provided
              the results will be saved to a file named `evaluation_results.json` in the folder.
        :paramtype output_path: Optional[str]
        :keyword azure_ai_project: Logs evaluation results to AI Studio if set.
        :paramtype azure_ai_project: Optional[~azure.ai.evaluation.AzureAIProject]
        :return: Evaluation results.
        :rtype: ~azure.ai.evaluation.EvaluationResult
    
        :Example:
    
        Evaluate API can be used as follows:
    
        .. code-block:: python
    
                from azure.ai.evaluation import evaluate, RelevanceEvaluator, CoherenceEvaluator
    
    
                model_config = {
                    "azure_endpoint": os.environ.get("AZURE_OPENAI_ENDPOINT"),
                    "api_key": os.environ.get("AZURE_OPENAI_KEY"),
                    "azure_deployment": os.environ.get("AZURE_OPENAI_DEPLOYMENT"),
                }
    
                coherence_eval = CoherenceEvaluator(model_config=model_config)
                relevance_eval = RelevanceEvaluator(model_config=model_config)
    
                path = "evaluate_test_data.jsonl"
                result = evaluate(
                    data=path,
                    evaluators={
                        "coherence": coherence_eval,
                        "relevance": relevance_eval,
                    },
                    evaluator_config={
                        "coherence": {
                            "column_mapping": {
                                "response": "${

Check failure on line 1 in test_optional_inputs_with_target[False]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_optional_inputs_with_target[False]

AssertionError: assert '(Failed)' == 'new response'
  - new response
  + (Failed)
Raw output
self = <test_evaluate.TestEvaluate object at 0x00000159E54B28D0>
questions_file = 'D:\\a\\_work\\1\\s\\sdk\\evaluation\\azure-ai-evaluation\\tests\\unittests\\data\\questions.jsonl'
questions_answers_basic_file = 'D:\\a\\_work\\1\\s\\sdk\\evaluation\\azure-ai-evaluation\\tests\\unittests\\data\\questions_answers_basic.jsonl'
use_pf_client = False

    @pytest.mark.parametrize("use_pf_client", [True, False])
    def test_optional_inputs_with_target(self, questions_file, questions_answers_basic_file, use_pf_client):
        from test_evaluators.test_inputs_evaluators import EchoEval
    
        # Check that target overrides default inputs
        target_answer_results = evaluate(
            data=questions_file,
            target=_new_answer_target,
            evaluators={"echo": EchoEval()},
            _use_pf_client=use_pf_client,
        )  # type: ignore
    
        assert target_answer_results["rows"][0]["outputs.echo.echo_query"] == "How long is flight from Earth to LV-426?"
>       assert target_answer_results["rows"][0]["outputs.echo.echo_response"] == "new response"
E       AssertionError: assert '(Failed)' == 'new response'
E         - new response
E         + (Failed)

D:\a\_work\1\s\sdk\evaluation\azure-ai-evaluation\tests\unittests\test_evaluate.py:621: AssertionError