langchain-performance-tuning
Installation
SKILL.md
LangChain Performance Tuning
Overview
Optimize LangChain apps for production: measure baseline latency, implement caching, batch with concurrency control, stream for perceived speed, optimize prompts for fewer tokens, and select the right model for each task.
Step 1: Benchmark Baseline
async function benchmark(
chain: { invoke: (input: any) => Promise<any> },
input: any,
iterations = 5,
) {
const times: number[] = [];