1. Day 1: Your App Works
You build your app with Gemini. A few lines, and it works.
from google import genai
client = genai.Client(api_key=...)
response = client.models.generate_content(model=..., contents=...)
print(response.text)
2. Day 30: "Switch to Groq"
It sounds like a small change. Look at what happens to the same lines:
B
Boss · Monday 10:42"Groq is faster and cheaper. Please switch by Friday."
Day 1 · GeminiDay 30 · Groq
import
from google import genai→from groq import Groqclient
genai.Client()→Groq()call
models.generate_content()→chat.completions.create()answer
response.text→response.choices[0].message.content4 lines, 4 changes
3. Day 60: "Now Try Mistral"
A month later, someone finds a model that is better for Hindi. So you do it again.
Day 1Geminibuilt
→rewrite
Day 30Groqrewrite #1
→rewrite
Day 60Mistralrewrite #2
→rewrite
Day 90???rewrite #3
Every move is a rewrite.
4. Now Imagine 50 Files
Your app does not call the model once. It calls it in many places.
50 functions that call the model. Every one must change.
Each one needs a new package, a new call and a new way to read the answer. Tests break. Small bugs appear in places you forgot about. And this happens every time you switch.
5. What We Need
We do not want to rewrite our code for every company. We want one way to call any model, where switching means changing only the name.
what we wish for
model = ???("gemini") # or "groq", or "mistral"
response = model.invoke("What is the capital of India?")
print(response.content)
Same lines for every company.
Only the name changes.
Only the name changes.
6. Then Someone Built This
GeminiGroqMistralOpenAIClaude
introducing
LangChain
One way to call any model.
That is LangChain. Next: what it is and how it works.