def test_llmcompletion_calibration(self):
        """Check that LLMProvider feedback functions produce reasonable values."""

        provider_models = [
            (openai_provider.OpenAI(model_engine=model), model)
            for model in ["gpt-4o"]
        ]
        for provider, model in provider_models:
            provider_name = provider.__class__.__name__
            failed_tests = 0
            total_tests = 0
            failed_subtests = []
            with self.subTest(f"{provider_name}-{model}"):
                tests = get_llmprovider_tests(provider)
                for imp, args, expected in tests:
                    subtest_name = (
                        f"{provider_name}-{model}-{imp.__name__}-{args}"
                    )
                    if "with_cot_reasons" in imp.__name__:
                        actual = imp(**args)[
                            0
                        ]  # Extract the actual score from the tuple
                    else:
                        actual = imp(**args)
                    with self.subTest(subtest_name):
                        total_tests += 1
                        try:
                            self.assertAlmostEqual(actual, expected, delta=0.2)
                        except AssertionError:
                            failed_tests += 1
                            failed_subtests.append((
                                subtest_name,
                                actual,
                                expected,
                            ))

            if failed_tests > 0:
                failed_subtests_str = ", ".join([
                    f"{name} (actual: {act}, expected: {exp})"
                    for name, act, exp in failed_subtests
                ])
                self.fail(
                    f"{provider_name}-{model}: {failed_tests}/{total_tests} tests failed ({failed_subtests_str})"
                )
            else:
                print(
                    f"{provider_name}-{model}: {total_tests}/{total_tests} tests passed."
                )
Check that LLMProvider feedback functions produce reasonable values.
tests/e2e/test_providers.py