Sanyam Bhutani e537356d80 Fix: Updated broken documentations links and references (#856) 1 ヶ月 前
..
README.md 731bef06d7 move3p to home 1 ヶ月 前
langgraph_rag_agent.ipynb e537356d80 Fix: Updated broken documentations links and references (#856) 1 ヶ月 前
langgraph_rag_agent_local.ipynb d62f6d3281 fix few typos 1 ヶ月 前
langgraph_tool_calling_agent.ipynb e537356d80 Fix: Updated broken documentations links and references (#856) 1 ヶ月 前

README.md

LangChain <> Llama3 Cookbooks

Agents

LLM agents use planning, memory, and tools to accomplish tasks. Here, we show how to build agents capable of tool-calling using LangGraph with Llama 3.

Agents can empower Llama 3 with important new capabilities. In particular, we will show how to give Llama 3 the ability to perform web search, as well as multi-modality: image generation (text-to-image), image analysis (image-to-text), and voice (text-to-speech) tools!

Tool-calling agents with LangGraph use two nodes: (1) a node with an LLM decides which tool to invoke based upon the user question. It outputs the tool name and arguments to use. (2) the tool name and arguments are passed to a tool node, which calls the tool itself with the specified arguments and returns the result back to the LLM.

Screenshot 2024-05-30 at 10 48 58 AM

Our first notebook, langgraph-tool-calling-agent, shows how to build our agent mentioned above using LangGraph.

See this video overview for more detail on the design of this agent.


RAG Agent

Our second notebook, langgraph-rag-agent, shows how to apply LangGraph to build a custom Llama 3 powered RAG agent that uses ideas from 3 papers:

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

We implement each approach as a control flow in LangGraph:

  • Planning: The sequence of RAG steps (e.g., retrieval, grading, and generation) that we want the agent to take.
  • Memory: All the RAG-related information (input question, retrieved documents, etc) that we want to pass between steps.
  • Tool use: All the tools needed for RAG (e.g., decide web search or vectorstore retrieval based on the question).

We will build from CRAG (blue, below) to Self-RAG (green) and finally to Adaptive RAG (red):

langgraph_rag_agent_


Local LangGraph RAG Agent

Our third notebook, langgraph-rag-agent-local, shows how to apply LangGraph to build advanced RAG agents using Llama 3 that run locally and reliably.

See this video overview for more detail on the design of this agent.