Skip to content

fix: Updated learn\generation\langchain\handbook\04-langchain-chat.ipynb to Work with LangChain 0.3 #461

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 3 commits into
base: master
Choose a base branch
from

Conversation

Siraj-Aizlewood
Copy link
Contributor

@Siraj-Aizlewood Siraj-Aizlewood commented Jun 13, 2025

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.

New LCEL compatible methods.

Also ensured that the old test case which relied on the LLM being less capable was changed to a new test case that works well with a better LLM.

Tried to give an example of when Prompt Templates might be used in place of a dynamic f-strings in functions.
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Siraj-Aizlewood
Copy link
Contributor Author

Siraj-Aizlewood commented Jun 13, 2025

As well as updating the notebook to use more modern LangChain techniques (e.g. LCEL chains):

  1. The old notebook relied on older gpt versions that would output flawed results (which could then be fixed with prompt templates). When replaced with gpt-4.1-mini, these flaws went away, so used new ways of demonstrating uses of prompt templates.
  2. Tried to give a concrete example of where LangChain prompt templates might be preferred over a simple dynamically generated f-string in a function. The example involves jinja templates and can be found at the end of the notebook.

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