We may earn an affiliate commission when you visit our partners.
Course image
Udemy logo

LangChainによる大規模言語モデル(LLM)アプリケーション開発入門―GPTを使ったチャットボットの実装まで

しま (大嶋勇樹)

2022 年末に公開されて以来、「ChatGPT」は一般にも知られるキーワードとなり、非常に盛り上がっています。

ChatGPT が使っている GPT-3.5 や GPT-4 などのモデルは、「大規模言語モデル(LLM:Large Language Model)」と呼ばれます。

2023 年現在、LLM 周辺のトピックは日々大きな話題となっています。

Read more

2022 年末に公開されて以来、「ChatGPT」は一般にも知られるキーワードとなり、非常に盛り上がっています。

ChatGPT が使っている GPT-3.5 や GPT-4 などのモデルは、「大規模言語モデル(LLM:Large Language Model)」と呼ばれます。

2023 年現在、LLM 周辺のトピックは日々大きな話題となっています。

そんな中、LLM を使ったアプリケーションを開発するためのツールとして、「LangChain」が注目を集めています。

LLM を使ったアプリケーション開発の基礎を学びたい方は、LangChain で実際にアプリケーションを実装してみるのがおすすめです。

この講座では、LangChain の入門から始めて、実際に LLM(GPT)を使ったアプリケーションを開発していきます。

コース後半では、LangChain を使って、Web アプリケーションと Slack ボットという 2 つのチャットボットを実装します。

これらには「会話履歴を踏まえて応答する機能」や「プライベートな文書を検索して応答する機能」を実装します。

■この講座の 3 つのポイント

  • 内部の動作を意識して LangChain にしっかり入門します

  • LangChain の基礎で終わらず、Web アプリや Slack ボットを実装します

  • 変化の激しいツールをキャッチアップして使う方法にもふれます

なお、OpenAI の Chat API の Function calling 機能についての解説も追加されています。

Function calling 機能の基本から、LangChain での応用的な使い方まで解説しています。

更新履歴

  • 2023/07/03:エラーの対応として以下のレクチャーを追加

    • (追記)「Gradio の Hello World」で発生する可能性のあるエラーについて

    • (追記)エラー「AttributeError: module 'gradio' has no attribute 'ClearButton'」について

    • (追記)Render での Poetry のバージョンの指定について

  • 2023/07/10:エラーの原因やより適切なコードについて、以下のレクチャーを追加

    • (追記)Agent の JSONDecodeError について

    • (追記)Slack から取得した履歴の reversed 処理について

  • 2023/07/11:セクション「(アップデート)OpenAI の Chat API の Function calling 機能について」を追加

  • 2023/07/25:レクチャー「(追記)「Gradio の Hello World」で発生する可能性のあるエラーについて」を更新

  • 2023/09/02:レクチャー「(追記)「Index の実装」で発生する可能性のあるエラーについて」を追加

  • 2023/11/03:以下のセクションを追加

    • (アップデート)プライベートな文書を検索して回答させる処理の解説資料

    • (アップデート)LangChain Expression Language (LCEL)

  • 2023/11/22:text-davinci-003の廃止予定に関する更新

    • レクチャー「(追記)Completions APIで使用可能なモデルについて」を追加

    • レクチャー「このコースの前半で使用するソースコード」で共有しているGoogle Colabを更新

  • 2023/11/24:レクチャー「(追記)RateLimitError について」を追加

  • 2023/12/15:セクション「(アップデート)OpenAI の Chat API の Function calling 機能について」のGoogle Colabで使用するduckduckgo-searchのバージョンを更新

  • 2024/02/21:レクチャー「(追記)Agent が Vector Store を検索する際に text-davinci-003 を使うことによるエラーについて」を追加

  • 2024/03/18:レクチャー「(追記)LCEL の解説資料」を追加

Enroll now

What's inside

Syllabus

このコースで学習することやコースの流れを把握します。

このコースの概要や学習すること、対象者や前提知識を確認します。

このコースを受講するときの進め方について説明します。

GPT の API の使い方や料金の基本を理解します。
Read more

OpenAI の大規模言語モデルの概要を学びます。

コース前半で学習に使う環境として、Google Colab を準備します。

このコースの前半で使用するソースコード

OpenAI の API を使うのに必要な、API キーを発行します。

(追記)RateLimitError について
(追記)Completions APIで使用可能なモデルについて

OpenAI の文章生成 API の 1 つである、Completions API にふれます。

OpenAI の文章生成 API の 1 つである、Chat API にふれます。

OpenAI Completions API や Chat API を使う上で重要な、トークン数と料金について学習します。

