Skip to content

fix: Updated learn\generation\langchain\handbook\02-langchain-chains.ipynb to Work with LangChain 0.3 #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Siraj-Aizlewood
Copy link

Changes:

  • Import langchain-community as it's required for from langchain.callbacks import get_openai_callback.
  • Import numexpr as it's required by LLMMathChain.
  • Updated to use LCEL, rather than importing Chain classes.
  • Removed LangChain Hub part at end of Notebook as it was used for importingt the deprecated LLMathChain

Problem

Describe the purpose of this change. What problem is being solved and why?

Solution

Describe the approach you took. Link to any relevant bugs, issues, docs, or other resources.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Describe specific steps for validating this change.

…ipynb to Work with LangChain 0.3

Changes:
- Import `langchain-community` as it's required for `from langchain.callbacks import get_openai_callback`.
- Import `numexpr` as it's required by `LLMMathChain`.
- Updated to use LCEL, rather than importing Chain classes.
- Removed LangChain Hub part at end of Notebook as it was used for importingt the deprecated LLMathChain
- Use RunnableLambda explicitly to make LCEL more intentioned.
- Replace deprecated .run() with .invoke()
- Add RunnableParallel/RunnablePassthrough examples
- Add batch processing with .batch() method
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

- Replace deprecated .run() with .invoke()
- Add explicit RunnableLambda usage
- Add RunnableParallel/RunnablePassthrough examples
- Add batch processing with .batch() method
- Update imports to include all LCEL runnables

Aligns notebook with company guide recommendations for clearer,
more modern LCEL patterns.
Added OpenAI key input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant