Replies: 2 comments
-
The migrating v0.0 chains guide suggests using LCEL as a replacement for
Supporting evidence and code from the document: # Migrating from ConversationalRetrievalChain
The [`ConversationalRetrievalChain`](https://python.langchain.com/v0.2/api_reference/langchain/chains/langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain.html) was an all-in one way that combined retrieval-augmented generation with chat history, allowing you to "chat with" your documents.
Advantages of switching to the LCEL implementation are similar to the [`RetrievalQA` migration guide](./retrieval_qa.ipynb):
- Clearer internals. The `ConversationalRetrievalChain` chain hides an entire question rephrasing step which dereferences the initial query against the chat history.
- This means the class contains two sets of configurable prompts, LLMs, etc.
- More easily return source documents.
- Support for runnable methods like streaming and async operations.
- Unified interface with `Runnable` methods.
- Composition primitives for easy chain configuration.
- Extensibility and customization of chain parameters. Additionally, the The LCEL implementation exposes the internals of what's happening around retrieving, formatting documents, and passing them through a prompt to the LLM, but it is more verbose. You can customize and wrap this composition logic in a helper function, or use the higher-level |
Beta Was this translation helpful? Give feedback.
-
I see. I saw the internals of create_retrieval_chain etc. and they use LCEL. Ok thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
The migrating v0.0 chains guide suggests using LCEL as a replacement for ConversationChain and certain different chains as a replacement for ConversationalRetrievalChain, namely
history_aware_retriever
,create_stuff_documents_chain
andcreate_retrieval_chain
.Why does this differentiation exist? Why not use pipe operator like sequences for both of them? The LCEL documentation had seemed to suggest that this was the way to go, so it seems conflicting that the migration guide suggests something else but the LCEL documentation suggests something else.
System Info
Does not affect versions.
Beta Was this translation helpful? Give feedback.
All reactions