Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HuggingFaceEndpoint: Correct Example for ImportError #1176

Merged
merged 3 commits into from
Feb 21, 2023

Conversation

KonstantinHebenstreit
Copy link
Contributor

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.

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.
Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah perfect - will update this so it can just be from langchain.llms import HuggingFaceEndpoint, but thank you for flagging!

@KonstantinHebenstreit
Copy link
Contributor Author

That is also not working in my case unfortunately...
from langchain.llms import HuggingFaceEndpoint
ImportError: cannot import name 'HuggingFaceEndpoint' from 'langchain.llms'

But again, this works: from langchain.llms import HuggingFaceHub

ah perfect - will update this so it can just be from langchain.llms import HuggingFaceEndpoint, but thank you for flagging!

@hwchase17
Copy link
Contributor

That is also not working in my case unfortunately... from langchain.llms import HuggingFaceEndpoint ImportError: cannot import name 'HuggingFaceEndpoint' from 'langchain.llms'

But again, this works: from langchain.llms import HuggingFaceHub

ah perfect - will update this so it can just be from langchain.llms import HuggingFaceEndpoint, but thank you for flagging!

yup will need to update the init file as well

To make the import of HuggingFaceEndpoint work.
@KonstantinHebenstreit
Copy link
Contributor Author

Changed the init file. Is there something else to be done to make it work?
For me "from langchain.llms import HuggingFaceEndpoint" works now.

If necessary also update the general init.py
Such that "from langchain import HuggingFaceEndpoint" is possible.
@KonstantinHebenstreit
Copy link
Contributor Author

Also changed the general init file to make "from langchain import HuggingFaceEndpoint" possible

@hwchase17
Copy link
Contributor

Also changed the general init file to make "from langchain import HuggingFaceEndpoint" possible

im gonna remove this once its merged in actually - i actually dont want this to be possible, trying to enforce things are loaded from their modules

@hwchase17 hwchase17 merged commit af94f1d into langchain-ai:master Feb 21, 2023
@blob42 blob42 mentioned this pull request Feb 21, 2023
zachschillaci27 pushed a commit to zachschillaci27/langchain that referenced this pull request Mar 8, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants