0

LangChain <> MistralAI Cookbooks

Agents use LLMs to direct the control flow of an application. LangGraph is a library that helps you build reliable agents.

Example · مثال

Content

LangChain <> MistralAI Cookbooks

Agents use LLMs to direct the control flow of an application. LangGraph is a library that helps you build reliable agents.

  • See our slides.
  • See our free course on LangGraph here.

We'll show how to use LangGraph to build agent examples for RAG and Code Generation.

RAG

We'll apply LangGraph to a build RAG agent that uses ideas from 3 papers:

  • Document grading (CRAG paper) - uses self-grading on retrieved documents and web-search fallback if documents are not relevant.
  • Generation grading (Self-RAG paper) - adds self-grading on generations for hallucinations and for ability to answer the question.
  • Routing (paper) - routes queries between different RAG approaches based on their complexity.

Video overview:

  • https://www.youtube.com/watch?v=sgnrL7yo1TE

---

Code generation

We'll combine the code generation capabilities of Codestral with the self-correction approach presented in the AlphaCodium paper, constructing an answer to a coding question iteratively.

We will implement some of these ideas from scratch using LangGraph:

  1. Produce structured code generation output from Codestral-instruct
  1. Perform inline unit tests to confirm imports and code execution work
  1. Feed back any errors for Codestral for self-correction.

Video overview:

  • https://youtu.be/zXFxmI9f06M

Source and license

Source
Mistral Cookbook
Original
mistralai/cookbook/third_party/langchain
License
MIT