npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rhyizm/ai-enbod

v0.1.7

Published

Multi-Assistant AI Communication Framework.

Readme

npm version AGPL-3.0 License

AI Enbod

AI Enbod is an API wrapper / AI Embodi Framework designed to simplify the usage of the OpenAI Assistant API (Beta). This framework provides automated handling of Run and Thread management, as well as Function Calling (tool invocation). The framework abstracts synchronous function calling for multiple functions and workflows that involve invoking functions and assistants, enabling AI specialized in different tasks to work collaboratively. This allows for the realization of more complex workflows with simple implementations. It maps functions implemented by the user on the server side to functions registered in Function Calling, handling the execution of functions and returning results to OpenAI. Confidential arguments or those obtained server-side can be configured using the argumentMap feature.

AI Enbodは、OpenAI Assistant API(ベータ版)の使用を簡素化するために設計された API wrapper / AI Embodi Framework です。このフレームワークは、RunやThreadの管理、さらにFunction Calling(ツール呼び出し)の自動処理を提供します。 このフレームワークは、複数の関数を同期的に呼び出すFunction Callingと、関数やアシスタントを呼び出すワークフローを抽象化しており、異なるタスクに特化したAIが連携して動作できるようにします。これにより、シンプルな実装でより複雑なワークフローを実現することが可能になります。 サーバーサイドでユーザーが実装した関数をFunction Callingに登録された関数とマッピングし、関数の実行結果をOpenAI APIへ返却します。非公開にしたい引数やサーバーサイドで取得する引数は、argumentMap機能を使用して設定することができます。

Table of Contents


Features

1. Abstraction of Complex Flows in the OpenAI Beta API

In OpenAI Beta, very complex interactions are required, such as creating threads, generating Runs, and making tool calls when the status becomes requires_action.
AI Enbod abstracts these flows with classes and methods, so that chat and tool calls can be completed with simple method calls.

2. Automatic Handling of Function Calling (Tool Calling)

Implementing the function calling feature proposed by OpenAI on your own can lead to cumbersome code involving mapping functions, formatting arguments, and returning results.
AI Enbod uses mechanisms called functionMap and argumentMap to register "function name → implementation function", and if instructed by the assistant, it automatically executes the corresponding function and returns the result to OpenAI.
Arguments that you want to set in advance on the server side (such as user IDs) can be set with argumentMap.

3. Workflow for Calling Multiple Assistants

It supports not only a single assistant but also flows that link assistants together.
You can call assistants with other assistantIds as needed, allowing AI specialized in different tasks to collaborate, enabling the implementation of advanced scenarios where multiple AIs work together.


Operating Environment

  • Node.js v18 or higher
  • Any of npm / yarn / pnpm
  • TypeScript 4.0 or higher recommended

Note: To use OpenAI Beta features, you need an environment that can access the latest beta version of OpenAI's API and an API Key.


Installation

Below is an example using npm. Any preferred package manager is also fine.


npm install @rhyizm/AI Enbod

Usage

Below is sample code that chats with an assistant using AI Enbod.


import { Assistant } from '@rhyizm/ai-enbod';
import functionMap from "../src/functionMap";
import getAuthorInfo from "./getAuthorInfo";

// Set your API key in the environment variable
// No need to explicitly set the API key here if you have already set it in the environment variable

// Set your assistant ID in the environment variable
const assistantId = process.env.ASSISTANT_ID;

// Register your function to the functionMap if you want to use it in the chat
const myFunctionMap = {
  ...functionMap,
  getAuthorInfo
};

const assistant = new Assistant({
  assistantId: assistantId,
  functionMap: myFunctionMap,
  argumentMap: {
    getAuthorInfo: {
      name: "rhyizm"
    }
  },
});

const response = await assistant.chat({
  userMessage: "Tell me about your author",
});

console.log(response.assistant.message.text);
// => "My author is rhyizm. He is a software engineer."

Call Another Assistant

By registering the callAssistant function in the Assistant of the OpenAI Assistant API, you can call other Assistants. As needed, the callAssistant function can be used to call other Assistants, allowing the conversation to continue.

Below is an example definition of the callAssistant function.


{
  "name": "callAssistant",
  "description": "{'Your Role':'Depending on the content of the conversation, an appropriate assistant will be called upon to continue the conversation.','Assistants':[{'Name':'Translator','Role':'Translates into English','ID':'asst_HjpL3IVhC4UxM2ydiAVSBL6T'}]}",
  "strict": false,
  "parameters": {
    "type": "object",
    "properties": {
      "assistantId": {
        "type": "string",
        "description": "Assistant ID to be called."
      }
    },
    "required": [
      "assistantId"
    ]
  }
}

License

AGPL-3.0