Hello,
I have a installed
Name: langchain Version: 1.0.0a3
Name: langchain-core Version: 1.0.0a2
and using OSS(V1-alpha) docs: Streaming - Docs by LangChain
for this code
for chunk in agent.stream(
{“messages”:[{“role”:“user”,“content”:“What is the weather in London”}]},
stream_mode=“updates”,
):
for step, data in chunk.items():
print(f"step:{step}")
print(f"content:{data\["messages"\]\[-1\].content_blocks}")
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[33], line 7 5 for step, data in chunk.items(): 6 print(f"step:{step}“) ----> 7 print(f"content:{data[“messages”][-1].content_blocks}”) File c:\GitHub\langchainLearningPlayground\langchainlearningvenv\Lib\site-packages\pydantic\main.py:992, in BaseModel._getattr_(self, item) 989 return super()._getattribute_(item) # Raises AttributeError if appropriate 990 else: 991 # this is the current error → [992](file:///C:/Users/riahl/OneDrive/UKCareer/Careers/Resume/Companies/PrynGlobal/FoundationsMVPBuild/GitHub/langchainLearningPlayground/langchainlearningvenv/Lib/site-packages/pydantic/main.py:992) raise AttributeError(f’{type(self)._name_!r} object has no attribute {item!r}') AttributeError: ‘AIMessage’ object has no attribute ‘content_blocks’
but it works with .content
Appreciate your help to fix this error