I built a small engine that gives local LLMs real tools
Description and use
L.A.T.E. is a lightweight Node.js engine that equips local LLMs with precise math, sourced web research, persistent memory, and file access, reducing hallucinations and improving reliability.
Problem
Small local LLMs struggle with basic tasks such as math, memory, and web research, often producing incorrect or fabricated answers.
Outcome
L.A.T.E. enables local LLMs to perform accurate calculations, conduct web research with sources, maintain memory across sessions, and access local files, improving reliability without external paid services.
Workflow
- Install Node.js 18+ and run
npm startto set up the engine. - The engine detects local Ollama or LM Studio instances or prompts for an API key for cloud providers.
- The user interacts via chat; the engine routes specific queries (math, web, file, memory, date) to the appropriate tool.
- The model receives tool outputs and crafts the final answer.
- The engine prevents repeated tool calls and limits to five tools per question.
- Custom tools can be registered with
ai.registerTooland new providers added in ~15 lines of code.
Evidence
Small local models are good at chatting and bad at the basics. They get math wrong, they forget everything between chats, and when they don't know something they make it up.
The idea is simple: the tools do the exact work, and the model only writes the answer.
Exact math. The calculator does the maths, not the model. Divide by zero gives a proper error.
Research with sources. It searches, opens the top few pages, picks the part that matches your question, and answers only from what it read, with links.
Memory that survives a restart. Tell it what you're working on, close it, open it again, it still knows.
The first time, it installs everything and looks for a model on your laptop, and asks how you want to connect: ...
Search scrapes DuckDuckGo, so it can get rate-limited if you hammer it.
- Record date: 2026-11-02T06:13:52.227Z