-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Langchain vs LangChain in providers #1454
Comments
I found a similar closed issue: import Tru requires openai, which was resolved by making OpenAI optional through this pull request [1]. Regarding your specific issue, the from trulens.apps.langchain import TruChain Additionally, ensure you have the pip install trulens-apps-langchain This should resolve the import error you're encountering [2][3][4]. |
@dosu you are confusing tru chain used for wrapping langchain apps and the langchain feedback provider. |
I apologize for the confusion. TruChain is used for wrapping LangChain applications to inspect and evaluate their internals, while the LangChain feedback provider is used for evaluating specific metrics such as context relevance. For example, to instrument a LangChain application with TruChain: from trulens_eval import TruChain
tru_recorder = TruChain(rag_chain) To use the LangChain feedback provider for evaluating metrics: from trulens_eval.feedback.provider import OpenAI
from trulens_eval.feedback import Feedback
import numpy as np
provider = OpenAI()
context = TruChain.select_context(rag_chain)
f_context_relevance = (
Feedback(provider.context_relevance)
.on_input()
.on(context)
.aggregate(np.mean)
) Additionally, note that the LangChain provider cannot be used in |
Sorry wasn't 100% clear I guess, the Example in the documentation says:
but the object inside the providers is called Langchain, so what will work:
... took some time for me to find that out, perhaps changing the documentation is the easiest way. Thanks |
Sorry for the confusion here @ThomasZiegenhein - we'll fix this in docs, and also look to standardize how we name langchain |
Bug Description
import error
To Reproduce
from trulens.providers.langchain import LangChain (see https://www.trulens.org/reference/trulens/providers/langchain/#trulens.providers.langchain)
Expected behavior
No import error
Relevant Logs/Tracebacks
Environment:
trulens-core==1.0.1
trulens-feedback==1.0.1
trulens-providers-langchain==1.0.1
Additional context
Probably Typo in Documentation, either change Documentation or go with LangChain for object name
The text was updated successfully, but these errors were encountered: