Skip to Content
仕組みからわかる大規模言語モデル 生成AI時代のソフトウェア開発入門
book

仕組みからわかる大規模言語モデル 生成AI時代のソフトウェア開発入門

by 奥田 勝己
February 2025
Intermediate
376 pages
9h 25m
Japanese
Shōeisha
Content preview from 仕組みからわかる大規模言語モデル 生成AI時代のソフトウェア開発入門
6
ここでは
StateGraph
クラスのインスタンスを作成し、各ノードとその処理を追加していま
す。
add_node
メソッドで各ノードと処理を追加します。
add_node
メソッドの第一引数はノー
ドの名前、第二引数はそのノードで実行する関数または
Runnable
オブジェクトです。ここで
は、
Deposit
ノードで
deposit
関数を、
Full
ノードで
finalize
関数を実行するように設定して
います。
add_conditional_edges
メソッドと
add_edge
メソッドの呼び出しでは、ノード間の遷移を定
義します。
add_conditional_edges
メソッドは、条件付きの遷移を定義します。第一引数は遷
移元のノード、第二引数は条件チェック関数、第三引数は遷移先のノードを指定するための辞
書です。条件チェック関数が返した値に応じて、遷移先のノードが決定されます。ここでは、
Deposit
ノードから
check_goal
関数を使うことで、
Full
ノードに遷移するか、
Deposit
ノード
に留まるかを決定しています。
check_goal
関数は、状態以外に
goal
を引数とします。このた
め、この関数を部分適用し、状態のみを引数とする関数を作成してから
add_conditional_
edges
メソッドに渡しています。なお、部分適用には
functools.partial
関数を使っています。
add_edge
メソッドは無条件の遷移を定義します。ここでは、
Full
ノードから
END
ノードに遷
移するように設定しています。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

What Successful Brick-and-Mortar Retailers Get Right

What Successful Brick-and-Mortar Retailers Get Right

Rob Angell
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9784798185613