1.0.4 • Published 4 months ago

@gopluto_ai/llm-tools-orchestration v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

šŸ› ļø @gopluto_ai/llm-tools-orchestration

Scalable LLM tool orchestration SDK with memory hooks, parallel Multi function execution, and GPT-4o (or any model) planning — built for production AI agents. Alternative of MCP for AI or LLM Parallel multi tool calling which is easy to understand.


šŸš€ Features

  • āœ… Register tools with full JSON schema
  • 🧠 Pre/post tool memory lifecycle hooks
  • šŸ” Plans tools dynamically using OpenAI /v1/responses API (āš ļø not chat completion)
  • šŸ› ļø Parallel tool execution with context-rich synthesis
  • šŸ”„ ESM + CommonJS ready for Node.js and serverless
  • šŸ”Œ Works with any GPT model (gpt-4o, gpt-4-turbo, etc.) — dynamic model control

šŸ“¦ Installation

npm install @gopluto_ai/llm-tools-orchestration
Set in .env
OPENAI_API_KEY = xxxxxxxxxxxx

⚔ Quick Example

import {
  registerTool,
  planTools,
  executeParallelTools,
  synthesizeFinalReply,
  registerHookProcessor
} from "@gopluto_ai/llm-tools-orchestration";
import { getOpenAIResData } from "@gopluto_ai/llm-tools-orchestration/dist/openaiHelpers";

registerHookProcessor("logStart", async (memory) => {
  console.log("🧠 Memory:", memory);
  return memory;
});

registerTool({
  type: "function",
  name: "get_stock_price",
  description: "Returns dummy stock price",
  parameters: {
    type: "object",
    required: ["ticker", "currency"],
    properties: {
      ticker: { type: "string" },
      currency: { type: "string" }
    }
  },
  preHooks: ["logStart"],
  handler: async ({ ticker, currency }) => {
    return { ticker, currency, price: 999.99 };
  }
});

const messages = {
  sysprompt: "You are a stock price assistant.",
  userMessage: "What's the price of TSLA in USD?",
  conversationHistory: [],
  agentMemory: {},
  imageUrl:'',
  fileUrl:''
};

(async () => {
  const plan = await planTools(messages, getOpenAIResData, "gpt-4o");
  const results = await executeParallelTools(plan.neededTools, plan.args, { userId: "xyz" });
  const reply = await synthesizeFinalReply(messages.userMessage, results, messages, plan.tools, getOpenAIResData, "gpt-4o");

  console.log("🧠 Final AI Reply:", reply);
})();

šŸ“ Structure

src/
ā”œā”€ā”€ index.ts                  # Entry point
ā”œā”€ā”€ toolOrchestrator.ts       # Tool registration + planning
ā”œā”€ā”€ openaiHelpers.ts          # Handles OpenAI /v1/responses payloads
examples/
└── index.js                  # CLI-ready use case

šŸ”’ This SDK Uses OpenAI's /v1/responses Endpoint

Unlike typical chat/completions, this SDK uses the new /v1/responses API to support multi-modal inputs (text, file, image) and tool usage natively.

This gives you:

  • Context-rich messages (system + memory)
  • Native tool calling structure
  • Easy agent memory injection
  • Full control over function outputs

šŸ¤ Contributing

  1. Clone this repo
  2. Run npm install && npm run build
  3. Edit tools in src/toolOrchestrator.ts
  4. Submit PRs!

Contact

 Email: shubham@e2ecapital.com
 Contact: +91 9110035665
 Whatsapp: https://wa.me/919110035665

šŸ“ License

MIT Ā© GoPluto.ai