{"id":46665,"library":"trulens","title":"TruLens","description":"TruLens is an open-source library for evaluating and tracking LLM applications. It provides feedback functions, telemetry, and a dashboard for monitoring performance. Version 2.8.1 supports Python >=3.10, <4.0, with active development on GitHub.","status":"active","version":"2.8.1","language":"python","source_language":"en","source_url":"https://github.com/truera/trulens","tags":["llm","evaluation","observability","monitoring"],"install":[{"cmd":"pip install trulens","lang":"bash","label":"Install TruLens"}],"dependencies":[{"reason":"Optional provider for LLM feedback functions","package":"openai","optional":true},{"reason":"Optional integration with LangChain","package":"langchain","optional":true},{"reason":"Optional integration with LlamaIndex","package":"llama-index","optional":true}],"imports":[{"note":"In v2.x, Tru moved to trulens.core","wrong":"from trulens import Tru","symbol":"Tru","correct":"from trulens.core import Tru"},{"note":"Feedback also moved to trulens.core","wrong":"from trulens import Feedback","symbol":"Feedback","correct":"from trulens.core import Feedback"},{"note":"Select moved to trulens.core","wrong":"from trulens import Select","symbol":"Select","correct":"from trulens.core import Select"}],"quickstart":{"code":"import os\nfrom trulens.core import Tru, Feedback\nfrom trulens.providers.openai import OpenAI\n\ntru = Tru()\nprovider = OpenAI(api_key=os.environ.get('OPENAI_API_KEY', ''))\n\n# Define a feedback function\nfeedback = Feedback(provider.relevance).on_input_output()\n\n# Wrap an app (example using a dummy function)\nfrom trulens.apps.custom import TruCustom\ndef my_app(input: str) -> str:\n    return f\"Response to: {input}\"\n\ntru_app = TruCustom(my_app, app_name='MyApp', feedbacks=[feedback])\n\n# Run the app\nwith tru_app as recording:\n    recording.record(my_app, \"Hello, world!\")\n\n# Check results\ntru.get_leaderboard()","lang":"python","description":"Initialize TruLens, create a feedback function with OpenAI, wrap a custom app, run it, and view leaderboard."},"warnings":[{"fix":"Use 'from trulens.core import Tru'. Update all imports to point to trulens.core or trulens.providers.","message":"TruLens v2.x introduced a major restructuring. Core classes like Tru, Feedback, Select moved to 'trulens.core'. The old import 'from trulens import Tru' no longer works.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Call Tru.run_dashboard(port=8501) explicitly. Check the v2 migration guide.","message":"The dashboard API changed in v2.3.0. The Tru.run_dashboard() method now requires a port argument and may have different defaults.","severity":"breaking","affected_versions":">=2.3.0"},{"fix":"Pass all feedbacks to TruCustom at construction or use the 'add_feedback' method before calling record.","message":"Feedback functions must be defined before wrapping the app. If you add feedbacks after TruCustom initialization, they will not be applied.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'2.8.1':27 '3.10':30 '4.0':31 'activ':33 'applic':14 'dashboard':22 'develop':34 'evalu':10,38 'feedback':17 'function':18 'github':36 'librari':8 'llm':13,37 'monitor':24,40 'observ':39 'open':6 'open-sourc':5 'perform':25 'provid':16 'python':29 'sourc':7 'support':28 'telemetri':19 'track':12 'trulen':1,2 'version':26","created_at":"2026-06-07T13:01:01.733046+00:00","updated_at":"2026-06-07T13:01:01.733046+00:00","problems":[{"fix":"Run 'pip install trulens' and ensure you are using Python >=3.10.","cause":"TruLens not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'trulens'"},{"fix":"Change import to 'from trulens.core import Tru'.","cause":"Using old import path; in v2.x, Tru is in trulens.core.","error":"AttributeError: module 'trulens' has no attribute 'Tru'"},{"fix":"Instantiate a provider: 'provider = OpenAI(api_key=...)' and pass it to Feedback constructor.","cause":"Feedback function requires a provider (e.g., OpenAI) to be instantiated.","error":"ValueError: Feedback function 'relevance' has no provider"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://trulens.org/","github":"https://github.com/truera/trulens","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","search"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}