langchain-ai / langchain

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

Cannot import name 'create_model' from 'langchain_core.runnables.utils' #22956

Open ShenSeanChen opened 3 months ago

ShenSeanChen commented 3 months ago

Checked other resources

Example Code


ImportError Traceback (most recent call last) Cell In[68], line 2 1 # Build graph ----> 2 from langgraph.graph import END, StateGraph 4 workflow = StateGraph(GraphState) 5 # Define the nodes

File ~/Desktop/Dev/AI-Agent/ai-agent-env/lib/python3.9/site-packages/langgraph/graph/init.py:1 ----> 1 from langgraph.graph.graph import END, START, Graph 2 from langgraph.graph.message import MessageGraph, MessagesState, add_messages 3 from langgraph.graph.state import StateGraph

File ~/Desktop/Dev/AI-Agent/ai-agent-env/lib/python3.9/site-packages/langgraph/graph/graph.py:31 29 from langgraph.constants import END, START, TAG_HIDDEN, Send 30 from langgraph.errors import InvalidUpdateError ---> 31 from langgraph.pregel import Channel, Pregel 32 from langgraph.pregel.read import PregelNode 33 from langgraph.pregel.types import All

File ~/Desktop/Dev/AI-Agent/ai-agent-env/lib/python3.9/site-packages/langgraph/pregel/init.py:46 36 from langchain_core.runnables.base import Input, Output, coerce_to_runnable 37 from langchain_core.runnables.config import ( 38 RunnableConfig, 39 ensure_config, (...) 44 patch_config, 45 ) ---> 46 from langchain_core.runnables.utils import ( 47 ConfigurableFieldSpec, 48 create_model, 49 get_unique_config_specs, 50 ) 51 from langchain_core.tracers._streaming import _StreamingCallbackHandler 52 from typing_extensions import Self

ImportError: cannot import name 'create_model' from 'langchain_core.runnables.utils' (/Users/UserName/Desktop/Dev/AI-Agent/ai-agent-env/lib/python3.9/site-packages/langchain_core/runnables/utils.py)

Error Message and Stack Trace (if applicable)

No response

Description

I was trying to import StateGraph from langchain.graph and it kept returning the error of 'create_model' not available in langchain_core.runnables.utils

System Info

langchain==0.2.5 langchain-community==0.0.13 langchain-core==0.2.7 langchain-text-splitters==0.2.1

keenborder786 commented 3 months ago

what is the langgraph version that you are using?

keenborder786 commented 3 months ago

Can you please update it.

anuran-roy commented 3 months ago

Hey, is there any update on this? Stuck at the same error

edugargar commented 2 months ago

Same error here. Any news?

ypindi commented 2 weeks ago

Same issue with me. Anyone found a solution to this?