def _test_hugs_provider_endpoint(self, provider, with_cost: bool = True):
        """Check that cost tracking works for the huggingface endpoints."""

        _, cost_tally = core_endpoint.Endpoint.track_all_costs_tally(
            provider.positive_sentiment, text="This rocks!"
        )
        cost = cost_tally()

        with self.subTest("n_requests"):
            self.assertEqual(
                cost.n_requests, 1, "Expected exactly one request."
            )

        with self.subTest("n_successful_requests"):
            self.assertEqual(
                cost.n_successful_requests,
                1,
                "Expected exactly one successful request.",
            )

        with self.subTest("n_classes"):
            self.assertEqual(
                cost.n_classes,
                3,
                "Expected exactly three classes for sentiment classification.",
            )

        with self.subTest("n_stream_chunks"):
            self.assertEqual(
                cost.n_stream_chunks,
                0,
                "Expected zero chunks for classification endpoints.",
            )

        with self.subTest("n_tokens"):
            self.assertEqual(cost.n_tokens, 0, "Expected zero tokens.")

        with self.subTest("n_prompt_tokens"):
            self.assertEqual(
                cost.n_prompt_tokens, 0, "Expected zero prompt tokens."
            )

        with self.subTest("n_completion_tokens"):
            self.assertEqual(
                cost.n_completion_tokens,
                0.0,
                "Expected zero completion tokens.",
            )

        if with_cost:
            with self.subTest("cost"):
                self.assertEqual(
                    cost.cost,
                    0.0,
                    "Expected zero cost for huggingface endpoint.",
                )
Check that cost tracking works for the huggingface endpoints.
tests/e2e/test_endpoints.py