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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from graph import create_graph\n",
    "\n",
    "graph = create_graph()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAA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tDJQzylo7zyscTsFu4f6d6T/7xY/dpV7R1IIXc0cMbHfa1oBXjD/TvSf/AHix+7Sr2eBtrCtlL/qz2eAtrcNH5sLUREXYPvQiIgCIiAIiIAiIgCIiAIiIAiIgCIiAh+Q4YY2/lLt8XsnVluSCWVla0WMLuVrdwNunRo/YvH6KKHjGb+OPyU2Ra4knv+yMnSpyd3FP/CIT9FFDxjN/HH5J9FFDxjN/HH5KbIoxJenREYNLkXREJ+iih4xm/jj8k+iih4xm/jj8lNkTEl6dEMGlyLoiE/RRQ8Yzfxx+SfRRQ8Yzfxx+SmyJiS9OiGDS5F0RCfoooeMZv44/JZOJ4a47E5ipkhdyVuxVLjELVkvY0uaWk7bfY4qWopxJLd9kSqVOLuopP2QREWRqEREAREQH/9k=",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import Image\n",
    "\n",
    "Image(graph.get_graph().draw_mermaid_png())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Checking memory or database...\n",
      "{'question': 'What did I ask you about?', 'generation': [HumanMessage(content=\"The total value of 'Cash and cash equivalents' reported on December 31, 2023, was $6,874 million.\", id='1b372d25-12a9-45e8-a813-0dcd3513c4b0')], 'wiki_search': True, 'documents': [Document(page_content='Table of Contents\\nAirbnb, Inc.\\nNotes to Condensed Consolidated Financial Statements (unaudited)\\nNote 3. Supplemental Financial Statement Information\\nCash, Cash Equivalents, and Restricted Cash\\nThe following table reconciles cash, cash equivalents, and restricted cash reported on the Company’s unaudited condensed consolidated balance sheets to the total amount\\npresented in the unaudited condensed consolidated statements of cash flows (in millions):\\nDecember 31,\\n2023March 31,\\n2024\\nCash and cash equivalents $ 6,874 $ 7,829 \\nCash and cash equivalents included in funds receivable and amounts held on behalf of customers 5,769 8,665 \\nRestricted cash included in prepaids and other current assets 24 35 \\nTotal cash, cash equivalents, and restricted cash presented in the unaudited condensed consolidated statements of cash flows $ 12,667 $ 16,529 \\nSupplemental disclosures of balance sheet information\\nSupplemental balance sheet information consisted of the following (in millions):\\nDecember 31,\\n2023March 31,\\n2024\\nOther assets, noncurrent:\\nProperty and equipment, net $ 160 $ 171', metadata={'source': './data/airbnb_10q_q1.pdf', 'page': 10, '_id': 'dcc76f23b4c6413ba4b1b8f6095ddc68', '_collection_name': 'rag-chroma'}), Document(page_content='unrealized loss position for more than twelve months as of December 31, 2023 and March 31, 2024, respectively.\\nThe following table summarizes the contractual maturities of the Company’s available-for-sale debt securities (in millions):\\nMarch 31, 2024\\nAmortized\\nCostEstimated\\nFair Value\\nDue within one year $ 1,489 $ 1,489 \\nDue after one year through five years 957 947 \\nDue after five years 96 92 \\nTotal $ 2,542 $ 2,528 \\nNote 5. Fair Value Measurements and Financial Instruments\\nThe following table summarizes the Company’s financial assets and liabilities measured at fair value on a recurring basis (in millions):\\nDecember 31, 2023\\nLevel 1 Level 2 Level 3 Total\\nAssets\\nCash and cash equivalents:\\nMoney market funds $ 2,018 $ — $ — $ 2,018 \\nCertificates of deposit — 1 — 1 \\nGovernment bonds — 115 — 115 \\nCommercial paper — 223 — 223 \\nCorporate debt securities — 12 — 12 \\n2,018 351 — 2,369 \\nShort-term investments:', metadata={'source': './data/airbnb_10q_q1.pdf', 'page': 12, '_id': '1ca887ac192949e0b166c0ba896d6cc1', '_collection_name': 'rag-chroma'}), Document(page_content='Page: Car Allowance Rebate System\\nSummary: The Car Allowance Rebate System (CARS), colloquially known as \"cash for clunkers\", was a $3 billion U.S. federal scrappage program intended to provide economic incentives to U.S. residents to purchase a new, more fuel-efficient vehicle when trading in a less fuel-efficient vehicle. The program was promoted as a post-recession stimulus program to boost auto sales (which had declined due to the effects of the 2007–2008 financial crisis, leading to the Great Recession and 2008–2010 automotive industry crisis) while putting more fuel-efficient vehicles on the roadways.\\nThe program officially started on July 1, 2009, the processing of claims began July 24, and the program ended on August 24, 2009, as the appropriated funds were exhausted, having scrapped 677,081 vehicles. The deadline for dealers to submit applications was August 25. According to estimates of the Department of Transportation, the initial $1 billion appropriated for the system was exhausted by July 30, 2009, well before the anticipated end date of November 1, 2009, due to very high demand. In response, Congress approved an additional $2 billion.\\n\\n\\n\\nPage: Vietnamese cash\\nSummary: The Vietnamese cash (chữ Hán: 文錢 văn tiền; chữ Nôm: 銅錢 đồng tiền; French: sapèque), also called the sapek or sapèque, is a cast round coin with a square hole that was an official currency of Vietnam from the Đinh dynasty in 970 until the Nguyễn dynasty in 1945, and remained in circulation in North Vietnam until 1948. The same type of currency circulated in China, Japan, Korea, and Ryūkyū for centuries. Though the majority of Vietnamese cash coins throughout history were copper coins, lead, iron (from 1528) and zinc (from 1740) coins also circulated alongside them often at fluctuating rates (with 1 copper cash being worth 10 zinc cash in 1882). Coins made from metals of lower intrinsic value were introduced because of various superstitions involving Vietnamese people burying cash coins, as the problem of people burying cash coins became too much for the government. Almost all coins issued by government mints tended to be buried mere months after they had entered circulation. The Vietnamese government began issuing coins made from an alloy of zinc, lead, and tin. As these cash coins tended to be very fragile, they would decompose faster if buried, which caused the Vietnamese people to stop burying their coins.\\nThe inscriptions of Vietnamese cash coins can be written in either the Viết chéo (曰湥 / 曰袑, top-bottom-right-left) style or the Viết thuận (曰順, clockwise, top-right-bottom-left) style.\\n\\nPage: Cash transfer\\nSummary: A cash transfer is a direct transfer payment of money to an eligible person. Cash transfers are either unconditional cash transfers or conditional cash transfers. They may be provided by organisations funded by private donors, or a local or regional government.\\nCash transfers constitute a critical element in the realm of global social policy, addressing needs ranging from poverty alleviation to crisis response. This article distinguishes between two main types of cash transfers: humanitarian cash transfers, grounded in international humanitarian principles, and social assistance cash transfers, integral to long-term social welfare strategies.\\nHumanitarian cash transfers are aligned with the principles of humanity, neutrality, impartiality, and independence, which are fundamental to humanitarian aid. These principles, endorsed by UN General Assembly resolutions 46/182 and 58/114, ensure that humanitarian aid, including cash transfers, prioritizes human suffering and assists the most vulnerable without favoritism or discrimination. Humanity underscores the need to address human suffering universally. Neutrality ensures that aid does not favor any party in a conflict or dispute. Impartiality dictates that aid is based solely on need, without discrimination. Independence highlights the autonomy of humanitarian objectives from political, economic, military, or other objectives. Adhering to these principles, humanitarian cash transfers provide life-saving assistance in emergencies like natural disasters, conflicts, and famines, focusing on short-term, immediate relief.\\nConversely, social assistance cash transfers are part of broader social protection systems aimed at reducing long-term poverty and vulnerability. These transfers target various demographic groups, including the unemployed, single parents, and individuals facing disabilities or old age challenges. By enhancing the capacity of individuals to manage socioeconomic risks and promoting efficient labor markets, social assistance cash transfers contribute to social equity and stability.\\nWhile both humanitarian and social assistance cash transfers aim to provide monetary support to those in need, they differ significantly in their objectives, implementation, and impact. Humanitarian cash transfers are typically responsive, addressing urgent needs in crisis situation')]}\n",
      "Memory sufficient. Generating answer.\n",
      "Node 'start':\n",
      "\n",
      "---\n",
      "\n",
      "Generating answer...\n",
      "Node 'generate':\n",
      "\n",
      "---\n",
      "\n",
      "You asked about the topic of cash.\n"
     ]
    }
   ],
   "source": [
    "# Run\n",
    "config = {\"configurable\": {\"thread_id\": \"3\"}}\n",
    "\n",
    "inputs = {\"question\": \"What did I ask you about?\"}\n",
    "async for output in graph.astream(inputs, config=config):\n",
    "    for key, value in output.items():\n",
    "        # Node\n",
    "        print(f\"Node '{key}':\")\n",
    "        # Optional: print full state at each node\n",
    "        # print(value)\n",
    "    print(\"\\n---\\n\")\n",
    "\n",
    "# Final generation\n",
    "print(value[\"generation\"])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from rich import print\n",
    "\n",
    "%load_ext rich"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "! pip install langchain_community tiktoken langchain-openai langchainhub chromadb langchain langgraph tavily-python"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Actual functions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Wikipedia Tool"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_community.tools import WikipediaQueryRun\n",
    "from langchain_community.utilities import WikipediaAPIWrapper\n",
    "\n",
    "api_wrapper = WikipediaAPIWrapper(top_k_results=5, doc_content_chars_max=1000)\n",
    "\n",
    "tool = WikipediaQueryRun(api_wrapper=api_wrapper)\n",
    "print(tool.invoke(\"What's a state in computer science?\"))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Load documents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain.text_splitter import RecursiveCharacterTextSplitter\n",
    "from langchain_community.document_loaders import WebBaseLoader\n",
    "from langchain_community.vectorstores import Qdrant\n",
    "from langchain_openai import OpenAIEmbeddings\n",
    "\n",
    "urls = [\n",
    "    \"https://lilianweng.github.io/posts/2023-06-23-agent/\",\n",
    "    \"https://lilianweng.github.io/posts/2023-03-15-prompt-engineering/\",\n",
    "    \"https://lilianweng.github.io/posts/2023-10-25-adv-attack-llm/\",\n",
    "]\n",
    "\n",
    "docs = [WebBaseLoader(url).load() for url in urls]\n",
    "docs_list = [item for sublist in docs for item in sublist]\n",
    "\n",
    "text_splitter = RecursiveCharacterTextSplitter.from_tiktoken_encoder(\n",
    "    chunk_size=250, chunk_overlap=0\n",
    ")\n",
    "doc_splits = text_splitter.split_documents(docs_list)\n",
    "\n",
    "# Add to vectorDB\n",
    "vectorstore = Qdrant.from_documents(\n",
    "    documents=doc_splits,\n",
    "    collection_name=\"rag-chroma\",\n",
    "    location=\":memory:\",\n",
    "    embedding=OpenAIEmbeddings(),\n",
    ")\n",
    "\n",
    "retriever = vectorstore.as_retriever()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Grader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_core.pydantic_v1 import BaseModel, Field\n",
    "from langchain_openai import ChatOpenAI\n",
    "from langchain_core.prompts import ChatPromptTemplate\n",
    "\n",
    "\n",
    "## Grading model\n",
    "class DocumentGrade(BaseModel):\n",
    "    \"\"\"Binary score for relevance check on retrieved documents\"\"\"\n",
    "\n",
    "    binary_score: str = Field(\n",
    "        description='Document is relevant to the question, \"yes\" or \"no\"'\n",
    "    )\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# LLM with function call\n",
    "llm = ChatOpenAI(model=\"gpt-3.5-turbo-0125\", temperature=0)\n",
    "structured_llm_grader = llm.with_structured_output(DocumentGrade)\n",
    "structured_llm_grader\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Grader Prompts\n",
    "system = \"\"\"You are a grader assessing relevance of a retrieved document to a user question. \\n \n",
    "    If the document contains keyword(s) or semantic meaning related to the question, grade it as relevant. \\n\n",
    "    Give a binary score 'yes' or 'no' score to indicate whether the document is relevant to the question.\"\"\"\n",
    "\n",
    "grade_prompt = ChatPromptTemplate.from_messages(\n",
    "    [\n",
    "        (\"system\", system),\n",
    "        (\"human\", \"Retrieved document: \\n\\n {document} \\n\\n User question: {question}\"),\n",
    "    ]\n",
    ")\n",
    "\n",
    "retrieval_grader = grade_prompt | structured_llm_grader\n",
    "\n",
    "question = \"agent memory\"\n",
    "docs = retriever.invoke(question)\n",
    "doc_txt = docs[1].page_content\n",
    "print(retrieval_grader.invoke({\"question\": question, \"document\": doc_txt}))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Generate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "agent_prompt = \"\"\"You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Use three sentences maximum and keep the answer concise.\\nQuestion: {question} \\nContext: {context} \\nAnswer:\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "### Generate\n",
    "\n",
    "from langchain_core.output_parsers import StrOutputParser\n",
    "\n",
    "# Prompt\n",
    "prompt = ChatPromptTemplate.from_messages([(\"human\", agent_prompt)])\n",
    "prompt\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Generator LLM\n",
    "llm = ChatOpenAI(model_name=\"gpt-3.5-turbo\", temperature=0)\n",
    "\n",
    "\n",
    "# Post-processing\n",
    "def format_docs(docs):\n",
    "    return \"\\n\\n\".join(doc.page_content for doc in docs)\n",
    "\n",
    "\n",
    "# Chain\n",
    "rag_chain = prompt | llm | StrOutputParser()\n",
    "\n",
    "# Run\n",
    "generation = rag_chain.invoke({\"context\": docs, \"question\": question})\n",
    "print(generation)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "rag_chain"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Question Re-writer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Question rewriter LLM\n",
    "llm = ChatOpenAI(model=\"gpt-3.5-turbo-0125\", temperature=0)\n",
    "\n",
    "# Prompt\n",
    "system = \"\"\"You are a question re-writer that converts an input question to a better version that is optimized \\n \n",
    "     for web search. Look at the input and try to reason about the underlying semantic intent / meaning.\"\"\"\n",
    "\n",
    "re_write_prompt = ChatPromptTemplate.from_messages(\n",
    "    [\n",
    "        (\"system\", system),\n",
    "        (\n",
    "            \"human\",\n",
    "            \"Here is the initial question: \\n\\n {question} \\n Formulate an improved question.\",\n",
    "        ),\n",
    "    ]\n",
    ")\n",
    "\n",
    "question_rewriter = re_write_prompt | llm | StrOutputParser()\n",
    "question_rewriter.invoke({\"question\": question})\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Graph"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## State"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "from typing_extensions import TypedDict\n",
    "from langchain.schema import Document\n",
    "\n",
    "class GraphState(TypedDict):\n",
    "    \"\"\"\n",
    "    Represents the state of our graph.\n",
    "\n",
    "    Attributes:\n",
    "        question: question\n",
    "        generation: LLM generation\n",
    "        web_search: whether to add search\n",
    "        documents: list of documents\n",
    "    \"\"\"\n",
    "\n",
    "    question: str\n",
    "    generation: str\n",
    "    wiki_search: str\n",
    "    documents: List[str]\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Nodes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def retrieve(state):\n",
    "    print(\"Retrieving documents...\")\n",
    "\n",
    "    question = state[\"question\"]\n",
    "\n",
    "    docs = retriever.invoke(question)\n",
    "\n",
    "    return {\"question\": question, \"documents\": docs}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def generate(state):\n",
    "    print(\"Generating answer...\")\n",
    "\n",
    "    question = state[\"question\"]\n",
    "    documents = state[\"documents\"]\n",
    "\n",
    "    generation = rag_chain.invoke({\"context\": documents, \"question\": question})\n",
    "    return {\"documents\": documents, \"question\": question, \"generation\": generation}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def grade_documents(state):\n",
    "    print(\"Grading documents...\")\n",
    "\n",
    "    question = state[\"question\"]\n",
    "    documents = state[\"documents\"]\n",
    "\n",
    "    filtered_docs = []\n",
    "    search_wikipedia = False\n",
    "\n",
    "    for doc in documents:\n",
    "        score = retrieval_grader.invoke(\n",
    "            {\"question\": question, \"document\": doc.page_content}\n",
    "        )\n",
    "\n",
    "        grade = score.binary_score\n",
    "\n",
    "        if grade == \"yes\":\n",
    "            print(\"Document is relevant to the question.\")\n",
    "            filtered_docs.append(doc)\n",
    "        else:\n",
    "            print(\"Document is not relevant to the question.\")\n",
    "            search_wikipedia = True\n",
    "\n",
    "            continue\n",
    "\n",
    "    return {\n",
    "        \"documents\": filtered_docs,\n",
    "        \"question\": question,\n",
    "        \"wiki_search\": search_wikipedia,\n",
    "    }\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def rewrite_query(state):\n",
    "    print(\"Rewriting question...\")\n",
    "\n",
    "    question = state[\"question\"]\n",
    "    documents = state[\"documents\"]\n",
    "\n",
    "    rewritten_question = question_rewriter.invoke({\"question\": question})\n",
    "\n",
    "    return {\"question\": rewritten_question, \"documents\": documents}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def search_wikipedia(state):\n",
    "    print(\"Searching Wikipedia...\")\n",
    "\n",
    "    question = state[\"question\"]\n",
    "    documents = state[\"documents\"]\n",
    "\n",
    "    wiki_search = tool.invoke(question)\n",
    "\n",
    "    wiki_results = Document(page_content=wiki_search)\n",
    "\n",
    "    documents.append(wiki_results)\n",
    "\n",
    "    return {\"question\": question, \"documents\": documents}\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Edges"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def generate_or_not(state):\n",
    "    print(\"Determining whether to query Wikipedia...\")\n",
    "\n",
    "    question = state[\"question\"]\n",
    "    wiki_search = state[\"wiki_search\"]\n",
    "    documents = state[\"documents\"]\n",
    "\n",
    "    if wiki_search:\n",
    "        print(\"Rewriting query and supplementing information from Wikipedia...\")\n",
    "        return \"rewrite_query\"\n",
    "    \n",
    "    else:\n",
    "        print(\"Relevant documents found.\")\n",
    "        return \"generate\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Build and compile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langgraph.graph import StateGraph, END\n",
    "from langgraph.checkpoint.aiosqlite import AsyncSqliteSaver\n",
    "import aiosqlite\n",
    "\n",
    "workflow = StateGraph(GraphState)\n",
    "\n",
    "workflow.add_node(\"retrieve\", retrieve)\n",
    "workflow.add_node(\"grade_documents\", grade_documents)\n",
    "workflow.add_node(\"rewrite_query\", rewrite_query)\n",
    "workflow.add_node(\"search_wikipedia\", search_wikipedia)\n",
    "workflow.add_node(\"generate\", generate)\n",
    "\n",
    "workflow.set_entry_point(\"retrieve\")\n",
    "workflow.add_edge(\"retrieve\", \"grade_documents\")\n",
    "workflow.add_conditional_edges(\n",
    "    \"grade_documents\",\n",
    "    generate_or_not,\n",
    "    {\"rewrite_query\": \"rewrite_query\", \"generate\": \"generate\"},\n",
    ")\n",
    "\n",
    "workflow.add_edge(\"rewrite_query\", \"search_wikipedia\")\n",
    "workflow.add_edge(\"search_wikipedia\", \"generate\")\n",
    "workflow.add_edge(\"generate\", END)\n",
    "\n",
    "checkpoints = aiosqlite.connect(\"./checkpoints/checkpoint.sqlite\")\n",
    "memory = AsyncSqliteSaver(checkpoints) \n",
    "\n",
    "app = workflow.compile(checkpointer=memory)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'app' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[4], line 3\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mIPython\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdisplay\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Image\n\u001b[1;32m----> 3\u001b[0m Image(\u001b[43mapp\u001b[49m\u001b[38;5;241m.\u001b[39mget_graph()\u001b[38;5;241m.\u001b[39mdraw_mermaid_png())\n",
      "\u001b[1;31mNameError\u001b[0m: name 'app' is not defined"
     ]
    }
   ],
   "source": [
    "from IPython.display import Image\n",
    "\n",
    "Image(app.get_graph().draw_mermaid_png())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "app"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Run\n",
    "config = {'configurable': {'thread_id': '1'}}\n",
    "\n",
    "inputs = {\"question\": \"What did I ask you about previously?\"}\n",
    "async for output in app.astream(inputs, config=config):\n",
    "    for key, value in output.items():\n",
    "        # Node\n",
    "        print(f\"Node '{key}':\")\n",
    "        # Optional: print full state at each node\n",
    "        print(value)\n",
    "    print(\"\\n---\\n\")\n",
    "\n",
    "# Final generation\n",
    "print(value[\"generation\"])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}