This came at a very opportune time when i started building something using langchain and wanted to understand this whole hot mess known as RAGs and this series by Lance makes this more approachable. Lovem or hatem you cant ignore RAGs if you are building with LLMs. Atleasr if you are GPU piss poor like me. So 🙏 Langchain.
Thanks for the tutorial, Lance.! I have learned a lot. I have a question though when I set the nearest neighbor parameter 'k' in the retriever as 5 for the same example provided in the video, `retriever = vectorstore.as_retriever(search_kwargs={"k": 5})`. In Langsmith, I see that out of the 5 neighbors' output, the first 3 are the same outputs. Shouldn't all the 5 neighbors be different or if 5 neighbors don't exist, shouldn't the output be unique neighbors which is 3 in this case.? Can you please help me understand why this is the case.?
I'm having a hard time understanding the {"context": retriever, "question": RunnablePassthough()} If I have 3 different inputs to the chain and a prompt containing these inputs + an explanation of how to respond to these inputs. How can I write that step in the chain?
@@lauther_27 I solved it like this... however I'm not sure if its ok: rag_chain = {"context": itemgetter("description") | retriever, "issues_and_opportunities": itemgetter("issues_and_opportunities"), "business_goals": itemgetter("business_goals"), "description": itemgetter("description")} | prompt| llm | output_parser