langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
84.82k stars 13.1k forks source link

community: import fix #20995

Closed leo-gan closed 2 weeks ago

leo-gan commented 2 weeks ago

Issue: When the third-party package is not installed, whenever we need to pip install <package> the ImportError is raised. But sometimes, the ValueError or ModuleNotFoundError is raised. It is bad for consistency. Change: replaced the ValueError or ModuleNotFoundError with ImportError when we raise an error with the pip install <package> message. Note: Ideally, we replace all try: import... except... raise ...with helper functions like import_aim or just use the existing langchain_core.utils.utils.guard_import But it would be much bigger refactoring. @baskaryan Please, advice on this.

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **langchain** | ⬜️ Ignored ([Inspect](https://vercel.com/langchain/langchain/bqshvrPPVnYZawPhkR3obgXGnL7r)) | [Visit Preview](https://langchain-git-fork-leo-gan-community-importerror-fix-langchain.vercel.app) | | Apr 28, 2024 8:47pm |
leo-gan commented 2 weeks ago

@baskaryan Thanks!