Is there a change in the langchain libraries and interfaces ?
Of late I am seeing that sample code in langchain documentation is not working. Hence my question.
For example, the below code throws an error: Reference link: /
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
llm = HuggingFaceEndpoint(
repo_id="HuggingFaceH4/zephyr-7b-beta",
task="text-generation",
max_new_tokens=512,
do_sample=False,
repetition_penalty=1.03,
)
chat_model = ChatHuggingFace(llm=llm)
Error:
ImportError: cannot import name 'from_env' from 'langchain_core.utils'
Is there a change in the langchain libraries and interfaces ?
Of late I am seeing that sample code in langchain documentation is not working. Hence my question.
For example, the below code throws an error: Reference link: https://python.langchain/docs/integrations/chat/huggingface/
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
llm = HuggingFaceEndpoint(
repo_id="HuggingFaceH4/zephyr-7b-beta",
task="text-generation",
max_new_tokens=512,
do_sample=False,
repetition_penalty=1.03,
)
chat_model = ChatHuggingFace(llm=llm)
Error:
ImportError: cannot import name 'from_env' from 'langchain_core.utils'
Share
Improve this question
asked Feb 17 at 14:22
Satyajit DattaSatyajit Datta
291 bronze badge
1 Answer
Reset to default 0from_env was added in langchain-core 0.2.30 (https://github/langchain-ai/langchain/issues/26497) What version are you using?
from pprint import pprint
from importlib.metadata import version
from packaging.version import parse
pprint(parse(version("langchain_core")))
I get:
<Version('0.3.35')>