Building adaptive RAG from scratch with Command-R
ฝัง
- เผยแพร่เมื่อ 3 เม.ย. 2024
- 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.langchain.com/public/57...
Code:
github.com/langchain-ai/langg...
Well illustrated! Thanks for sharing.
Thanks for explaining it so well.
Thank you, We love Cohere!
Thank you, it is very useful.
Fantastic. Thank you.
Awesome
Thank you for sharing. At the end of the video, it's mentioned that you can run Command-R with Ollama but if I understand correctly "withStructuredOutput" is not yet implemented for Ollama. How do you use "withStructuredOutput" with Ollama? Thank you.
Hell yea
Please tell me what handwritten process flow design tool you use for those colour images
Lance thank you so much for this incredibly useful tutorial!
Guys, can somebody please clarify what would be the difference between just invoking the model with binded tools as opposed to using create_tool_calling_agent method and then running AgentExecutor? Especially in the context of the langgraph. I see so many tutorials on langgraph but only few of them use AgentExecutors. Do I even need to use AgentExecutors with langgraph at all? What is the difference?
Is this suppose to tie in with the command r+ release?
I do not see grade_documents after web_search. Seems after web_search it directly goes to generate. Is it expected?
What is used to create the illustration? They are really nice style
Excalidraw
By the way, how would i make the StateGraph persistent?
Wake up, babe. Someone has just invented DSPy’s assertions and suggestions 😉
whats that
What's that
What recording software is that? Seems pretty lightweight, except that it records its own timer…
I assume he is using loom
@@Slimshady68356 thanks!
@@andreas_bergstromnp