Registry / llm-agents / trulens-core

trulens-core

JSON →
library2.8.0pypypiunverified

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.

pip install trulens-core
INSTALL
IMPORT
SIG · TRULENS-CORE
T
trulens-core
llm-agentspythonv2.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Initialize TruLens session and define a feedback function.

from trulens.core import TruSession from trulens.feedback import Feedback from trulens.providers.openai import OpenAI session = TruSession() session.reset_database() provider = OpenAI(model_engine="gpt-4o-mini", api_key=os.environ.get('OPENAI_API_KEY', '')) f_groundedness = Feedback(provider.groundedness_measure_with_cot_reasons, name="Groundedness") print("Feedback defined.") # See docs for full quickstart: https://www.trulens.org/
tru --version
Debug
Known issues
breakingIn 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.
fix
Migrate to `Metric` class with explicit selectors dictionary. See migration guide: https://www.trulens.org/trulens/api/metrics/
affects: <2.7.0
deprecated`run_dashboard_sis` is deprecated as of 2.7.2.
fix
Use `TruSession().run_dashboard()` instead.
affects: >=2.7.2
gotchaFeedback 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.
fix
Always check that the provider is correctly instantiated with `api_key` or `base_url` and test with a known good key.
affects: all
gotcha`TruSession` is the new session class starting from 2.0, replacing the old `Tru` class. Importing `Tru` directly will raise ImportError.
fix
Use `from trulens.core import TruSession` instead of `from trulens import Tru`.
affects: >=2.0.0
Errors
Common errors & fixes
ImportError: cannot import name 'Tru' from 'trulens'
The old `Tru` class was removed in favor of `TruSession` starting from v2.0.
fix
Use `from trulens.core import TruSession` and replace `Tru()` with `TruSession()`.
AttributeError: 'OpenAI' object has no attribute 'groundedness_measure_with_cot_reasons'
Feedback function names changed between versions. The API is version-specific.
fix
Check the correct method name in the provider's documentation. For OpenAI, use `provider.groundedness_measure_with_cot_reasons` (available in 2.x).
ModuleNotFoundError: No module named 'trulens_eval'
The old `trulens_eval` package was split into `trulens-core` and other subpackages starting from v2.0.
fix
Install `trulens-core` and use `from trulens.core import ...` instead.
Upgrade
Version history
2.8.0latest on PyPI · released Apr 30, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
33 hits · last 30 days
node
30
OpenAI (training)
1
Resources
trulens-core — pip install trulens-core · libregistry