toolhub
v0.0.1
Published
🧰 A lightweight, pluggable function-calling toolkit for LLMs (OpenAI, Gemini, Claude)
Readme
Toolhub
🧰 A lightweight, pluggable function-calling toolkit for LLMs (OpenAI, Gemini, Claude)
Installation
# Install the core package
npm install toolhub// src/index.ts
import { ToolRegistry } from "toolhub";
import { OpenAIAdapter } from "toolhub/adapters";
import { climateDeclarations } from "toolhub/declarations/climate";
import { climateImplementations } from "toolhub/implementations/climate";
// 1. Create the registry and register climate (weather) tools
const registry = new ToolRegistry();
climateDeclarations.forEach((decl) => registry.register(decl));
registry.bindImplementations(climateImplementations);
// 2. Configure your OpenAI adapter
const adapter = new OpenAIAdapter({
apiKey: process.env.OPENAI_API_KEY!,
model: "gpt-4-0613",
});
// 3. Invoke the LLM, asking for weather
(async () => {
const userMessage = { role: "user", content: "What’s the current weather in New York City?" };
const response = await adapter.chatWithTools(
[userMessage],
registry.listDeclarations()
);
console.log("LLM Response:", response);
})();
