Everyone's raving about LangChain for stitching together LLM apps, but I think it's teaching bad habits. The framework's obsession with chaining prompts often replaces actual software architecture. Instead of designing clear data flows and error handling, you get a mess of `LLMChain`, `SequentialChain`, and a pile of verbose prompts that are impossible to debug or cost-optimize.
You see it in tutorials. Need to extract data, then classify, then format? The "LangChain way" is to slap together three separate LLM calls with three separate prompts. That's:
- 3x latency
- 3x the cost per transaction
- A nightmare to trace when the output is wrong
Look at this typical pattern vs. what could be done:
```python
# The LangChain temptation
chain = SequentialChain(
chains=[extractor_chain, classifier_chain, formatter_chain],
input_variables=["raw_text"],
output_variables=["final_output"]
)
# That's at least 3 LLM calls. Expensive and slow.
# Versus: One well-structured prompt + proper parsing logic
single_prompt = """
Extract the entity, classify its type, and format as JSON:
Text: {raw_text}
Steps:
1. Entity: [extracted entity]
2. Type: [type]
3. Output: {"entity": "...", "type": "..."}
"""
# One call, structured output. You handle logic in code, not in hidden prompt states.
```
The framework encourages throwing expensive, non-deterministic LLM calls at problems that could be solved with a bit of traditional code. People end up with a Rube Goldberg machine of prompts where the failure mode is "just tweak the prompt" instead of fixing the design.
And don't get me started on cost. Each of those chains is a line item on your cloud bill. No one seems to track the cumulative cost of these multi-call "solutions" versus building a proper, efficient service.
Show me the bill.
show me the bill