Building LLM Applications With Prompt Engineering is an open-source, hands-on NVIDIA Deep Learning Institute workshop. Learners use the OpenAI-compatible NVIDIA API and LangChain to build prompt-driven applications, structured-output pipelines, tools, and agents.
In these labs, learners will:
- Call OpenAI-compatible NVIDIA model endpoints from Python
- Stream and batch model requests
- Design reusable prompts and LangChain Expression Language chains
- Work with system, human, and AI messages
- Apply few-shot, chain-of-thought, and iterative prompting techniques
- Generate and validate structured output with Pydantic
- Create tools and agents that incorporate external information
| # | Module | Starting notebook |
|---|---|---|
| 00 | Workshop introduction | Workshop-Intro.ipynb |
| 01 | Introduction to prompting | 10-Section-Introduction.ipynb |
| 02 | LCEL, runnables, and chains | 20-Section-Introduction.ipynb |
| 03 | Prompting with messages | 30-Section-Introduction.ipynb |
| 04 | Structured output | 40-Section-Introduction.ipynb |
| 05 | Tools and agents | 50-Section-Introduction.ipynb |
| 06 | Workshop conclusion | 60-Conclusion.ipynb |
The companion course slide deck is included with the course materials.
The course can run on NVIDIA Brev, in Docker, or in a local Python environment. A local GPU is not required because the notebooks call hosted OpenAI-compatible NVIDIA model endpoints.
By default, this course uses an NVIDIA API key from build.nvidia.com. NVIDIA provides free hosted API endpoints for prototyping; responses may be slow, or the service may be temporarily unavailable. As notebooks do not require a local GPU, learners can use an eligible CPU-only Brev instance where available. Access is subject to applicable service terms, limits, and availability. For more information, please see Sections 2 and 7 of the NVIDIA Technology Access Terms of Use
The course does not accept an API key through the Dockerfile, Docker environment, command line, or filesystem. Each API-backed notebook contains a normal setup cell that prompts for the key and keeps it only in that notebook kernel's memory. Because notebooks normally use separate kernels, expect to paste the key again when starting another notebook.
The runtime defaults NVIDIA_BASE_URL to
https://integrate.api.nvidia.com/v1. The notebooks can also use another
OpenAI-compatible endpoint that provides the required models.
You can adapt the notebooks to a hosted or self-hosted OpenAI-compatible chat completion endpoint. Review its access requirements, service terms, data handling, quotas, and any charges before using it. Switching endpoints is a manual configuration choice; the course does not switch automatically.
In each API-backed notebook you want to run against another endpoint:
- Set
os.environ["NVIDIA_BASE_URL"]to the endpoint's documented API base URL before the cell that readsbase_url. Include the API version path where required (often/v1), rather than a website URL or the full/chat/completionsrequest URL. - Change the
modelvalue, or themodel=argument in a direct API call, to the exact model identifier accepted by that endpoint. Identifiers can differ in spelling and capitalization even for the same model. The course uses Nemotron 3.5 Lightning; choose that model if available, or alternatives with the capabilities needed by each exercise. Different models can produce different results. - Enter credentials for the selected endpoint in the notebook's API-key
prompt. The existing code stores the key in
NVIDIA_API_KEYfor the course client, even when the endpoint is elsewhere. If a key is already present in the kernel, restart the kernel and rerun the setup cells to replace it. Never put a key in notebook source or commit it to the repository. - Rerun the client-creation cells after changing the configuration. Existing
clientandllmobjects retain their earlier settings. Configuration in one notebook is not automatically shared with another notebook's kernel.
OpenAI compatibility does not guarantee that every exercise works unchanged. Check the following when adapting or troubleshooting a notebook:
- Client compatibility: The notebooks use the
OpenAISDK and LangChain'sChatNVIDIAintegration. An endpoint may require a different LangChain integration, authentication mechanism, or headers; changing the URL alone may not be sufficient. A different integration may also require additional dependencies. - Request parameters: Check supported token-limit parameters, temperature
ranges, and reasoning controls. In particular, the course's
chat_template_kwargsandenable_thinkingsettings are not universal. Review parameters passed throughextra_bodyormodel_kwargsif requests are rejected. - Exercise capabilities: Confirm streaming, structured output, tool calling, and tool-choice controls are supported where used. A successful basic chat request does not establish support for these features. Context and output-token limits can also differ.
- Access and connectivity: Authentication or permission errors can mean
the key lacks access to the selected model. Not-found errors can indicate
an incorrect base URL or model identifier. Rate-limit errors, timeouts, and
service errors require checking the endpoint's limits and availability.
The endpoint must be reachable from the machine running the notebook;
localhoston Brev refers to the Brev instance, not your own computer.
Begin with a short chat request, then test the features required by the notebook before running the complete exercise. Consult the endpoint's API documentation for its supported behavior and error meanings.
🌟 Launch this course on NVIDIA Brev
- Click the Launch on Brev link above (or the badge at the top of this README).
- Sign in or create a free NVIDIA Brev account.
- Keep the default CPU instance. The course does not require a GPU.
- Click Deploy. Python, course dependencies, and the default notebook kernel are configured automatically. Allow several minutes for setup to finish; JupyterLab may become accessible before installation is complete.
- Open JupyterLab from the Brev console. The workshop introduction opens
automatically. If needed, navigate to
course_content/tutorials/Workshop-Intro.ipynb, then follow the modules in order.
Do not provide your NVIDIA API key as a Brev launch parameter. Enter it only when prompted by an API-backed notebook.
Docker provides the most reproducible option for a workstation or an on-premises system. From the repository root, run:
cd course_content
docker build -t oss-pe .
docker run --rm -it -p 8888:8888 oss-peOpen http://localhost:8888 and begin with Workshop-Intro.ipynb.
Python 3.12 is recommended. From the repository root, create a virtual environment and install the course dependencies.
On Linux or macOS:
cd course_content
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r environment/requirements.txt
jupyter lab tutorialsOn Windows PowerShell:
Set-Location course_content
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r environment/requirements.txt
jupyter lab tutorialsOpen http://localhost:8888 if JupyterLab does not open automatically.
The notebooks can use a compatible self-hosted endpoint that provides the
models referenced by the course. Set NVIDIA_BASE_URL before starting
JupyterLab, or pass it to the Docker container. Do not put an API key in the
command.
For Docker:
docker run --rm -it -p 8888:8888 \
-e NVIDIA_BASE_URL="https://your-endpoint.example.com/v1" \
oss-peFor a local Linux or macOS environment:
export NVIDIA_BASE_URL="https://your-endpoint.example.com/v1"
jupyter lab tutorialsFor Windows PowerShell:
$env:NVIDIA_BASE_URL = "https://your-endpoint.example.com/v1"
jupyter lab tutorials11-Nvidia-NIM.ipynb explains how to generate an NVIDIA API key, and the first
key setup cell appears in 12-Hello-OpenAI.ipynb.
The repository is organized as follows:
course_content/Dockerfiledefines the shared CPU notebook runtime.course_content/environmentcontains dependencies and startup logic.course_content/tutorialscontains the ordered notebook modules, helpers, and instructional images.LICENSES,REUSE.toml, andTHIRD_PARTY_NOTICES.mdcontain licensing metadata.
Run these lightweight checks from the repository root:
bash -n course_content/environment/entrypoint.sh
find course_content/tutorials -name '*.ipynb' -print0 | xargs -0 -n1 jq empty
git status --ignored --shortA complete functional test requires a valid API key and network access because the notebooks intentionally call hosted models and, in one exercise, the Open-Meteo API.
See CONTRIBUTING.md. Keep notebook outputs cleared and never commit API credentials or generated responses.
This repository uses a mixed licensing model:
- Source-code files and code cells in Jupyter notebooks: Apache License 2.0
- Documentation, Markdown and raw notebook cells, and NVIDIA-created
educational media except proprietary assets identified in
REUSE.toml: Creative Commons Attribution 4.0 International - Third-party material: its original license, as documented in THIRD_PARTY_NOTICES.md
Each complete Jupyter notebook is dual-licensed: code cells under Apache-2.0 and non-code cells under CC-BY-4.0. The combined dual-license terms are in LICENSES/CC-BY-4.0-Apache2_Dual_License.txt.
The NVIDIA images at
course_content/tutorials/1-Intro-to-Prompting/images/build.nvidia.png and
course_content/tutorials/images/nvidia.png are proprietary, are not licensed
under CC BY 4.0, and remain all rights reserved. See
LICENSES/LicenseRef-NVIDIA-Proprietary.txt.
NVIDIA names, logos, and trademarks are not licensed for general reuse.