fix: migrate cookiefactoryv3 assistant to chainlit 2.x / langchain 2.x#164
Open
m4minidesk-sys wants to merge 4 commits intoaws-samples:mainfrom
Open
fix: migrate cookiefactoryv3 assistant to chainlit 2.x / langchain 2.x#164m4minidesk-sys wants to merge 4 commits intoaws-samples:mainfrom
m4minidesk-sys wants to merge 4 commits intoaws-samples:mainfrom
Conversation
- chainlit Action API: value/description → payload/tooltip (bedrock.py) - langchain imports: langchain.* → langchain_classic.* / langchain_text_splitters / langchain_community.vectorstores - requirements.txt: add chainlit>=2.0.0, langchain-classic, langchain-text-splitters Tested: chainlit run app/bedrock.py starts successfully with Python 3.12 + chainlit 2.9.6 + langchain-aws 1.3.1
…uirements.txt These packages are required for the langchain 2.x migration but were missing from requirements.txt. langchain-classic is a PyPI package (v1.0.1) that provides backward-compatible LLMChain, PromptTemplate, etc.
lazify 0.4.0 + chainlit 2.x causes ChainlitContextException when pydantic builds Chain subclasses at module load time. Moving the chainlit.context import inside the point_camera_to_entity() function prevents the eager evaluation and resolves the import-time error. Closes: ChainlitContextException on module import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate the CookieFactoryV3 assistant app from deprecated chainlit 1.x and langchain 1.x APIs to current versions.
Changes
chainlit 1.x → 2.x (bedrock.py)
cl.Action(value=..., description=...)→cl.Action(payload=..., tooltip=...)action.value→action.payload.get('value')langchain 1.x → 2.x (8 lib files)
from langchain import PromptTemplate→from langchain_classic import PromptTemplatefrom langchain.chains import *→from langchain_classic.chains import *from langchain.vectorstores import Chroma→from langchain_community.vectorstores import Chromafrom langchain.text_splitter import *→from langchain_text_splitters import *from langchain.schema import BaseMemory→from langchain_classic.schema import BaseMemoryrequirements.txt
chainlit>=2.0.0,langchain-classic,langchain-text-splitters.gitignore
.chainlit/andpackage-lock.jsonto prevent auto-generated files from being trackedTesting
Verified:
chainlit run app/bedrock.pystarts successfullyFiles Changed
11 files, 54 insertions, 54 deletions (under 200 line limit ✅)