Course Overview
With the incredible capabilities of large language models (LLMs), enterprises are eager to integrate them into their products and internal applications for a wide variety of use cases, including (but not limited to) text generation, large-scale document analysis, and chatbot assistants.
The fastest way to begin leveraging LLMs for diverse tasks is by using modern prompt engineering techniques. These techniques are also foundational for more advanced LLM-based methods such as Retrieval-Augmented Generation (RAG) and Parameter-Efficient Fine-Tuning (PEFT). In this workshop, learners will work with an NVIDIA language model NIM, powered by the open-source Llama-3.1 large language model, alongside the popular LangChain library. The workshop will provide a foundational skill set for building a range of LLM-based applications using prompt engineering.
Prerequisites
This course is primarily intended for intermediate level and above Python developers with a solid understanding of LLM fundamentals.
Course Objectives
By the end of the workshop, you will:
- Understand how to apply iterative prompt engineering best practices to create LLM-based applications for various language-related tasks.
- Be proficient in using LangChain to organize and compose LLM workflows.
- Write application code to harness LLMs for generative tasks, document analysis, chatbot applications, and more.
Outline: Building LLM Applications with Prompt Engineering (BLAPE)
Course Introduction
- Orient to the main worshop topics, schedule and prerequisites.
- Learn why prompt engineering is core to interacting with Large Languange Models (LLMs).
- Discuss how prompt engineering can be used to develop many classes of LLM-based applications.
- Learn about NVIDIA LLM NIM, used to deploy the Llama 3.1 LLM used in the workshop.
Introduction to Prompting
- Get familiar with the workshop environment.
- Create and view responses from your first prompts using the OpenAI API, and LangChain.
- Learn how to stream LLM responses, and send LLMs prompts in batches, comparing differences in performance.
- Begin practicing the process of iterative prompt development.
- Create and use your first prompt templates.
- Do a mini project where to perform a combination of analysis and generative tasks on a batch of inputs.
LangChain Expression Language (LCEL), Runnables, and Chains
- Learn about LangChain runnables, and the ability to compose them into chains using LangChain Expression Language (LCEL).
- Write custom functions and convert them into runnables that can be included in LangChain chains.
- Compose multiple LCEL chains into a single larger application chain.
- Exploit opportunities for parallel work by composing parallel LCEL chains.
- Do a mini project where to perform a combination of analysis and generative tasks on a batch of inputs using LCEL and parallel execution.
Prompting With Messages
- Learn about two of the core chat message types, human and AI messages, and how to use them explictly in application code.
- Provide chat models with instructive examples by way of a technique called few-shot prompting.
- Work explicitly with the system message, which will allow you to define an overarching persona and role for your chat models.
- Use chain-of-thought prompting to augment your LLMs ability to perform tasks requiring complex reasoning.
- Manage messages to retain conversation history and enable chatbot functionality.
- Do a mini-project where you build a simple yet flexible chatbot application capable of assuming a variety of roles.
Structured Output
- Explore some basic methods for using LLMs to generate structured data in batch for downstream use.
- Generate structured output through a combination of Pydantic classes and LangChain's `JsonOutputParser`.
- Learn how to extract data and tag it as you specify out of long form text.
- Do a mini-project where you use structured data generation techniques to perform data extraction and document tagging on an unstructured text document.
Tool Use and Agents
- Create LLM-external functionality called tools, and make your LLM aware of their availability for use.
- Create an agent capable of reasoning about when tool use is appropriate, and integrating the result of tool use into its responses.
- Do a mini-project where you create an LLM agent capable of utilizing external API calls to augment its responses with real-time data.
Final Review
- Review key learnings and answer questions.
- Earn a certificate of competency for the workshop.
- Complete the workshop survey.
- Get recommendations for the next steps to take in your learning journey.