Skip to content

Commit

Permalink
HuggingFaceEndpoint: Correct Example for ImportError (#1176)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KonstantinHebenstreit authored Feb 21, 2023
1 parent 0c84ce1 commit af94f1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions langchain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Cohere,
ForefrontAI,
GooseAI,
HuggingFaceEndpoint,
HuggingFaceHub,
OpenAI,
Petals,
Expand Down Expand Up @@ -76,6 +77,7 @@
"PromptTemplate",
"ReActChain",
"Wikipedia",
"HuggingFaceEndpoint",
"HuggingFaceHub",
"HuggingFacePipeline",
"SQLDatabase",
Expand Down
3 changes: 3 additions & 0 deletions langchain/llms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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
Expand All @@ -26,6 +27,7 @@
"NLPCloud",
"OpenAI",
"Petals",
"HuggingFaceEndpoint",
"HuggingFaceHub",
"HuggingFacePipeline",
"AI21",
Expand All @@ -43,6 +45,7 @@
"forefrontai": ForefrontAI,
"gooseai": GooseAI,
"huggingface_hub": HuggingFaceHub,
"huggingface_endpoint": HuggingFaceEndpoint,
"nlpcloud": NLPCloud,
"openai": OpenAI,
"petals": Petals,
Expand Down
2 changes: 1 addition & 1 deletion langchain/llms/huggingface_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit af94f1d

Please sign in to comment.