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

mimir-ai

v0.1.10

Published

Agent Mimir is a command line chat client and "agent" manager for LLM's like Chat-GPT that provides the models with access to tooling and a framework with which accomplish multi-step tasks.

Downloads

13

Readme

Agent Mimir

Agent Mimir is a command line chat client and "agent" manager for LLM's like Chat-GPT that provides the models with access to tooling and a framework with which accomplish multi-step tasks.

It is very easy to configure your own agent with a custom personality or profession as well as enabling access to all tools that are compatible with LangchainJS. https://js.langchain.com/docs/modules/agents/tools/integrations/.

Agent Mimir is based on LangchainJS, every tool or LLM that works on Langchain should also work with Mimir. The prompts are currently tuned on GPT-4 and GPT-3.5 but other models might work.

The tasking system is based on Auto-GPT and BabyAGI where the agent needs to come up with a plan, iterate over its steps and review as it completes the task.

Usage

Requirements

You must have installed NodeJS version 18 or above.

Installation

  1. Clone this repository git clone https://github.com/Altaflux/agent-mimir
  2. Install the required packages npm install
  3. Copy the .env.example file to .env: cp .env.example .env.
  4. In the .env file set the your OpenAI key in AGENT_OPENAI_API_KEY and in AGENT_OPENAI_MODEL the model you want to use.
  5. Optionally, create a custom configuration file to use a custom agent.

How to use

To start the chat run the command npm run start It is important to tell the agent every time it has completed a task the phrase task complete. This will erease its task's memory. This is useful to keep the number of tokens small.

Customizing Agents

By default Mimir will create an agent with no tools and Chat GPT-3.5. You can configure a custom agent by creating a directory called mimir-config with the configuration file mimir-cfg.js, use mimir-config.example as a reference. By configuring an agent you can change its language model to any other model supported by LangchainJS


const ChatOpenAI = require('langchain/chat_models/openai').ChatOpenAI;
const WebBrowserToolKit = require('@agent-mimir/selenium-browser').WebBrowserToolKit;
const OpenAIEmbeddings = require('langchain/embeddings/openai').OpenAIEmbeddings;
const Serper = require('langchain/tools').Serper;

//Configure your language models, tools and embeddings
const taskModel = new ChatOpenAI({
    openAIApiKey: process.env.AGENT_OPENAI_API_KEY,
    temperature: 0.9,
});
const embeddings = new OpenAIEmbeddings({
    openAIApiKey: process.env.AGENT_OPENAI_API_KEY,
});
const chatModel = new ChatOpenAI({
    openAIApiKey: process.env.AGENT_OPENAI_API_KEY,
    temperature: 0.9,
    modelName: 'gpt-4'
});


const webToolKit = new WebBrowserToolKit({ browserConfig: { browserName: "chrome" } }, taskModel, embeddings);
module.exports = async function() {
    return {
        //If continuousMode is set to true the agent will not ask you before executing a tool. Disable at your own risk.
        continuousMode: false,
        agents: {
            'Assistant': { //The name of the agent
                mainAgent: true, //When using multiple agents, set one agent as the mainAgent for the chat.
                description: 'An assistant', //A description of the agent and how to talk to it.
                definition: {
                    chatModel: chatModel, //The main chat LLM used for conversation and memory.
                    agentType: 'plain-text-agent', //Use "plain-text-agent" for general LLM, you can use "openai-function-agent" if your chat model is gpt-4-0613 or gpt-3.5-turbo-0613 for improved reliability. 
                    summaryModel: taskModel, //The model used when summarizing conversations.
                    taskModel: taskModel, //The model used for brainstorming steps.
                    profession: 'an Assistant', //The profession assigned to the agent.
                    communicationWhitelist: ['MR_CHEF'], //The list of agents it is allowed to talk to.
                    chatHistory: {
                        maxChatHistoryWindow: 6, //Maximum size of the conversational chat before summarizing. 4 by default
                        maxTaskHistoryWindow: 6, //Maximum size of the task chat before summarizing. 4 by default
                    },
                    tools: [ //Tools available to the agent.
                        ...webToolKit.tools,
                        new Serper(process.env.SERPER_API_KEY)
                    ]
                }
            }
        }
    }
}

Additional Node Dependencies

If you would like to add additional nodejs dependencies to the project to use custom tools or LLMs you can create a package.json file inside the mimir-config directory. When Mimir starts it will install the dependencies automatically and make them available for your mimir-cfg.js configuration.

{
    "name": "agent-mimir-deps",
    "private": false,
    "scripts": {},
    "dependencies": {
        "my-tool": "1.3.0"
    }
}

Useful tools:

Take a look at LangchainJS documentation for how to use their tools: https://js.langchain.com/docs/modules/agents/tools/

Here is a list of useful and easy to install tools you can try:

Web Browser Plugin:

package.json

{
    "name": "agent-mimir-deps",
    "private": false,
    "scripts": {},
    "dependencies": {
        "@agent-mimir/selenium-browser": "*"
    }
}

mimir-cfg.js


    const WebBrowserToolKit = require('@agent-mimir/selenium-browser').WebBrowserToolKit;
    const model = new ChatOpenAI({
        openAIApiKey: process.env.OPENAI_API_KEY,
        temperature: 0.9,
    });
    const embeddings = new OpenAIEmbeddings({
        openAIApiKey: process.env.OPENAI_API_KEY,
    });

    const webToolKit = new WebBrowserToolKit({ browserConfig: { browserName: "chrome" } }, model, embeddings);

    //Add to agents tool:
    tools: [
            ...webToolKit.tools,
        ],

Search Plugin:

mimir-cfg.js

const Serper = require('langchain/tools').Serper;

//Add to agents tool:
    tools: [
            new Serper(process.env.SERPER_API_KEY) // https://serper.dev.
        ],

Calculator Plugin:

mimir-cfg.js

const Calculator = require('langchain/tools/calculator').Calculator;

//Add to agents tool:
    tools: [
            new Calculator()
        ],

Take a look at the tool-examples directory for other tools.

Agent communication

If you declare multiple agents in your configuration you can enable communication with each other. The agent may try to establish communication with another agent if it thinks it will help him complete a task.

You can enable communication be setting canCommunicateWithAgents to either true if you want the agent to be able to communicate with every other agent or pass an array of the names of the agents it is allowed to talk to (['Mr_Chef', 'Artist']).

Note: Even if continuous mode is set to false if an agent who is being talked to tries to use a tool it will not ask the user first. I need to rework how continuous mode is implemented.

Roadmap

  • Configurable memory types to allow persistent memory or different use cases.
  • Different prompts for different LLMs to improve compatibility.
  • Talk to multiple agents simultaneously.
  • Provide access to the chat in different forms like web or text to speech.