このセクションで学んだ知識を整理します。

LangChainの学習に必要な範囲で、プロンプトエンジニアリングに入門します。

LangChain を学ぶ上でも重要な、プロンプトエンジニアリングの概要を学習します。

ロンプトエンジニアリングのナレッジ集

LLM を使ったアプリケーション開発で登場する、プロンプトの要素とテンプレート化について学習します。

LangChain を学ぶ前に知っておきたい、プロンプトエンジニアリングの有名な手法にふれます。

LangChain の概要と、Models・Prompts・Chains というモジュールについて学習します。

LangChain の概要やユースケースを学びます。

アップデートの激しい新しい OSS をキャッチアップのポイントや、プロダクションで使うことのメリット・デメリットにふれます。

LangChain のモジュールの Models について、基本を学びます。

LangChain のモジュールの Prompts のうち、最も基本的な Prompt Template について学びます。

LangChain のモジュールの Chains について学び、いくつかの Chain にふれます。

ここまでに学んだ内容を整理して、公式ドキュメントとの対応を確認します。

Prompts のより高度な機能として、Output Parsers について学びます。

公式ドキュメントの特定バージョンをビルドする方法を紹介します。

LangChain のモジュールの Indexes・Memory・Agents などを学びます。

このセクションで学ぶことを説明します。

LangChain のモジュールの Indexes について、そのモチベーションと使い方の基本を学びます。

Indexes で使われる、テキストのベクトル化の概要と、Open AI の Embeddings について学びます。

LangChain のモジュールの Memory について、そのモチベーションと使い方の基本を学びます。

LangChain のモジュールの Agents について学び、内部のプロンプトの動作を見てみます。

ここまでに学んだ LangChain のモジュールについて整理します。

LLM を使ったアプリケーションを開発する際に注意が必要な、敵対的プロンプトについて補足します。

LangChain で OpenAI の Chat API に特化した実装をする方法を学びます。

LangChain のソースコードを少しだけ読んでみて、ソースコードの雰囲気を味わいます。

このコースの後半で実施することを説明します。

コース後半で必要な最小限だけ Git と GitHub について学びます。

このコース後半で Windows の場合に使用する WSL 2 のセットアップ方法を説明します。

Git や GitHub に慣れていない方のために、Git と GitHub の概要を説明します。

GitHub でこのコースで使用するためのリポジトリを作成します。

GitHub で作成したリポジトリをローカルに clone します。

おさえておきたい Git のコマンドを最小限学びます。

ローカルで Python を実行する環境を整えます。

このコースでの Python およびパッケージ管理・仮想環境のセットアップの方針を説明します。

Python の特定バージョンをインストールするための準備として、asdf をインストールします。

(補足)asdf のセットアップについて

asdf の使い方を学びながら、asdf で Python の特定のバージョンをインストールします。

asdf を使って、Python のパッケージ管理と仮想環境のためのツールである poetry をインストールします。

poetry init コマンドを使い、pyproject.toml を生成して、Python での実装の準備をします。

Python での実装の準備ができたことを確認するため、Hello World を実装します。

Gradio を使った Web アプリケーションの実装の概要を学びます。

このセクションで実装するアプリケーションについて説明します。

(追記)「Gradio の Hello World」で発生する可能性のあるエラーについて

Gradio をインストールして、Hello World を実施します。

(追記)エラー「AttributeError: module 'gradio' has no attribute 'ClearButton'」について

Gradio でチャットボットのサンプルコードを動かしてみます。

python-dotenv を導入し、API キーなどを .env ファイルから環境変数に設定するようにします。

Gradio から LangChain で LLM(GPT)を使うよう実装します。

チャットボットに過去のやりとりを踏まえて応答する機能を実装します。

PaaS(Render)を使って Web アプリケーションを公開する方法を学びます。

Web アプリケーションを動かすプラットフォームの基本や、PaaS の概要を学びます。

Web アプリケーションを公開する前に、大量アクセスに備えた対策として、Gradio の認証を設定します。

(追記)Render での Poetry のバージョンの指定について

Render を使って Web アプリケーションを公開します。

Render の無料のインスタンスタイプを使う場合の制約について説明します。

Web アプリケーションの実装・公開で実施したことと、そのために必要な知識を整理します。

LangChain の Indexes と Agent を組み合わせる方法を学びます。

このセクションで実装する機能について説明します。

(追記)「Index の実装」で発生する可能性のあるエラーについて

LangChain の Indexes を使い、プライベートな文書を検索して応答する機能を実装します。

(追記)Agent の JSONDecodeError について
(追記)Agent が Vector Store を検索する際に text-davinci-003 を使うことによるエラーについて

