[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-92580":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},92580,"learn-ai","starkyru\u002Flearn-ai","starkyru","Hands-on, project-based course in AI, LLMs, RAG, and agents — 24 modules in TypeScript + Python, provider-agnostic (OpenAI\u002FAnthropic\u002FOllama\u002FNVIDIA\u002FLMStudio).","",null,"Python",78,12,1,0,26,45.94,"MIT License",false,"main",true,[],"2026-07-22 04:02:06","# learn-ai — a hands-on course in LLMs, RAG, and agents\n\nA personal, project-based curriculum that takes you from a _vague_ sense of how\nAI apps work to building real ones: provider integration, embeddings, retrieval\n(RAG), and autonomous agents — in **both TypeScript and Python**.\n\nYou don't just read. Every module is code you run, break, and extend, with three\ndepth levels woven through:\n\n| Depth           | What it means                                                                          | Where              |\n| --------------- | -------------------------------------------------------------------------------------- | ------------------ |\n| 🟢 **App**      | Build something that works using the ecosystem.                                        | every module       |\n| 🟡 **Balanced** | Build the app _and_ implement one core piece by hand for intuition.                    | 01, 03, 04, 05, 07 |\n| 🔴 **Deep**     | Implement the machinery from scratch (tokenizer, attention, vector index, ReAct loop). | 01, 04, 06         |\n\nPick your lane per module, or do all three. The 🔴 deep tasks are optional but\nthey're where the real understanding lives.\n\n---\n\n## The map\n\n| #   | Module                                                                     | You'll build                                                                                       | Core ideas                                                      |\n| --- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |\n| 00  | [Setup & Providers](modules\u002F00-setup\u002F)                                     | \"Hello LLM\" across 6 providers                                                                     | API keys, the provider abstraction, OpenAI-compatible APIs      |\n| 01  | [LLM Fundamentals](modules\u002F01-fundamentals\u002F)                               | A BPE tokenizer, cosine similarity, a toy attention head, samplers                                 | tokens, embeddings, attention, sampling, what a \"model\" even is |\n| 02  | [LLM Integration](modules\u002F02-llm-integration\u002F)                             | Streaming chat, JSON\u002Fstructured output, tool calling, retries                                      | the request\u002Fresponse loop, function calling, cost & tokens      |\n| 03  | [Prompting & Patterns](modules\u002F03-prompting\u002F)                              | A prompt library + evaluator                                                                       | few-shot, chain-of-thought, self-consistency, prompt eval       |\n| 04  | [Embeddings & Vectors](modules\u002F04-embeddings-vectors\u002F)                     | An in-memory vector index from scratch, then Chroma\u002FQdrant                                         | embeddings, ANN search, chunking, hybrid (BM25 + dense) search  |\n| 05  | [RAG](modules\u002F05-rag\u002F)                                                     | A full retrieval-augmented Q&A pipeline + eval                                                     | chunk→embed→retrieve→rerank→generate, citations, faithfulness   |\n| 06  | [Agents](modules\u002F06-agents\u002F)                                               | A ReAct agent from scratch, then with LangGraph                                                    | tools, planning loops, memory, multi-agent                      |\n| 07  | [Advanced & Production](modules\u002F07-advanced-production\u002F)                   | Eval harness, tracing, caching, a served API                                                       | LLM-as-judge, observability, cost control, deployment           |\n| 08  | [Classification](modules\u002F08-classification\u002F)                               | A text classifier 3 ways + a softmax\u002FGD one from scratch                                           | LLM zero-shot vs embeddings+ML vs trained head, metrics (F1)    |\n| 09  | [Computer Vision](modules\u002F09-computer-vision\u002F)                             | Image classification, CLIP zero-shot, multimodal-LLM vision, a convolution from scratch            | pixels→features, CNN\u002FViT, CLIP, vision LLMs                     |\n| 10  | [Image Generation](modules\u002F10-image-generation\u002F)                           | Text-to-image (hosted Stable Diffusion), img2img\u002Finpainting, a toy diffusion sampler               | diffusion process, latent space, U-Net, guidance                |\n| 11  | [Document Ingestion](modules\u002F11-document-ingestion\u002F)                       | A real RAG ingestion pipeline (PDF\u002FHTML, cleaning, structure-aware chunking, incremental indexing) | the messy-data front-end RAG actually needs                     |\n| 12  | [Text-to-SQL](modules\u002F12-text-to-sql\u002F)                                     | NL→SQL over a real DB, with safety + hybrid routing                                                | querying structured data, schema grounding, SQL guardrails      |\n| 13  | [Fine-tuning](modules\u002F13-fine-tuning\u002F)                                     | Prompt vs RAG vs fine-tune; hosted SFT; LoRA from scratch; distillation                            | SFT, LoRA\u002FQLoRA, dataset prep, when to fine-tune                |\n| 14  | [Local Inference & Optimization](modules\u002F14-local-inference-optimization\u002F) | Quantization & throughput benchmarks, a KV cache from scratch, model routing\u002Ffallbacks             | quantization, KV cache, serving engines, load testing           |\n| 15  | [Reasoning & Test-time Compute](modules\u002F15-reasoning-test-time-compute\u002F)   | Reasoning vs standard models, self-consistency, best-of-N, self-refine                             | extended thinking, spending compute at inference                |\n| 16  | [Context Engineering](modules\u002F16-context-engineering\u002F)                     | Token budgeting, prompt caching, memory compaction, map-reduce, batch API                          | using the context window as a scarce budget                     |\n| 17  | [MCP & Modern Agent APIs](modules\u002F17-mcp\u002F)                                 | A course MCP server + an agent that uses it; Responses API                                         | Model Context Protocol, hosted tools, remote MCP                |\n| 18  | [Computer Use](modules\u002F18-computer-use\u002F)                                   | A browser agent (vision + DOM grounded) with safety gates                                          | computer-use models, automation, action allowlists              |\n| 19  | [Audio & Speech](modules\u002F19-audio-speech\u002F)                                 | STT, TTS, a voice tutor; VAD\u002Fdenoise; realtime                                                     | Whisper, TTS, voice agents, audio preprocessing                 |\n| 20  | [AI Security](modules\u002F20-ai-security\u002F)                                     | Attack then harden your own RAG agent; a red-team harness                                          | OWASP LLM Top 10, prompt injection, excessive agency            |\n| 21  | [LLMOps & Eval](modules\u002F21-llmops-eval\u002F)                                   | Versioned eval sets, a CI regression gate, monitoring, feedback loop                               | the eval lifecycle, regression gates, human review              |\n| 22  | [AI Product UX](modules\u002F22-ai-product-ux\u002F)                                 | A real mini app: streaming UI, citations drill-down, feedback, approval flow                       | trust, failure states, \"show sources\", human-in-the-loop        |\n| 23  | [Capstone](modules\u002F23-capstone\u002F)                                           | A RAG-powered agent app, end to end                                                                | everything above, integrated                                    |\n\n> **Deep dive — [`modules\u002F05b-advanced-rag\u002F`](modules\u002F05b-advanced-rag\u002F):** extends\n> module 05 with the named **advanced RAG architectures** (TS + Py): Contextual\n> Retrieval, Corrective RAG (CRAG), Self-RAG, and GraphRAG (multi-hop, from\n> scratch) — the feedback-loop and graph patterns that fix naive RAG's blind\n> spots. [`docs\u002FADVANCED_RAG.md`](docs\u002FADVANCED_RAG.md) is the reference +\n> pick-by-failure cheat-sheet.\n\n> **Deep dive — [`modules\u002F06b-langgraph\u002F`](modules\u002F06b-langgraph\u002F):** extends\n> module 06 with a full **LangGraph** lesson (TS + Py): state & reducers,\n> conditional edges\u002F`ToolNode`, persistence, human-in-the-loop `interrupt()`,\n> streaming, subgraphs, supervisor handoff, and time travel — the production\n> features interviewers ask about. [`docs\u002FLANGGRAPH.md`](docs\u002FLANGGRAPH.md) is the\n> reference + interview cheat-sheet.\n\n> **Foundations companions — [`modules\u002F01b-ml-foundations\u002F`](modules\u002F01b-ml-foundations\u002F),\n> [`modules\u002F01c-deep-learning\u002F`](modules\u002F01c-deep-learning\u002F),\n> [`modules\u002F01d-transformer\u002F`](modules\u002F01d-transformer\u002F),\n> [`modules\u002F01e-trees-ensembles\u002F`](modules\u002F01e-trees-ensembles\u002F),\n> [`modules\u002F01f-stats-foundations\u002F`](modules\u002F01f-stats-foundations\u002F):** extend module 01\n> with the classic-ML \u002F deep-learning \u002F transformer theory interviews probe — pure\n> from-scratch numpy + TS, no provider needed. **01b** covers regression, bias–variance,\n> ridge, cross-validation, ROC\u002FAUC, and k-means; **01c** builds a scalar autograd engine +\n> MLP, optimizers (SGD\u002FMomentum\u002FAdam), initialisation, regularisation, and an RNN with\n> BPTT; **01d** assembles a GPT-style decoder — multi-head attention with causal masking,\n> sinusoidal positional encoding, LayerNorm\u002FGELU\u002FFFN pre-LN blocks, a KV cache, and an\n> encoder-vs-decoder (BERT vs GPT) comparison, plus interview notes on RoPE, GQA\u002FMQA,\n> FlashAttention, MoE, and scaling laws; **01e** builds decision trees (CART), random\n> forests, gradient boosting, and an empirical bias–variance decomposition; **01f** covers\n> Bayes & naive Bayes, MLE (and why cross-entropy _is_ MLE), hypothesis testing \u002F A\u002FB\n> tests, and PCA from scratch.\n\n> **Deep dive — [`modules\u002F13b-alignment\u002F`](modules\u002F13b-alignment\u002F):** extends module 13\n> with **post-training & alignment** — the \"how is ChatGPT actually trained?\" interview\n> answer, built from scratch on toy models (TS + Py, fully offline): preference data +\n> Elo\u002Fwin rates, a Bradley–Terry reward model, RLHF with REINFORCE including a **reward\n> hacking** (Goodhart) demo with and without the KL leash, and **DPO** from scratch with\n> its derivation.\n\n> **Deep dive — [`modules\u002F06c-agent-frameworks\u002F`](modules\u002F06c-agent-frameworks\u002F):**\n> extends modules 06\u002F06b with the five framework names interviews drop —\n> **LangChain** (LCEL `prompt | model | parser`, buffer memory, retrievers\u002FRAG),\n> **CrewAI** (role → task → sequential crew), **AutoGen** (round-robin group chat),\n> **LlamaIndex** (Documents → index → query engine for RAG), and **Semantic Kernel**\n> (skills\u002Ffunctions + a planner) — each reimplemented through `llm_core` then mapped\n> back to the real library's API. Every task runs offline via a `--stub` deterministic model.\n\n> **Deep dive — [`modules\u002F06d-agent-memory\u002F`](modules\u002F06d-agent-memory\u002F):** extends\n> modules 06\u002F06b with **agent memory engineering** — the memory-augmented vs\n> memory-aware distinction and the full taxonomy (episodic, semantic, procedural,\n> entity, summary): the read-before \u002F write-after lifecycle, relevance thresholds\n> against noisy retrieval, entity extraction + merge, summary compaction with\n> just-in-time expansion, and a composed `MemoryManager` with TTL eviction that\n> keeps context under a token budget across turns. Offline via `--stub`, like 06c.\n\n**Hosted-first** (default to APIs, optional local heavy path documented): modules **09, 10** (vision\u002Fdiffusion), **13** (fine-tuning), **19** (audio). Nothing multi-GB downloads unless you opt in.\n\n**Lost in the acronyms?** Every abbreviation used in the course (BM25, RAG, HNSW, KV cache, LoRA, …) is expanded on first use in each lesson and collected in [`docs\u002FGLOSSARY.md`](docs\u002FGLOSSARY.md).\n\n**Applied projects** (in [`projects\u002F`](projects\u002F)):\n\n- [`projects\u002Fnews-agent`](projects\u002Fnews-agent\u002F) — a Telegram bot that an agent\n  drives to collect news on a topic you choose and post a daily digest. Build it\n  after module 06; it pulls together integration, agents, tools, and scheduling\n  into something you'll actually run. (`uv run python -m news_agent --dry-run` to\n  try it with no Telegram setup.)\n- [`projects\u002Ftutor`](projects\u002Ftutor\u002F) — your study buddy: a **Q&A mode** to ask\n  about the project and how to proceed, and an **exam mode** that quizzes you on a\n  module and grades you. Runs free on Ollama. Usable from day one. There are also\n  Claude Code slash commands `\u002Ftutor` and `\u002Fexam` if you're in Claude Code — see\n  [`docs\u002FTUTOR_AND_EXAM.md`](docs\u002FTUTOR_AND_EXAM.md).\n\nRead [`CURRICULUM.md`](CURRICULUM.md) for the detailed week-by-week plan,\nprerequisites, and \"you're done when…\" checklists.\n\n---\n\n## Repo layout\n\n```text\nlearn-ai\u002F\n├── packages\u002F\n│   ├── ts\u002Fllm-core\u002F        # provider-agnostic LLM client (TypeScript)\n│   └── py\u002Fllm_core\u002F        # the same, in Python\n├── modules\u002F\n│   ├── 00-setup\u002F … 23-capstone\u002F   # 24 modules\n│   │   ├── README.md       # the lesson + tasks + \"done when\" checklist\n│   │   ├── ts\u002F             # TypeScript exercises\n│   │   └── py\u002F             # Python exercises\n├── projects\u002F\n│   ├── news-agent\u002F         # the Telegram daily-news agent\n│   └── tutor\u002F              # Q&A + exam study CLI\n├── docs\u002F                   # TOOLING.md, TUTOR_AND_EXAM.md\n├── data\u002F                   # sample corpora for RAG exercises\n├── scripts\u002F                # helpers (smoke tests, etc.)\n└── .claude\u002Fcommands\u002F       # \u002Ftutor and \u002Fexam slash commands\n```\n\nThe two `llm-core` packages are the spine of the course: you write exercises\nagainst one small interface and swap OpenAI ↔ Claude ↔ Ollama ↔ LM Studio ↔\nNVIDIA ↔ Gemini by changing a single env var. Understanding _why_ that abstraction is possible (and\nwhere it leaks) is module 00–02.\n\n---\n\n## Setup (do this once)\n\n### 1. Clone & secrets\n\n```bash\ncp .env.example .env\n# edit .env — you only need keys for the providers you'll use.\n# Zero-cost path: install Ollama and leave LLM_PROVIDER=ollama.\n```\n\n### 2. Pick a free or paid path\n\n| Path                              | Cost                         | Setup                                                                                                                              |\n| --------------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |\n| **Ollama** (recommended to start) | free                         | [Install Ollama](https:\u002F\u002Follama.com), then `ollama pull llama3.2 && ollama pull nomic-embed-text`                                  |\n| **LM Studio**                     | free                         | [Install LM Studio](https:\u002F\u002Flmstudio.ai), load a model, Start Server (port 1234) → `LLM_PROVIDER=lmstudio` + `LMSTUDIO_CHAT_MODEL` |\n| **NVIDIA NIM**                    | free tier                    | get a key at [build.nvidia.com](https:\u002F\u002Fbuild.nvidia.com) → `NVIDIA_API_KEY` in `.env`                                             |\n| **Google Gemini**                 | free tier                    | key at [aistudio.google.com\u002Fapikey](https:\u002F\u002Faistudio.google.com\u002Fapikey) → `GEMINI_API_KEY` in `.env`, `LLM_PROVIDER=gemini`        |\n| **OpenAI**                        | paid (~$5 covers the course) | key at [platform.openai.com](https:\u002F\u002Fplatform.openai.com\u002Fapi-keys)                                                                 |\n| **Anthropic**                     | paid                         | key at [console.anthropic.com](https:\u002F\u002Fconsole.anthropic.com); set `ANTHROPIC_MODEL=claude-haiku-4-5` for cheap iteration          |\n\n### 3. Python\n\n```bash\n# uv (https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) manages the env + the editable llm_core install.\nuv sync\nuv run python scripts\u002Fsmoke_test.py        # verifies your provider works\n```\n\nSome modules need extras: `uv sync --extra` `vectors` (04, 05), `agents` (06),\n`production` (07, 22), `ml` (08), `vision` (09, local only), `imagegen` (10,\nlocal only), `ingest` (11), `mcp` (17), `browser` (18), `finetune` (13, local\nonly), `audio` (19, local only), `telegram` (news-agent). The `vision`,\n`imagegen`, `finetune`, and `audio` extras are optional — those modules default\nto hosted APIs.\n\n### 4. TypeScript\n\n```bash\npnpm install\npnpm build:core\npnpm --filter .\u002Fmodules\u002F00-setup\u002Fts dev      # or: cd modules\u002F00-setup\u002Fts && pnpm dev\n```\n\n---\n\n## How to work through it\n\n1. `cd modules\u002F00-setup` and read the `README.md`. Each module README is the\n   lesson — concepts first, then numbered tasks with acceptance criteria.\n2. Do the 🟢 app task to get something working, then circle back for 🟡\u002F🔴.\n3. Run the same exercise against two different providers and notice what changes.\n4. Don't skip module 01 even though it's the least \"useful\" — it's the load-bearing\n   intuition for everything after.\n\nSuggested pace: ~1 module\u002Fweek part-time. Modules 04→05→06 are the heart; budget\nextra time there.\n\n---\n\n## Conventions\n\n- Exercises that need a model use `getProvider()` \u002F `get_provider()` from\n  `llm-core`. Never hardcode a provider in exercise code.\n- Each task folder has its own short `README` \u002F docstring explaining _what_ and\n  _why_ — treat writing those notes as part of the exercise.\n- 🔴 \"from scratch\" tasks forbid the obvious library (no `tiktoken` for the\n  tokenizer task, no `chromadb` for the vector-index task) — that's the point.\n\n---\n\n## License\n\n[MIT](LICENSE) — use it, fork it, learn from it. Contributions welcome.\n","这是一个面向实践的AI学习课程项目，聚焦大语言模型（LLM）、检索增强生成（RAG）和智能体（Agents）的核心开发技能。项目包含24个模块，覆盖从基础原理（如Tokenizer、Attention实现）到工程应用（多厂商API集成、流式响应、结构化输出、向量检索、RAG系统构建）的完整技术栈，支持TypeScript与Python双语言，并兼容OpenAI、Anthropic、Ollama等主流模型提供商。所有内容以可运行、可调试、可扩展的代码项目为载体，按“应用层→平衡层→深度层”三级难度组织，适合希望系统掌握AI应用开发、理解底层机制并积累实战经验的开发者或工程师。",2,"2026-07-09 02:30:23","CREATED_QUERY"]