Difference between langchain and rag

RAG: retrieval-augmented generation. That is a technique to passively examine the the latest user input and the context of conversation, and then use embeddings or other search technique to fill the AI model context with specialized knowledge relevant to the topic. Usually used for making an AI that can answer about closed-domain problems, such as company knowledgebase.

Langchain is instead an agent. It gives the AI multiple iterations it can perform with multiple semi-autonomous steps until a job is completed. That can be improving an answer until it is optimum, or can be actions fulfilled by multiple calls, like browsing pages or documents (although this is best done by native tuning like “functions”, not by prompting alone). Far more expensive and possible to run out of control against your account balance.

4 Likes