{"id":24736,"library":"trulens-core","title":"TruLens","description":"TruLens is a library for systematically tracking and evaluating LLM-based applications. It provides instrumentation, feedback functions, and a dashboard for monitoring and improving LLM app performance. Current version: 2.8.0, with monthly releases.","status":"active","version":"2.8.0","language":"python","source_language":"en","source_url":"https://github.com/truera/trulens","tags":["llm","evaluation","observability","feedback","tracing"],"install":[{"cmd":"pip install trulens-core","lang":"bash","label":"Install TruLens core"}],"dependencies":[],"imports":[],"quickstart":{"code":"from trulens.core import TruSession\nfrom trulens.feedback import Feedback\nfrom trulens.providers.openai import OpenAI\n\nsession = TruSession()\nsession.reset_database()\n\nprovider = OpenAI(model_engine=\"gpt-4o-mini\", api_key=os.environ.get('OPENAI_API_KEY', ''))\nf_groundedness = Feedback(provider.groundedness_measure_with_cot_reasons, name=\"Groundedness\")\nprint(\"Feedback defined.\")\n# See docs for full quickstart: https://www.trulens.org/","lang":"python","description":"Initialize TruLens session and define a feedback function."},"warnings":[{"fix":"Migrate to `Metric` class with explicit selectors dictionary. See migration guide: https://www.trulens.org/trulens/api/metrics/","message":"In version 2.7.0, the `Feedback` class and `MetricConfig` were replaced by the unified `Metric` class. Old code using `Feedback(...).on_output().on_input()` will break.","severity":"breaking","affected_versions":"<2.7.0"},{"fix":"Use `TruSession().run_dashboard()` instead.","message":"`run_dashboard_sis` is deprecated as of 2.7.2.","severity":"deprecated","affected_versions":">=2.7.2"},{"fix":"Always check that the provider is correctly instantiated with `api_key` or `base_url` and test with a known good key.","message":"Feedback functions require an LLM provider to be initialized with a valid API key. If the key is missing or invalid, they will fail silently or raise cryptic errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from trulens.core import TruSession` instead of `from trulens import Tru`.","message":"`TruSession` is the new session class starting from 2.0, replacing the old `Tru` class. Importing `Tru` directly will raise ImportError.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from trulens.core import TruSession` and replace `Tru()` with `TruSession()`.","cause":"The old `Tru` class was removed in favor of `TruSession` starting from v2.0.","error":"ImportError: cannot import name 'Tru' from 'trulens'"},{"fix":"Check the correct method name in the provider's documentation. For OpenAI, use `provider.groundedness_measure_with_cot_reasons` (available in 2.x).","cause":"Feedback function names changed between versions. The API is version-specific.","error":"AttributeError: 'OpenAI' object has no attribute 'groundedness_measure_with_cot_reasons'"},{"fix":"Install `trulens-core` and use `from trulens.core import ...` instead.","cause":"The old `trulens_eval` package was split into `trulens-core` and other subpackages starting from v2.0.","error":"ModuleNotFoundError: No module named 'trulens_eval'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}