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

react-agent-ts

v0.0.6

Published

A TypeScript implementation of the ReAct agent logic from the paper ๐Ÿ“„ [ReAct: Synergizing Reasoning and Acting in Language Models](https://arxiv.org/abs/2210.03629).

Downloads

3

Readme

๐Ÿš€ Welcome to React-Agent-TS ๐Ÿค–

A TypeScript implementation of the ReAct agent logic from the paper ๐Ÿ“„ ReAct: Synergizing Reasoning and Acting in Language Models.

React-Agent-TS allows you to build a powerful ๐Ÿ’ช Chat Assistant that can interact with users, make use of handy tools ๐Ÿ› ๏ธ (e.g. search, memory retrieval), and have internal dialogues ๐Ÿง  to generate meaningful responses.

๐Ÿ—๏ธ Architecture

This amazing tool utilizes the Microsoft PromptEngine abstraction to model interactions. The Agent class models its thoughts as two parallel interactions: one with the user directly ๐Ÿ‘ฅ, and another internal monologue with itself for problem-solving ๐Ÿงฉ. This separation proves useful as it cuts down on complexity in the mental model when building higher-order systems.

Here's an example of the React Agent thought process:

Swimlanes Diagram

๐Ÿ”ฎ The Vision

The vision for this project is to produce a completely local agent architecture that utilizes the growing library of bot plugins ๐Ÿค– in the Wellknown.ai plugin repository. These agents, expert at a particular task, will be able to call into one another and perform complex behavior and automations ๐Ÿ”„ dynamically based on need.

Using the principles of factored cognition, we can realize a future where not only do you own your data, but your personal bot ๐Ÿค– safely and carefully takes care of the minutiae so you can do more ๐ŸŒŸ!

๐Ÿ›ฃ๏ธ The Roadmap

Here's a rough outline of the journey ahead. We'd love to hear your thoughts and ideas, and we invite you to contribute to the project in any way you're comfortable!

  1. API Wrapper Fiesta! ๐ŸŽ‰: We'll begin by developing our own API wrapper, which will serve as a bridge between GPT4ALL and chatbot UIs built for the OpenAI ChatCompletions API.

  2. The Local Chatbot Revolution ๐ŸŒ: Empower users to create local chatbots with little-to-no setup. Got ideas for simplifying the process? We're all ears ๐Ÿ‘‚!

  3. Have Plugin, Will Expand ๐Ÿ”Œ: Let's build a rich ecosystem of plugins to extend the functionality of the local chatbot. Got a great idea? Share it, build it, or join forces with like-minded developers to make it happen!

  4. UI: A Portal to the AI Realm ๐Ÿ–ฅ๏ธ: Together, we'll create or fork an elegant, user-friendly UI that can be customized and shipped with model binaries.

  5. Feedback: The Spice of AI Life ๐ŸŒถ๏ธ: Gather and use user feedback to continuously iterate on the UI and app features, turning our AI assistant into a masterpiece.

  6. The World Is Our Playground ๐ŸŒ: Envision and identify new platforms (mobile, web apps, browser plugins, etc.) to bring our creation to more users.

  7. Docs & Tutorials: Knowledge Unleashed ๐Ÿ“š: Develop comprehensive documentation and tutorials to guide users and developers on their path to AI mastery.

  8. Building Together: The Dev Community ๐Ÿ—๏ธ: Establish a thriving developer communityโ€”host events, workshops, contests and collaborate on open-source projects.

  9. Tap into the Matrix: Data & Services Integration ๐Ÿ”—: Let's help our AI interact with external data sources and services, enabling powerful automations and enhanced capabilities.

  10. Next Level Automations: Rise of the Machines ๐Ÿค–: Continuously innovate to unveil sophisticated features and automations, turning our AI assistant into a personal powerhouse.

  11. Fort Knox: Secure the AI Sanctuary ๐Ÿ”’: Create a robust security model to protect user data by adding end-to-end encryption and maintaining data sovereignty.

  12. Zoom, Zoom: SuperchargeAI ๐ŸŽ๏ธ: Regularly optimize our AI system's performance to keep it running smoothly and efficiently.

  13. Expand the Horizons: Sky's the Limit ๐ŸŒŒ: Continue building out new features and push the boundaries of our AI assistant, inching ever closer to our grand vision.

๐ŸŽ™๏ธ Speak Up, Join In!

Join us on the Github Discussions Board and let us know what you want to see!

๐Ÿ› ๏ธ Setup

Follow these steps to set up the project:

  1. Install Node.js and Yarn.

  2. Clone the project:

git clone https://github.com/Intuitive-Systems/react-agent-ts.git
cd react-agent-ts
  1. Set up .env files

The agent relies on .env.agent and the local retrieval plugin relies on .env.retrieval. Examples of each are in .env.agent.example and .env.retrieval.example respectively.

  1. Compile and run:
docker-compose up

๐Ÿ“š Usage

The agent is designed to be run as a service, via a graphql API.

Sending this query to localhost:3000:

query {
  reactMessage(userInput: "When was Michael Jackson born?")
}

Will result in an answer being returned:

{
  "data": {
    "addMessage": "The result of the expression 5/4^13+4(3-1) is approximately 8.000000074."
  }
}

๐Ÿ•ต๏ธโ€โ™‚๏ธ Tracing

React-Agent-TS library is instrumented with OpenTelemetry, allowing agents to be easily traced and debugged during development. With OpenTelemetry, you can observe and monitor the application's performance, identify and diagnose any issues, and gain valuable insights into the inner workings of the agent.

We have included a docker-compose setup that simplifies the process of launching and debugging the agent locally. This setup allows you to effortlessly collect, process, and export trace data to visualize and investigate the agent's behavior.

To get started, make sure you have Docker Compose installed, and then simply use the following command to spin up the entire stack:

docker-compose up

After running the stack, you can navigate to the OpenTelemetry UI at http://localhost:16686 to view the collected data, inspect the trace spans, and analyze the performance metrics.

By leveraging OpenTelemetry and our docker-compose setup, you can debug your ReAct agents both quickly and easily, ensuring a seamless development experience.

๐Ÿ“ TODOs

  • [ ]: flesh out the PluginTool such that it more dynamically deals with arbitrary plugins -- should probably be lifted into its own Engine / Agent abstraction (ex. PluginEnging or APIAgent)
  • [ ]: Build tracing tool which allows agent to introspect into traces and self-diagnose

About the Author ๐Ÿง‘โ€๐Ÿ’ป

react-agent-ts was created by Conner Swann, founder of Intuitive Systems. Conner is a passionate developer and advocate for democratizing AI models and frameworks, believing that access to powerful machine learning tookits should be available to everyone ๐ŸŒ. In the words of the modern sage, "When the AI tide rises, all boats should float" ๐Ÿšฃ.

You can find Conner on Twitter, sharing insights and occasional shenanigans ๐ŸŽญ at @YourBuddyConner. While he definitely enjoys being on the bandwagon for advancing AI ๐Ÿค–, he remains humbly committed to exploring and delivering state-of-the-art technology for everyone's benefit.