Closed hackrz closed 1 month ago
Hello, @hackrz! I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together!
To resolve the OpenAICallbackHandler
deprecation warning and the nltk_data
certificate verification error, follow these steps:
Deprecation Warning for OpenAICallbackHandler
:
from langchain_community.callbacks.openai_info import OpenAICallbackHandler
langchain
CLI tool to help with this process as described in the LangChain documentation.NLTK Data Certificate Verification Error:
Bypass SSL certificate verification for NLTK by adding the following code at the beginning of your script:
import ssl
import nltk
# Bypass SSL certificate verification
ssl._create_default_https_context = ssl._create_unverified_context
# Download the NLTK data
nltk.download('stopwords')
nltk.download('punkt')
By following these steps, you should be able to resolve both the deprecation warning and the certificate verification error [1].
To continue talking to Dosu, mention @dosu.
I already tried option 1 per my description in issue and option 2 did not work in pycharm
Thanks for the deprecation warning. I think the nltk error was unrelated here. Were you fully online when this happened? I'm guessing that you might have had the nltk download request redirected (to a wifi login page or something similar) hence the ssl failure. Can you verify or check that you are getting the same error while fully online?
It was on Pycharm and my wifi was also fully functional on macOs. Not sure what you meant by fully online. Could you please clarify?
By fully online I was referring to a situation where sometimes with public wifi hotspots, you first connect in such a way that it looks like you are online but all connections get replaced by a special login page where you are asked to accept some hotspot terms or some such. This is one way in which an SSL would fail to verify a connection.
What was the problem when you tried dosu's second suggestion? (can you try it without the ssl... line?)
Also, does this apply to you: https://stackoverflow.com/questions/41348621/ssl-error-downloading-nltk-data/42890688#42890688 ?
Yes, this worked like a charm. Thanks Do you also have any visibility into LangChainDeprecationWarning issue?
Bug Description getting OpenAICallbackHandler error and nltk_data error
To Reproduce Seems to be hidden dependencies in trulens_eval package installation This piece of code in Pycharm 2024.1 community edition from trulens_eval import Feedback, LiteLLM, TruLlama
Expected behavior No error
Relevant Logs/Tracebacks LangChainDeprecationWarning: Importing OpenAICallbackHandler from /Users/abc/PycharmProjects/rag_training/.venv/lib/python3.12/site-packages/langchain/callbacks/openai_info.py is deprecated. Please replace deprecated imports:
with new imports of:
Environment:
Additional context The debugging options so far:
Though the code exits with 0, not sure if it will create any issues down the line