def _test_llm_provider_endpoint(self, provider, with_cost: bool = True):
        """Cost checks for endpoints whose providers implement LLMProvider."""

        _, cost_tally = core_endpoint.Endpoint.track_all_costs_tally(
            provider.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,
                0,
                "Expected zero classes for LLM-based endpoints.",
            )

        with self.subTest("n_stream_chunks"):
            self.assertEqual(
                cost.n_stream_chunks,
                0,
                "Expected zero chunks when not using streaming mode.",
            )

        with self.subTest("n_tokens"):
            self.assertGreater(cost.n_tokens, 0, "Expected non-zero tokens.")

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

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

        if with_cost:
            with self.subTest("cost"):
                self.assertGreater(cost.cost, 0.0, "Expected non-zero cost.")

        if (
            str(type(provider))
            == "<class 'trulens.providers.cortex.provider.Cortex'>"
        ):
            with self.subTest("cost_currency"):
                self.assertEqual(
                    cost.cost_currency,
                    "Snowflake credits",
                    "Expected cost currency to be Snowflake credits.",
                )
Cost checks for endpoints whose providers implement LLMProvider.
tests/e2e/test_endpoints.py