Step 1: Connect to NVIDIA NIM
What you're building: an AI Research Librarian
In the next 8 steps, you'll build your own AI research librarian — an agent that can search a corpus of machine-learning papers, read abstracts, compare methods, and reason over them to answer questions like:
- "Which paper introduced LoRA, and how does QLoRA improve on it?"
- "Compare the key ideas of FlashAttention and PagedAttention."
- "What year was ReAct published, and what's its main contribution?"
You'll start simple (one NIM call, no tools), then layer on tool calling, the ReAct loop, custom graphs, YAML-driven configuration, and automated evaluation. By step 8 you'll have a working librarian you can chat with directly.
What is NVIDIA NIM?
NVIDIA NIM (NVIDIA Inference Microservices) packages AI models as optimized, containerized microservices. Instead of loading a model onto a GPU yourself, you call a NIM endpoint — just like calling a REST API.
NIM exposes an OpenAI-compatible API, so any tool built for the OpenAI SDK works out of the box. We use ChatNVIDIA from LangChain — a drop-in replacement for ChatOpenAI that points at a NIM endpoint.
How it works
Your code -> ChatNVIDIA(base_url, model) -> NIM endpoint -> GPU inference -> Response
Key parameters:
base_url— where NIM lives (this lab uses an in-cluster proxy athttp://nim-proxy.labs.svc:8080/v1)model— which model to call (e.g.nvidia/nemotron-3-super-120b-a12b)temperature— randomness (0 = deterministic, 1 = creative)
The question that motivates the rest of the lab
response = llm.invoke(
"Which paper introduced LoRA, and what was its rank-decomposition insight?"
)
print(response.content)
Run this. Watch what happens: the LLM either hallucinates an answer that sounds right, or hedges because its training data is stale. Either way, the answer isn't trustworthy on its own. That's why this lab exists. You're going to give the model tools that let it actually look things up — and then it stops guessing.
Your task
- Import
ChatNVIDIAfromlangchain_nvidia_ai_endpoints. - Create an LLM instance pointing at the NIM proxy with
temperature=0. - Invoke it with the LoRA question above (or any research question you care about — this is your librarian, after all).
- Print the response.
main.py, the file you edit16 lines
# Step 1: Connect to NVIDIA NIM
# TODO: Import ChatNVIDIA from langchain_nvidia_ai_endpoints
# TODO: Create an LLM instance
# - base_url: "http://nim-proxy.labs.svc:8080/v1"
# - model: "nvidia/nemotron-3-super-120b-a12b"
# - temperature: 0
llm = ______
# TODO: Invoke the LLM with a research question
# (Use the LoRA prompt below, or swap in your own — this is your librarian)
response = ______
print(f"Response: {response.content}")
print(f"Model: {response.response_metadata.get('model_name', 'unknown')}")