Vector Store を Agent のツールとして必要に応じて使うように実装を修正します。

このセクションで実装した内容をまとめます。

Bolt を使った Slack ボットの実装について学びます。

Slack ボットの仕組みについて、基本を学びます。

Slack ボットの実装のため、Slack App を作成し、トークンを用意します。

Bolt をインストールして、Slack ボットの Hello World を実施します。

Slack ボットが LangChain を使って LLM(GPT)を使うようにします。

Slack ボットに過去のやりとりを踏まえて応答する機能を実装します。

(追記)Slack から取得した履歴の reversed 処理について

Render に Slack ボットをデプロイして動かします。

このセクションのまとめとして、Slack ボットの実装で実施した内容や、そのために使った知識を整理します。

また、このコースの片付けについて説明します。

OpenAIのChat APIのFunction calling機能と、LangChainの関連機能を学びます。
このセクションで使用するソースコード

OpenAI の Chat API に追加された Function calling 機能の基本を学習します。

Function calling を LangChain で使う方法の基本として、OpenAI Functions Agent について学習します。

Function calling を応用した、文章からの属性の抽出やタグ付けについて学習します。

Function calling を応用した高度な Agent である OpenAI Multi Functions Agent について学習します。

プライベートな文書を検索して回答させる処理の解説資料を共有します。
(共有)プライベートな文書を検索して回答させる処理の解説資料
LangChain Expression Language (LCEL)について学びます。

LangChain の新しい実装スタイルである LangChain Expression Language(LCEL)の概要と実装例を学習します。

実際にアプリケーション開発で LangChain をどのように活用すべきかを解説します。

(追加)LCEL の解説資料
このコースを終えた後、さらにステップアップするための方向性を理解します。

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Provides a comprehensive overview of LLM (Large Language Models), their underlying technology, and their applications
Suitable for beginners interested in exploring LLM and its capabilities
Requires no prior knowledge of LLM or programming, making it accessible to a wide range of learners
Offers hands-on experience in building LLM-powered applications using LangChain
Provides a solid foundation for further exploration and development in the field of LLM
Covers both theoretical concepts and practical applications, offering a balanced learning experience

Save this course

Save LangChainによる大規模言語モデル(LLM)アプリケーション開発入門―GPTを使ったチャットボットの実装まで to your list so you can find it easily later:
Save

Activities

Coming soon We're preparing activities for LangChainによる大規模言語モデル(LLM)アプリケーション開発入門―GPTを使ったチャットボットの実装まで. These are activities you can do either before, during, or after a course.

Career center

Learners who complete LangChainによる大規模言語モデル(LLM)アプリケーション開発入門―GPTを使ったチャットボットの実装まで will develop knowledge and skills that may be useful to these careers:
Machine Learning Engineer
Machine Learning Engineers design, develop, and maintain machine learning systems. LangChain can help Machine Learning Engineers by providing a scalable and efficient platform for building and deploying machine learning models. This course will help you build a strong foundation in machine learning and LangChain, which will be essential for success in this field.
Data Scientist
Data Scientists use machine learning and other advanced analytical techniques to solve complex problems and extract meaningful insights from data. LangChain can help Data Scientists by providing an easy-to-use interface for developing and deploying machine learning models. This course will help you build a solid foundation in machine learning and LangChain, which will be essential for success in this field.
Software Engineer
Software Engineers design, develop, and maintain software systems. LangChain can help Software Engineers by providing a flexible and extensible platform for building and deploying software applications. This course will help you build a strong foundation in software engineering and LangChain, which will be essential for success in this field.
Data Analyst
Data Analysts collect, clean, and analyze data to identify trends and patterns. LangChain can help Data Analysts by providing a powerful tool for exploring and visualizing data. This course will help you build a strong foundation in data analysis and LangChain, which will be essential for success in this field.
Customer Success Manager
Customer Success Managers help customers get the most value from their products and services. LangChain can help Customer Success Managers by providing a powerful tool for tracking customer progress and identifying opportunities for improvement. This course will help you build a strong foundation in customer success management and LangChain, which will be essential for success in this field.
User Experience Designer
User Experience Designers design and evaluate the user experience of products and services. LangChain can help User Experience Designers by providing a powerful tool for gathering and analyzing user feedback. This course will help you build a strong foundation in user experience design and LangChain, which will be essential for success in this field.
Salesperson
Salespeople sell products and services to customers. LangChain can help Salespeople by providing a powerful tool for managing customer relationships. This course will help you build a strong foundation in sales and LangChain, which will be essential for success in this field.
Social Media Manager
Social Media Managers develop and execute social media campaigns to promote products and services. LangChain can help Social Media Managers by providing a powerful tool for creating and managing social media content. This course will help you build a strong foundation in social media marketing and LangChain, which will be essential for success in this field.
Content Strategist
Content Strategists develop and execute content strategies to achieve business goals. LangChain can help Content Strategists by providing a powerful tool for creating and managing content. This course will help you build a strong foundation in content strategy and LangChain, which will be essential for success in this field.
Marketer
Marketers develop and execute marketing campaigns to promote products and services. LangChain can help Marketers by providing a powerful tool for creating and managing marketing content. This course will help you build a strong foundation in marketing and LangChain, which will be essential for success in this field.
Technical Support Specialist
Technical Support Specialists provide technical support to customers. LangChain can help Technical Support Specialists by providing a powerful tool for troubleshooting customer problems. This course will help you build a strong foundation in technical support and LangChain, which will be essential for success in this field.
Community Manager
Community Managers build and manage online communities for products and services. LangChain can help Community Managers by providing a powerful tool for engaging with community members and managing community content. This course will help you build a strong foundation in community management and LangChain, which will be essential for success in this field.
Business Analyst
Business Analysts use data and analysis to solve business problems and improve decision-making. LangChain can help Business Analysts by providing a powerful tool for collecting and analyzing data. This course will help you build a strong foundation in business analysis and LangChain, which will be essential for success in this field.
Product Manager
Product Managers lead the development and launch of new products and features. LangChain can help Product Managers by providing a powerful tool for gathering and analyzing customer feedback. This course will help you build a strong foundation in product management and LangChain, which will be essential for success in this field.
Technical Writer
Technical Writers create documentation and other materials to explain complex technical concepts. LangChain can help Technical Writers by providing a powerful tool for generating clear and concise documentation. This course will help you build a strong foundation in technical writing and LangChain, which will be essential for success in this field.

