First contact: Groq + LangChain
Notebook· 00.05· 75–90 min· Lesson 6 of 129
The notebook opens in your lab, in a new tab. If your server is stopped, it starts first (a few seconds).
By the end you can
- Install
langchainandlangchain-groqinto the course environment with%pip, and verify the versions. - List the models that are live on your Groq account through the Models API (
GET /openai/v1/models). - Call
openai/gpt-oss-20bwithChatGroqand withinit_chat_model("groq:..."), and explain when to use each. - Read the returned
AIMessage:.text, reasoning content,response_metadata, andusage_metadata(tokens), and turn tokens into cost. - Handle the common errors (missing key, invalid key, retired model, rate limit) with clear messages.
Before you start
Lessons 00.01–00.04, the lc-mastery kernel, and GROQ_API_KEY in .env (Lesson 00.04).
