langchain-ai / langchain

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

Unable to Initialize the Ollama Functions Module Due to ImportError in Langchain Core Utils #24652

Closed chakravarthik27 closed 1 month ago

chakravarthik27 commented 1 month ago

Checked other resources

Example Code

from langchain_experimental.llms.ollama_functions import OllamaFunctions

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\KALYAN\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain_experimental\llms\ollama_functions.py", line 44, in <module>
    from langchain_core.utils.pydantic import is_basemodel_instance, is_basemodel_subclass
ImportError: cannot import name 'is_basemodel_instance' from 'langchain_core.utils.pydantic' (C:\Users\<Profile>\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain_core\utils\pydantic.py)

Description

I'm trying to use langchain for tooling in Ollama, but I'm encountering an ImportError when attempting to initialize the Ollama Functions module. The error states that is_basemodel_instance cannot be imported from langchain_core.utils.pydantic.

System Info

System Information

OS: Windows OS Version: 10.0.22631 Python Version: 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]

Package Information

langchain_core: 0.2.11 langchain: 0.2.6 langchain_community: 0.2.6 langsmith: 0.1.83 langchain_experimental: 0.0.63 langchain_fireworks: 0.1.4 langchain_groq: 0.1.4 langchain_openai: 0.1.14 langchain_text_splitters: 0.2.2 langgraph: 0.1.5

Packages not installed (Not Necessarily a Problem)

The following packages were not found:

langserve

wulifu2hao commented 1 month ago

pip install -U langchain_core

Successfully installed langchain_core-0.2.23