Reading list

We've selected nine books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in LangChainによる大規模言語モデル(LLM)アプリケーション開発入門―GPTを使ったチャットボットの実装まで.
Provides a comprehensive overview of machine learning for dummies, covering the fundamentals of the technology and its applications in various domains. It valuable resource for anyone who wants to learn more about machine learning.
Provides a comprehensive overview of deep learning with Python, covering the fundamentals of the technology and its applications in various domains. It valuable resource for anyone who wants to learn more about deep learning with Python.
Provides a comprehensive overview of PyTorch for deep learning, covering the fundamentals of the technology and its applications in various domains. It valuable resource for anyone who wants to learn more about PyTorch for deep learning.
Provides a comprehensive overview of language models, including their history, development, and current applications. It valuable resource for anyone who wants to learn more about this rapidly evolving field.
Provides a comprehensive overview of machine learning with Python, covering the fundamentals of the technology and its applications in various domains. It valuable resource for anyone who wants to learn more about machine learning with Python.
Provides a comprehensive overview of natural language processing with Python, covering the fundamentals of the technology and its applications in various domains. It valuable resource for anyone who wants to learn more about NLP with Python.
Provides a practical guide to machine learning with Scikit-Learn, Keras, and TensorFlow, covering the fundamentals of the technology and its applications in various domains. It great resource for anyone who wants to learn how to use machine learning to create new products and services.
Classic introduction to deep learning, covering the fundamentals of the technology and its applications in various domains. It valuable resource for anyone who wants to learn more about deep learning.
Classic introduction to statistical learning, covering the fundamentals of the technology and its applications in various domains. It valuable resource for anyone who wants to learn more about statistical learning.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to LangChainによる大規模言語モデル(LLM)アプリケーション開発入門―GPTを使ったチャットボットの実装まで.
ChatGPTのAPIで5つのアプリを作ってみよう!JSON生成、属性抽出、独自文書Q&A、SQL生成、AIエージェ...
Most relevant
Google Sheets 日本語版
Most relevant
Google Drive 日本語版
Most relevant
Google Meet - 日本語版
Most relevant
通訳者が教える基本動詞116のイメージと声に出して学ぶ例文演習法Vol.3:動詞を使いこなせば英語を話すのが楽になる...
Most relevant
Google Slides 日本語版
Most relevant
How Google does Machine Learning 日本語版
Most relevant
TOEIC L&Rテスト・単語力強化で絶対攻略!1ヶ月で1000単語を楽しく暗記するタニケイ式ボキャビル
Most relevant
ChatGPT API入門-PythonによるAPI基本操作から、業務で使える実践的なChatGPT活用法を学ぼう
Most relevant
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser