L2 Langchain code are completely out of date

Hi, since the langchain updated after 25th Oct. I could not import as Andrew did in his lectures.

especially for this topic (Parse the LLM output string into a Python dictionary)

I am not sure if this course should update a bit? or does anyone has solution? (asked several ai and cannot get the way to solve :frowning: ) I cannot access the langchain api also, everything is out of date :((((

Are you attempting this lab on the learning platform or locally on your device?
Normally, the environment is frozen on the learning platform.
If you are trying locally, you have to check the latest documentation and do a lot of manual code update.

Thank you for your reply for my first post here!!

Yes, I realized. Doing it all on the online Jupyter is completely fine. However, moving locally is a pain.

By the way, parsing LLM to Python Dictionary( the one I struggled before) can be done using simply one line of code

from langchain_core.output_parsers import JsonOutputParser

parser = JsonOutputParser()
output_dict = parser.parse(response.generations[0][0].text)

after langchain update, we don’t really need the schema things(Andrew’s lecture).

I hope someone else who struggled could see this :wink:

Yes. I’m sure your post will help someone else with the same challenge. That’s why it’s good to share challenges and potential solutions.