Open antoninoLorenzo opened 4 weeks ago
Thanks a lot for the first issue posting
Thanks for pointing this out @antoninoLorenzo. I appreciate that you tried to solve it on your own. It is actually a bug in the langchain integration part. it will be resolved in the next release (0.0.8).
I assume that the first problem arose because, in the file evaluation/base.py, there is an import default_llm
. it needs to change. and also we are accessing the token_usage
property which is only available for a few llms in langchain. Needed to remove the token_usage
attribute in langchain integration.
If possible, please raise a PR as a solution.
Code I tried to use
evaluate
with aLangchainLLMWrapper
, however for some it still requires an OpenAI key, here is the code:PS: I do not usally work with Langchain so there is a chance I done something wrong with it, however by the error raised, even if this is the case, it is unclear if that's a bug in the library
Problem By further inspecting the problem I found that it is happening here:
Solution Attempt I read trough the source code and tried to find a work around, this was my attempt:
However it yielded another error
KeyError: 'token_usage'
:At that point I don't know what I can try going deeper in the source code (i.e I can't propose a solution), so I point out that problem in hope that you can improve the library. (or tell me what I am doing wrong)
PS: 'ValueError: OPENAI_API_KEY not found in the environmen.' has a typo, it misses the 't';