HuggingFaceEndpoint: Correct Example for ImportError (#1176)

When I try to import the Class HuggingFaceEndpoint I get an Import
Error: cannot import name 'HuggingFaceEndpoint' from 'langchain'.
(langchain version 0.0.88)
These two imports work fine: from langchain import HuggingFacePipeline
and from langchain import HuggingFaceHub.

So I corrected the import statement in the example. There is probably a
better solution to this, but this fixes the Error for me.
searx-query-suffixy
Konstantin Hebenstreit 1 year ago committed by GitHub
parent 0c84ce1082
commit af94f1dd97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,6 +28,7 @@ from langchain.llms import (
Cohere,
ForefrontAI,
GooseAI,
HuggingFaceEndpoint,
HuggingFaceHub,
OpenAI,
Petals,
@ -76,6 +77,7 @@ __all__ = [
"PromptTemplate",
"ReActChain",
"Wikipedia",
"HuggingFaceEndpoint",
"HuggingFaceHub",
"HuggingFacePipeline",
"SQLDatabase",

@ -8,6 +8,7 @@ from langchain.llms.cerebriumai import CerebriumAI
from langchain.llms.cohere import Cohere
from langchain.llms.forefrontai import ForefrontAI
from langchain.llms.gooseai import GooseAI
from langchain.llms.huggingface_endpoint import HuggingFaceEndpoint
from langchain.llms.huggingface_hub import HuggingFaceHub
from langchain.llms.huggingface_pipeline import HuggingFacePipeline
from langchain.llms.nlpcloud import NLPCloud
@ -26,6 +27,7 @@ __all__ = [
"NLPCloud",
"OpenAI",
"Petals",
"HuggingFaceEndpoint",
"HuggingFaceHub",
"HuggingFacePipeline",
"AI21",
@ -43,6 +45,7 @@ type_to_cls_dict: Dict[str, Type[BaseLLM]] = {
"forefrontai": ForefrontAI,
"gooseai": GooseAI,
"huggingface_hub": HuggingFaceHub,
"huggingface_endpoint": HuggingFaceEndpoint,
"nlpcloud": NLPCloud,
"openai": OpenAI,
"petals": Petals,

@ -23,7 +23,7 @@ class HuggingFaceEndpoint(LLM, BaseModel):
Example:
.. code-block:: python
from langchain import HuggingFaceEndpoint
from langchain.llms.huggingface_endpoint import HuggingFaceEndpoint
endpoint_url = (
"https://abcdefghijklmnop.us-east-1.aws.endpoints.huggingface.cloud"
)

Loading…
Cancel
Save