Adaptive-RAG (@SoyeongJeong97 et al) is a recent paper that combines (1) query analysis and (2) iterative answer construction to seamlessly handle queries of differing complexity. We took at stab at implementing some of these ideas from scratch using LangGraph and @cohere's Command-R, a lightweight (35b parameter), open-weight, fast LLM with strong tool-use and RAG performance.
Code and video below, showing how to use Command-R for query analysis (re-writing and routing) as well as RAG and fast in-the-loop unit tests for document relevance, hallucinations, and answer quality. Our demo will route queries between a vectorstore, web search, and fallback to LLM generations based on the question; it will also iteratively grade responses.
LangSmith traces show that all these steps can be done in a few seconds:
smith.langchai...
Code:
github.com/lan...
Негізгі бет Building adaptive RAG from scratch with Command-R
Пікірлер: 24