-
|
Hi all, |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
|
Hi @LingeshSD! I'm Dosu and I’m helping the trulens team. Yes, TruLens supports using custom or internally hosted LLMs for evaluation. The framework is designed with a provider abstraction that allows you to plug in different LLMs by subclassing the LLMProvider interface and implementing the required methods, such as _create_chat_completion. This makes it possible to integrate non-OpenAI models, including those hosted on-premise or via private APIs. There are out-of-the-box provider packages for various LLMs, including LiteLLM (which can connect to local models like Ollama), Huggingface, Langchain, Bedrock, and more. For example, you can use the LiteLLM provider to connect to a local LLM by specifying the model engine and API base URL: from trulens.providers.litellm import LiteLLM
provider = LiteLLM(
model_engine="ollama/llama3.1:8b",
api_base="http://localhost:11434"
)You can then use this provider with TruLens feedback functions for evaluation. The modular architecture allows you to extend or implement your own provider if your LLM exposes a compatible API. For more details and example code, see the TruLens documentation and provider examples. If your LLM has a unique API, you may need to subclass LLMProvider and implement the required methods to handle prompt/response formatting and endpoint communication. The LiteLLM provider is a good reference for how to do this for custom endpoints and models "LiteLLM provider implementation". In summary: you do not need to use OpenAI—TruLens is flexible and supports a wide range of LLMs, including custom and on-premise deployments. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.
-
|
@dosu We have an internal LLM integrated with LangChain using a custom class that implements the LangChain BaseChatModel interface. Does TruLens support evaluation and instrumentation for LangChain-based models like this? Specifically, can we use TruLens’ LangChain integration (TruChain) or the LangChain provider to run feedback functions without relying on OpenAI? |
Beta Was this translation helpful? Give feedback.
-
|
hi @dosu I’m trying to integrate TruLens with a custom LangChain flow and add evaluation metrics like responsiveness, hallucinations, and actionability using a custom LLM (not OpenAI). Wrapping a LangChain chain with TruChain Current docs mostly show OpenAI or RAG triad examples, but not a full custom flow. An official snippet would help a lot. |
Beta Was this translation helpful? Give feedback.
-
|
@dosu Thanks for the example! deepeval test run tests/"project"/"filename".py python tests/"project"/test_trulens_evaluation.py |
Beta Was this translation helpful? Give feedback.
-
|
hi @dosu Feedback Function Architecture What was the design reasoning behind consolidating all evaluation logic under a single Feedback interface instead of separate metric types? Internal Metric Logic How are the built-in metric prompts written internally? Editing Built‑in Metrics Is there an official way to extend or override built-in metrics (e.g., Groundedness, Faithfulness) with custom prompts or logic? Evaluation Coverage How does the internal tracing system decide which components a feedback function applies to? Non‑LLM vs LLM Metrics How does TruLens differentiate execution paths for LLM-based metrics vs. non‑LLM metrics (similarity functions, lexicon-based checks, latency/cost metrics)? Complete Official Metric List Overall, I’m trying to understand the philosophy behind the feedback‑centric design and how it compares to frameworks that expose many discrete metric classes. Any insight into the architecture or examples of best practices would be very helpful. |
Beta Was this translation helpful? Give feedback.
-
|
hi @dosu What if a required metric is not available in the feedback wrapper? How are the built‑in metrics calculated and combined into a single score? |
Beta Was this translation helpful? Give feedback.
Yes, TruLens supports evaluation and instrumentation for LangChain-based models that implement the BaseChatModel interface, including custom/internal LLMs. You can use both the LangChain integration (TruChain) and the Langchain provider to run feedback functions without relying on OpenAI.
The Langchain provider in TruLens accepts any LangChain LLM or ChatModel (i.e., anything implementing BaseLLM or BaseChatModel), so your custom class is supported. The provider wraps your model and uses its predict or predict_messages methods to generate completions for feedback evaluation—there’s no requirement for the underlying model to be OpenAI-based. This is confirmed in the provider implementatio…