最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

huggingface - Is there a change in the langchain libraries and interfaces? - Stack Overflow

programmeradmin3浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 0

from_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')>
发布评论

评论列表(0)

  1. 暂无评论