01. Default graph generation

In this tutorial, you will learn how to generate graphs using LangGraph.

To define the LangGraph graph

  1. State definition

  2. Node definition

  3. Graph definition

  4. Graph compilation

  5. Graph visualization

Step through.

Learn how to use conditional edges when creating graphs and how to change various flows.

State definition

Copy

from typing import TypedDict, Annotated, List
from langchain_core.documents import Document
import operator


# State 정의
class GraphState(TypedDict):
    context: Annotated[List[Document], operator.add]
    answer: Annotated[List[Document], operator.add]
    question: Annotated[str, operator.add]
    sql_query: Annotated[str, operator.add]
    binary_score: Annotated[str, operator.add]

Node definition

Copy

Graph definition

Copy

SQL RAG

Copy

Visualize the graph.

Copy

Last updated