Build a custom RAG AI agent in TypeScript and Jupyter
A local agentic RAG pipeline built in TypeScript inside a Deno Jupyter notebook, using LangChain and LangGraph with Ollama models. Deno blog posts are loaded with Cheerio, split into 500-character chunks, embedded with mxbai-embed-large and stored in an in-memory vector store exposed as a retriever tool. A LangGraph state graph wires an agent node (Llama 3.2 3B, the only small local model the author got tool calling working with) to retrieval, a binary relevance grader, query rewriting and final answer generation with DeepSeek R1 8B. The setup suits confidential documents that must not leave the machine.
Related posts
- Local RAG with Ollama, Mistral, and Turso
Turso mediumAdeptA local retrieval-augmented generation pipeline can be built in TypeScript using Ollama's Mistral model for both embeddings and generation, with libSQL storing documents and 4096-dimension F32_BLOB vectors in a single SQLite file indexed via libsql_vector_idx. Similarity search uses vector_distance_cos in a SQL query, and the top matches are injected as context into a prompt for Ollama's chat API. The setup runs fully offline with no extensions to install, and can be pointed at a Turso URL with embedded replicas to sync vectors across devices.
- The Dino 🦕, the Llama 🦙, and the Whale 🐋
Deno mediumAdeptDeno's built-in Jupyter kernel, Ollama and LangChain.js combine into a low-friction environment for experimenting with a locally hosted DeepSeek R1 8B model in TypeScript. The walkthrough covers pulling the model with Ollama, creating a Deno-kernel notebook in VSCode, and building a LangChain RunnableSequence that pairs a prompt template with a zod-backed StructuredOutputParser so responses come back as validated JSON. It also renders the chain as a Mermaid diagram inside the notebook. Most of the setup effort goes into running the model locally, and the same chain could point at a hosted API like OpenAI or Anthropic instead.
- Making (Very) Small LLMs Smarter
Docker mediumAdeptA 3B-parameter local model (Qwen2.5-Coder-3B, Q4_K_M) can become a useful coding assistant for an unfamiliar, recent Go library (Nova) when it is given a small, focused RAG context. Markdown snippet sections are embedded with EmbeddingGemma and stored in an in-memory vector store. Each query retrieves at most 3 snippets above a cosine-similarity threshold of 0.45. Because small models degrade as context grows, conversation history is capped at 2 messages. The agent is built in Node.js with LangchainJS and runs via Docker Model Runner and Docker Compose's models section, with low temperature and a presence penalty to keep output focused.
- Banque des Territoires (CDC Group) x Polyconseil x Hugging Face: Enhancing a Major French Environmental Program with a Sovereign Data Solution
Hugging Face easyNoviceBanque des Territoires, Polyconseil and Hugging Face built a sovereign RAG application that drafts sourced email replies for the EduRénov school-renovation program from its internal documentation. Agents edit and validate the drafts, and that feedback is collected for future fine-tuning and RLHF. The system is a modular monolith in hexagonal architecture, with the LLM, embedding model and retrieval method swappable through configuration. LLM calls are offloaded to Hugging Face Text Generation Inference on GPUs at SecNumCloud-qualified NumSpot, currently running Mistral-7B-Instruct-v0.3, with CroissantLLM under evaluation and RAGAS used for evaluation.
- Custom Hacker News summaries in your inbox—build an AI Agent with Inngest and Render
Render mediumAdept
A tutorial for building an AI agent that periodically searches Hacker News for user-defined topics and questions and emails summaries. The stack has three parts on Render: PostgreSQL with pgvector, using an HNSW index over OpenAI ada-002 embeddings; a Playwright-based indexer cron job that scrapes Algolia HN Search; and a Next.js app hosting the UI and the workflow. Inngest orchestrates the workflow steps with retries. Its AgentKit library defines a tool-using Search Agent (search and identify-trends, using a cosine distance threshold under 0.3 and per-day aggregation) and a Summarizer Agent, linked by shared network state and custom routing.