02. Runnable structure (graph) review
LCEL runnable After creating it, you will often want to check it to better understand what is going on.
This laptop covers some ways to do this.
Copy
# Configuration file for managing API keys as environment variables
from dotenv import load_dotenv
# Load API key information
load_dotenv()Copy
True Copy
# LangSmith Set up tracking. https://smith.langchain.com
# !pip install langchain-teddynote
from langchain_teddynote import logging
# Enter a project name.
logging.langsmith("LCEL-Advanced")Copy
Start tracking LangSmith.
[Project name]
LCEL-Advanced Copy
Copy
Check graph configuration
You can get a graph of runnable.
chain.get_graph() The method returns the chain's execution graph.
This method returns a graph object representing the connection between each node and node in the chain.
The node in the graph represents each step in the chain, and the edge represents the data flow between the steps.
Copy
Copy
Copy
Copy
Graph output
Outputing the graph allows you to express it in an easy-to-understand form.
Although the output results are not very easy to read, the output allows you to check the graph in a more understandable form.
Copy
Copy
Bring prompt
An important part of the chain is the prompt used.
chain.get_prompts() The method returns a list of prompt objects used in the chain.
Copy
Copy
Last updated