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 🙏

© 2024 – Pkg Stats / Ryan Hefner

micro-agi-js

v1.0.2

Published

A library to create and manage OpenAI AGI Agents.

Downloads

18

Readme

🤖 Micro AGI

An advanced AI agent powered by OpenAI, designed to process and respond to messages using the OpenAI API. This agent is built to be flexible, efficient, and easy to integrate into various applications.

📜 Table of Contents

🌟 Features

  • Easy Integration: Designed to be easily integrated into any Node.js application.
  • Powered by OpenAI: Leverages the power of OpenAI's GPT models for advanced conversational capabilities.
  • Flexible Configuration: Comes with various configuration options to tailor the agent's behavior.
  • Error Handling: Robust error handling mechanisms for better reliability.

🎥 Demo (example/index.js)

As you can see the agent, to respond to the user's question, taps into the swapi service to retrieve the information and then uses the OpenAI API to generate the response. In particular there is no way to have a right response unless the agent is able to understand that it has to use different services more than once. You can see the inner working of the agent

asciicast

🔧 Installation

Install the package using npm:

npm install micro-agi-js

🚀 Usage

Here's a basic example of how to use the Micro AGI:

import { createAgent } from 'micro-agi-js';

const services = {
  // ... your services here ...
};

const options = {
  apiKey: process.env.OPENAI_API_KEY, // your OpenAI API key
  services, // your services
  model: 'gpt-4',
  temperature: 0,
  systemMessage: 'You are an intergalactic barman...',
  commandFunctions: [
    /* ... */
  ],
};

const agent = createAgent(options);

async function main() {
  const userMessage = 'Hello!';
  const response = await agent.processMessage(userMessage);
  console.log(response);
}

main();

🔍 API

createAgent(options)

Creates an AI agent instance.

  • options: Configuration options for the agent.
    • apiKey: Your OpenAI API key.
    • services: Your services.
    • systemMessage: (optional) The message to display when the agent starts.
    • commandFunctions: (optional) The command functions to use.
    • model: (optional) The OpenAI model to use.
    • temperature: (optional) The temperature to use for text generation.
    • isDebug: (optional) Whether to enable debug mode.

Returns an agent object with methods to process messages and retrieve messages.

agent.processMessage(userMessage)

Processes a user message and returns the agent's response.

  • userMessage: The message from the user.

agent.getMessages()

Retrieves the current messages from the conversation context.

🧠 LLM Agent Overview

An LLM (Large Language Model) Agent is an advanced AI entity designed for more than just text generation. It's built to engage in conversations, execute tasks, and demonstrate a level of autonomy, all powered by the OpenAI API.

🔑 Key Components

  1. Core LLM:

    • The foundational layer, a neural network trained on vast datasets, enabling the agent to understand and generate text. This is the primary engine of our Micro AGI.
  2. Prompting Mechanism:

    • The agent's behavior and expertise are defined by carefully crafted prompts. These prompts, as seen in the code, guide the agent's responses and actions, ensuring it aligns with desired objectives and contexts.
  3. Memory:

    • Our agent uses a dynamic context window, akin to short-term memory, ensuring continuity in ongoing conversations. This is evident in how the agent processes and responds to user messages, maintaining context throughout the conversation.
  4. Knowledge Base:

    • Beyond the inherent knowledge of the LLM, our agent can tap into broader expertise, making it versatile across various tasks and users. This is reflected in the agent's ability to understand and respond to diverse user queries effectively.
  5. Tool Integration:

    • The agent isn't limited to just language generation. As seen in the code, it can integrate with other services and tools, such as executing specific software operations, enhancing its capabilities.

Harness the power of the LLM Agent to elevate your applications, making them more interactive and intelligent.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.