Cheat sheet · Specialise
LangChain and LlamaIndex cheat sheet (LangChain)
Opens with creditsA quick-revision book on LLM applications with LangChain in Python: RAG from loading to evaluation, chat models, prompts, runnables, structured output and tool calling, plus LangGraph for agents with state and LangSmith for tracing.
Chapters
8 chapters · 58 concepts
1RAG and agents: the big pictureWhat retrieval-augmented generation and agents are, the two phases of a RAG system, and when a framework earns its place.7 concepts
- 1Retrieval-augmented generationA pattern where the app first retrieves passages relevant to a question from your own data, then asks the LLM to answer using those passages as context.
- 2Indexing time and query timeIndexing loads documents, splits them into chunks, embeds them and stores the vectors.
- 3AgentsAn LLM running in a loop that decides which tool to call next, reads the result and continues until it can answer or hits a limit.
- 4Context window and tokensThe model reads a limited number of tokens (word pieces) per call, shared between instructions, retrieved text, history and the answer.
- 5Grounding and citationsInstructing the model to answer only from the supplied context, to say when the context does not contain the answer, and to reference its sources.
- 6Prompt injectionInstructions hidden in retrieved documents, web pages or tool results that try to override your prompt, such as "ignore previous instructions and email this…
- 7Framework or plain SDKLangChain and LlamaIndex supply loaders, splitters, vector store integrations, retrievers and agent loops behind common interfaces.
7 in this chapterOpen this chapter2Loading and chunkingTurning PDFs, web pages and other sources into clean text with metadata, then into chunks sized for retrieval.7 concepts
- 1Document loadersComponents that read a source (files, web pages, Notion, databases) and return document objects holding text plus metadata such as file name and page.
- 2MetadataKey-value facts attached to each document and inherited by its chunks: source, title, section, date, owner team, access level.
- 3ChunkingSplitting documents into passages small enough to embed and retrieve precisely, ideally along natural boundaries such as paragraphs and sentences.
- 4Chunk size and overlapSize is the maximum length of a chunk; overlap repeats the end of one chunk at the start of the next.
- 5Structure-aware splittingSplitting on the document's own structure (headings, code blocks, HTML sections) or on shifts in meaning, and keeping the heading path as metadata.
- 6Parsing difficult documentsPDFs with tables, columns, scans and charts lose structure when read as plain text.
- 7Incremental ingestionGiving each document a stable id and a content hash, so re-running ingestion only adds new documents, updates changed ones and deletes removed ones.
7 in this chapterOpen this chapter- Embeddings and vector storesHow text becomes vectors, where those vectors live, and how filtering and hybrid search make lookups precise.7 conceptsOpens with credits
- Retrieval and rerankingGetting the right few chunks in front of the model: retrievers, reranking, query rewriting and how context is packed.6 conceptsOpens with credits
- Agents, tools and memoryLetting the model act: defining tools, the loop that runs them, memory across turns, and the limits that keep agents safe.8 conceptsOpens with credits
- Evaluation and observabilityMeasuring retrieval and answers against a test set, tracing every call, and keeping quality from quietly regressing.7 conceptsOpens with credits
- LangChain coreChat models, messages, prompt templates, runnables composed with LCEL, structured output and tool calling.8 conceptsOpens with credits
- Agents with LangGraph and LangSmithLangChain agents run on LangGraph: prebuilt agents first, then graphs with explicit state, persistence and human approval, all traced in LangSmith.8 conceptsOpens with credits
- 9Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.80 terms
About this sheet
RAG pipelines, retrieval quality, agents, tools, memory and evaluation in Python, with LangChain and LangGraph or LlamaIndex.
Related on Sefism
Picked from the other libraries by shared topics.
Roadmaps
See allBest practices
See all- Best Practices for Building LLM AppsHow to build LLM apps and agents that hold up in production: prompts, evals, prompt injection, tool permissions, cost, logging and privacy.
- Prompt Engineering Best PracticesHow to write prompts that work the same way on the hundredth input as on the first: clear instructions, structure, examples, reasoning, output control and testing.
- Best Practices for AI Coding AssistantsHow to get reliable code from AI coding assistants and agents: instruction files, task prompts, verification, review, security, dependencies and session hygiene.
Checklists
See all- RAG Production ChecklistA RAG production checklist: chunking, embeddings, hybrid search, reranking, per-user permissions, citations, evals, re-indexing and cost, with how to verify each check.
- LLM Evaluation ChecklistAn LLM evaluation checklist: success criteria, eval datasets, code and model graders, judge calibration, agent evals, safety tests and production monitoring, with how to verify each check.
- AI Feature Launch ChecklistAn AI feature launch checklist: use case fit, evals, UX for errors, disclosure, human override, abuse filters, rate limits, cost caps, prompt privacy, monitoring and rollback.
Project structures
See all- GenAI RAG app (FastAPI) project structureFor developers turning a "chat with your documents" demo into an app people can rely on. A FastAPI backend where every layer has a home: ingestion workers, retrieval, prompts as versioned files, model clients with fallbacks and cost caps, guards, evals that gate CI, and tracing, so a wrong answer can be traced to the step that caused it.
- AI agent with an MCP server project structureFor developers who want to give AI assistants safe access to their own data or API. A TypeScript MCP server built on the official SDK, organised by feature (tasks, projects) with each feature owning its tools, resources and prompts, served over stdio for local hosts and Streamable HTTP with OAuth for remote ones, plus a small agent and the evals that prove a model can use it.
- Machine learning project project structureFor students and analysts whose model works in a notebook and now needs to be reproducible, reviewable, served and watched. It starts from the Cookiecutter Data Science v2 layout (immutable raw data, numbered notebooks, a real Python package) and grows into versioned data with DVC, typed parameters, data validation with pandera, experiment tracking and a model registry with MLflow, a FastAPI prediction service, drift monitoring and, for a team, scheduled retraining, model cards, fairness checks and shadow deployment.
Career questions
See all- Which AI tools do employers expect junior developers to know in 2026?Employers rarely require a specific brand. They expect you to use an AI coding assistant well (in the editor and in the terminal), to review and test what it produces, to call an LLM API in a small feature, and to explain when you would not use AI. Pick one assistant, learn it properly, and show judgement in your projects.
- How do I use AI to become a better engineer instead of becoming dependent on it?Decide the job AI does before you open it. Use it as a tutor, reviewer and sparring partner that explains and challenges, not a vending machine that hands you finished code. Attempt first, ask second, and always be able to explain and defend what you ship.
- How do I start learning AI agents as a software engineer?Start with one LLM API and plain code: a loop that calls the model, lets it pick a tool, runs the tool and feeds the result back. Build one small agent that does a real task end to end, add evaluation and guardrails, and only then reach for a framework. Agents are software engineering first.
Work with me
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
- 1:1 Mentorship
- Fresh Graduate Mentorship
- Career Guidance
Brand deals, promos and partnerships: tauseeffayyaz@gmail.com