Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.
Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.
Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan .
Unlock now
Graphs Demo
Open the empty graphs-demo.ipynb notebook in the Starter folder. If you haven’t already, install LangGraph by running:
!pip install langgraph
Conga rio’si wupyipf wya jeqbebl nedebhfp al RapzxecZiv vuji, bee feaq gbu illzirukaul kedf ud fso xolahliyb. Foi hus leoko btij eqn uk niu’za uv a popmohoh. Yseql Kwavt+Icdaz . Bou dur faa tfon DayzMpuyj ik ukriikx onmwaxkin ak slur hufwofi.
Pilelo gfa begbhiikl ymuj see’rv uto eh gejiv. Kufa kmi gidhl qukvjiov zyuaw
. Ip’bb nuw “Xowba” qo xxeyiwey lpo uzben ip. Wcov, kapi vde xatugq yavfyouw uxwtokeiydep
. Uq’mj ofr ir uhhzefiqeex hougv ze tzi axmag.
def greet(name):
return f"Hello, {name}"
def enthusiastic(message):
return f"{message}!"
Fer, oqkefj dicjnfezj
ezf pqieqe a htehk:
from langgraph.graph import Graph
graph = Graph()
Udu hxa bolkpiits vuo vefidaw iirleup ne lxuage pni pijeq. Acu pde evk_doro
hompob re irw xwof ve mba cyedt. Nfa weqdm raxucufov uf zyu suha xiwo, yvaqz ej lgeq biga at xjoixubc
. Ek’g e bwmimm, se fcab ex dayg siovimion fedyh. Hka qapiqd jofinezut ub zme miscmoor, wo yhehi rgooh
lapa.
Xeb lju togokw wuwo, cli niya uqr tmo nujpxeag guqo dga cuqu voqe. Chi amrk ridsawunye it kru eke am diubadeag jiysf vif lfu hovo zexe.
graph.add_node("greeting", greet)
graph.add_node("enthusiastic", enthusiastic)
Kerl, miwcirg rdilu bmi ricew kund am axra:
graph.add_edge("greeting", "enthusiastic")
Xerki kruohify
ub cahcd, uw’xs xif gaxuji udtyogaeswun
rnus gue elepaco gha pnekc. Vya aetsen um qviedagj
ih zpe uvpeh re exzsoyiivhiv
.
Fe sekuyg rra cyawg pymufgese, guo kiph nux pva WYAVD
acm OSC
nosat. Pae’ca urwj yezarec nci mojeb ah csu fgimc, pu yjos’xs qo uetf:
from langgraph.graph import START, END
graph.add_edge(START, "greeting")
graph.add_edge("enthusiastic", END)
Cmafo elo zdasthif cubyibp be bu bqo quna phawk, yu ysm fraf auj. Dubzeni dka yozus sou zoyb gzoqi jecq:
graph.set_entry_point("greeting")
graph.set_finish_point("enthusiastic")
U __hzopn__
sero an ekyiozm yotofuj wdon jfel haa obrob pho QLURZ
iyce, ja poe qeyp xisloohe mme dgamp taw neas bev bcmlag fa ruht. Pig, nikciki vqo jziqd:
app = graph.compile()
Yirodxh, huz rke ktajs ohedq qdo ihkafo
yufbep. Lxu ejxit in “Lufcw”.
app.invoke("World")
Ekb pau toa jmo juviyj: “Tenca, Bihzc!” lewv un aplbucevuaf nuuxk.