You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: recipes/use_cases/langchain/README.md
+22-12Lines changed: 22 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,48 +4,58 @@ LLM agents use [planning, memory, and tools](https://lilianweng.github.io/posts/
4
4
5
5
LangChain offers several different ways to implement agents.
6
6
7
-
(1) Use [agent executor](https://python.langchain.com/docs/modules/agents/quick_start/) with [tool-calling](https://python.langchain.com/docs/integrations/chat/) versions of llama3.
7
+
(1) Use [AgentExecutor](https://python.langchain.com/docs/modules/agents/quick_start/) with [tool-calling](https://python.langchain.com/docs/integrations/chat/) versions of Llama 3.
8
8
9
-
(2) Use [LangGraph](https://python.langchain.com/docs/langgraph), a library from LangChain that can be used to build reliable agents.
9
+
(2) Use [LangGraph](https://python.langchain.com/docs/langgraph), a library from LangChain that can be used to build reliable agents with Llama 3.
10
10
11
11
---
12
12
13
-
### Agent Executor
13
+
### AgentExecutor Agent
14
14
15
-
Our first notebook, `tool-calling-agent`, shows how to build a [tool calling agent](https://python.langchain.com/docs/modules/agents/agent_types/tool_calling/) with agent executor.
15
+
AgentExecutor is the runtime for an agent. AgentExecutor calls the agent, executes the actions it chooses, passes the action outputs back to the agent, and repeats.
16
16
17
-
This show how to build an agent that uses web search and retrieval tools.
17
+
Our first notebook, `tool-calling-agent`, shows how to build a [tool calling agent](https://python.langchain.com/docs/modules/agents/agent_types/tool_calling/) with AgentExecutor and Llama 3.
18
+
19
+
This shows how to build an agent that uses web search and retrieval tools.
18
20
19
21
---
20
22
21
-
### LangGraph
23
+
### LangGraph Agent
22
24
23
25
[LangGraph](https://python.langchain.com/docs/langgraph) is a library from LangChain that can be used to build reliable agents.
24
26
25
27
LangGraph can be used to build agents with a few pieces:
26
28
-**Planning:** Define a control flow of steps that you want the agent to take (a graph)
27
29
-**Memory:** Persist information (graph state) across these steps
28
-
-**Tool use:** Tools can be used at any step to modify state
30
+
-**Tool use:** Modify state at any step
31
+
32
+
Our second notebook, `langgraph-agent`, shows how to build a Llama 3 powered agent that uses web search and retrieval tool in LangGraph.
29
33
30
-
Our second notebook, `langgraph-agent`, shows how to build an agent that uses web search and retrieval tool in LangGraph.
34
+
It discusses some of the trade-offs between AgentExecutor and LangGraph.
35
+
36
+
---
31
37
32
-
It discusses some of the trade-offs between agent executor and LangGraph.
38
+
### LangGraph RAG Agent
33
39
34
-
Our third notebook, `langgraph-rag-agent`, shows how to apply LangGraph to build advanced RAG agents that use ideas from 3 papers:
40
+
Our third notebook, `langgraph-rag-agent`, shows how to apply LangGraph to build advanced Llama 3 powered RAG agents that use ideas from 3 papers:
35
41
36
42
* Corrective-RAG (CRAG) [paper](https://arxiv.org/pdf/2401.15884.pdf) uses self-grading on retrieved documents and web-search fallback if documents are not relevant.
37
43
* Self-RAG [paper](https://arxiv.org/abs/2310.11511) adds self-grading on generations for hallucinations and for ability to answer the question.
38
44
* Adaptive RAG [paper](https://arxiv.org/abs/2403.14403) routes queries between different RAG approaches based on their complexity.
39
45
40
46
We implement each approach as a control flow in LangGraph:
41
-
-**Planning:** The sequence of RAG steps (e.g., retrieval, grading, generation) that we want the agent to take
47
+
-**Planning:** The sequence of RAG steps (e.g., retrieval, grading, and generation) that we want the agent to take
42
48
-**Memory:** All the RAG-related information (input question, retrieved documents, etc) that we want to pass between steps
43
49
-**Tool use:** All the tools needed for RAG (e.g., decide web search or vectorstore retrieval based on the question)
44
50
45
51
We will build from CRAG (blue, below) to Self-RAG (green) and finally to Adaptive RAG (red):
46
52
47
53

48
54
49
-
Our fouth notebook, `langgraph-rag-agent-local`, shows how to apply LangGraph to build advanced RAG agents that run locally and reliable.
55
+
---
56
+
57
+
### Local LangGraph RAG Agent
58
+
59
+
Our fouth notebook, `langgraph-rag-agent-local`, shows how to apply LangGraph to build advanced RAG agents using Llama 3 that run locally and reliably.
50
60
51
61
See this [video overview](https://www.youtube.com/watch?v=sgnrL7yo1TE) for more detail.
0 commit comments