Ishx.dev 開發 L.A.T.E.,讓本地大語言模型使用實際工具
I built a small engine that gives local LLMs real tools
Ishx.dev 開發 L.A.T.E.(Local AI Tool Engine),一個 Node.js 專案,讓本地或 API 模型使用精確計算、網頁研究、檔案搜尋和持久記憶。
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.
I got tired of that, so I built L.A.T.E. (Local AI Tool Engine), a small Node.js project that gives a model a few real tools. The idea is simple: the tools do the exact work, and the model only writes the answer.
ikaushik817-art
/
local-ai-tool-engine
L.A.T.E. (Local AI Tool Engine): turn any local or API model into an AI assistant with real tools: exact math, web research, file search and memory. Works with Ollama, LM Studio, Groq and any OpenAI-compatible API. One-command setup.
L.A.T.E.
Local AI Tool Engine
Small Node.js toolkit that lets a model (local with Ollama or LM Studio, or an API like Groq) use real tools: exact math, web research, your files, memory, and anything you write yourself. No LangChain, no paid API needed, just two small dependencies.
Setup
You need Node.js 18 or newer (developed and tested on Node 22). Then, in the project folder:
npm start
That's it. The first time, it installs everything, looks for a model on your laptop, and asks how you want to connect:
- Ollama running? It picks it up and uses your model (or downloads a small one if you have none).
- LM Studio server running? It picks that up too.
- No local model / want a cloud one? Choose "API key", pick OpenAI, Groq, OpenRouter, Gemini (or any OpenAI-compatible URL), paste your key, done. It checks the key and lists models for…
What it does
- 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.
- Your files. Search inside a folder or read a text file.
- Dates. Exact date and time, and "how many days until X". Small models get this wrong a lot.
Setup is one command
npm start
The first time, it installs everything and looks for Ollama or LM Studio on your machine. If you'd rather use a cloud model, you can paste an API key (Groq, OpenRouter, OpenAI) and it checks the key for you. After that, npm start just opens the chat.
There's no LangChain and only two dependencies.
How it decides what to do
The obvious cases (a math question, a link, a file name, "remember this", "what time is it") go straight to the right tool, so there's no guessing. Small models are bad at picking tools on their own, so I didn't want to depend on that. For everything else, if you've added your own tools, the model picks one. It can use up to 5 tools per question and never runs the exact same call twice, so it can't get stuck in a loop.
Adding your own tool
ai.registerTool({
name: "coin_flip",
description: "Flips a coin and returns heads or tails.",
parameters: {},
execute: async () => (Math.random() < 0.5 ? "heads" : "tails")
});
console.log(await ai.chat("Flip a coin for me"));
You can add a new model provider the same way, in about 15 lines.
What I tested, and what I didn't
I ran it with Ollama (qwen2.5:3b and dolphin-mistral:latest) and with Groq. LM Studio, Jan, OpenRouter and other OpenAI-compatible servers should work.
Some honest limits:
- Search scrapes DuckDuckGo, so it can get rate-limited if you hammer it.
- Small models still make mistakes, even with the tools. The research tool is told to answer only from the pages, but a small model can still slip, so check anything important.
- No streaming, and it can't read PDFs yet.
What's next
I'm thinking PDF reading and a tool that can save files safely. If you try it and something breaks, or there's a tool you'd want, open an issue or tell me in the comments.
來源:DEV Community · dev.to


