Git Product home page Git Product logo

chippr-agi's Introduction

Chippr-agi

GitHub release (latest by date including pre-releases) License Discord Twitter URL

Chippr-AGI is an open-source event-driven ECS framework that uses AI models to automate task creation and prioritization. This system is designed to run solo or as a swarm of containers. It combines the power of LLM with actor-critic reinforcement learning to optimize the order and allocation of tasks for a given objective.

5/9 - https://docs.chipprbots.com/ is live, needs work

This repo is under active development, clone often or use the latest docker image

Getting Started

Simple Demo

  • Clone the repository: git clone https://github.com/chippr-robotics/chippr-agi.git
  • Install the dependencies: yarn
  • Update your API keys docker-compose configuration located in ./docker/docker-compose.yml
  • Update the OBJECTIVE in ./examples/simple_demo.js
  • Start redis (you can use docker-compose for this)
  • Start the application: yarn demo
  • Monitor the vector DB at http://localhost:8001

Customize

Add systems and components to meet your needs then yarn start

Docker( Easy )

Pull the Image

First, pull the Chippr-AGI Docker image from Docker Hub:

docker pull chipprbots/chippr-agi:latest

Run the Container

To run the Chippr-AGI container, you'll need to set up environment variables for your OpenAI API key and Redis credentials. Create a .env file by copying .env.example

Replace CHIPPRAGI_LANGUAGE_MODEL_API_KEY, CHIPPRAGI_VECTORDB_HOST, CHIPPRAGI_VECTORDB_PORT, and with your actual values.

Now, run the container with the following command:

docker run -d --name chippr-agi --env-file .env  chipprbots/chippr-agi:latest

This will start the Chippr-AGI container in detached mode and load the environment variables from the .env file.

Docker-compose (Best)

Update the docker-compose.yml

Add the value for CHIPPRAGI_LANGUAGE_MODEL_API_KEY to the docker-compose.yml located in ./docker

Create the Vector-DB and CHIPPRAGI services

docker-compose up

Basic Flow

Chippr-AGI uses a combination of GPT-4 for generating task descriptions and actor-critic reinforcement learning to prioritize the tasks based on their estimated rewards. The framework is built using Node.js and Redis to store embeddings for quick query and update.

Tasks are generated based on the current context and objective, which are passed into a customizable prompt template. The prompts are stored in a JSON file and can be easily edited to fit specific needs. Once a task is generated, its dependencies are added to the task list and prioritized based on their estimated reward.

After a task is completed, the system checks if any new tasks need to be generated based on the success of the previous task. The process is repeated until all tasks are completed and the objective is achieved.

System Flow

graph TD
    A(User) -- objective --> B(EntityCreationSystem)
    C -- tasks, parent --> B
    B -- parent --> C(TaskParentSystem)
    B -- entity --> D(System Selection System)
    D -- systemselected --> F(task creator)
    D -- systemselected --> G(image creator)
    D -- systemselected --> H(internet Search)
    D -- systemselected --> I(task expander)
    F -- tasks --> B
    G -- taskCompleted --> J(The Judge)
    H -- taskCompleted --> J
    I -- taskCompleted --> J
    J --> K[task completed]
    K -- yes --> L(TaskCompletionSystem_TBD)
    K -- no --> D
Loading

In this flowchart:

  1. The objective is provided to the system by a user (see examples/simple-demo)
  2. Tasks are stored as entities with associated components.
  3. An event is emitted to addSystemSelection to the task, which is handled by the System Selection system.
  4. We add a component to each entity mapping it to its parent objective
  5. An event is emitted to addSystemSelected the task, which is handled by the system selection system.
  6. The system selection system evaulates which loaded systems can best complete the task
  7. An event is emitted identifying which system will process the task
  8. The task is executed based on the relevant components.
  9. The result of the task is stored, and the task is marked as done.
  10. The system checks if the objective is complete.
  11. If the objective is not complete, an event is emitted to generate new tasks, which is handled by the Task Generation system.

ECS events

The ChipprAGI class emits an event using the EventEmitter. The EventEmitter distributes the event to all registered systems. Each system handles the event if it's relevant to that system. The system performs its specific action based on the event and updates the relevant components. This diagram shows a high-level overview of how events are propagated through the ChipprAGI system and how systems handle and react to events.

graph TD
  A(ChipprAGI) -->|Emit event| B(EventEmitter)
  B -->|Distribute event| C(System 1)
  B -->|Distribute event| D(System 2)
  B -->|Distribute event| E(System N)
  C -->|Handle event| F(Perform System 1 specific action)
  D -->|Handle event| G(Perform System 2 specific action)
  E -->|Handle event| H(Perform System N specific action)
  F --> I(Update relevant components)
  G --> J(Update relevant components)
  H --> K(Update relevant components)

Loading

Contributing

We welcome contributions from the community. If you'd like to contribute to Chippr-AGI, please fork the repository and submit a pull request. We recommend discussing your ideas with the community in the issues section before starting any major work.

License

This project is licensed under the APACHE-2.0 License. See the LICENSE file for more details.

chippr-agi's People

Contributors

cody-burns avatar dependabot[bot] avatar realcodywburns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chippr-agi's Issues

orbitdb

add support for orbitdb for full stack distributed app

  • design interface
  • add option to vectordb
  • set as default
  • design tests
  • create test data
  • smoketest
  • e2e
  • document

docs are not rendering right

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

rate limit open ai calls

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Im frustrated when i hit the limit because multiple systems are calling the lang model.

Describe the solution you'd like
A clear and concise description of what you want to happen.

add a new config option for rate limit. should be open ai default

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

considered not doing this. or usimg some random delay per call

Additional context
Add any other context or screenshots about the feature request here.

add reminder system

create a basic system for 'reminder'
it will call entities with the component and evaluate if it ia time to run again. If now() is after the reminder time, emit a system message wwith the entity id and system name

  • should start as a 'set interval'
  • poll the 'get entity list by component' function
  • then get component for each entity
  • emit messages as needed

it should store an array [
it should store a unix time stamp for when it will run next
it should have a systemName that is stored
]

  • design component schema
  • create test data
  • test on db types
  • e2e
  • document

version info on boot

When the system is loaded it should

  • show the version of code,
  • systems loaded
  • what the defaults are set to

This display should be capable of turning off and on with a CHIPPAGI_CORE_QUIET_BOOT=1 in the env

logging package

add an optional logging system with winston

it should

  • have an environmental flag for log level
  • have flag for where the logs go
  • add log files to ignore files

move messages to right channels

Event messages should use either
update to receive information about entities getting compinents added or updated
remove to remove a component
etc

  • validate message buss
  • design tests
  • creat test data
  • smoke test
  • e2e
  • document

add idle hands system

when loaded,
this system should read a list of 25 not done entities
it should trace the parent tree
task priority is set by tree height
preference to longest trees
send the highest priority task to ssd

  • design system
  • create idlehands
  • smoke test
  • e2e on all db
  • documentation

webpack

Add webpack to reduce package size

  • add to npm dev
  • add config file

Judge system

Judge system is the 4th big primary system,

system loader - manages loading and unloading systems & components

Task Generator - takes a single entity desctiption and returns a list of tasks

System selector - given a task and a list of available systems, it picks the best one

( * Various task execution systems *)

The Judge - evaluates if a execution system has returned something that completes a given task

It should subscribe to the 'SYSTEM' topic and monitor for messages with 'taskCompleted' in the data
using the entityID, It should get the task description,

  • check if the task is marked complete already
  • get the ['TaskResponse'] component for the entityID
  • pull the file from ..... somewhere (long term memory)
  • get the prompt for task completion
  • Send the data from the file , task, and prompt
  • Return true or false

If it is true (the response completed the task)

  • set the complete/done flag on the description

If it is False (the response didnt complet the task)

  • remove the response component by sending a message in the 'REMOVE' channel to the entity id and sending system
  • send a signal to the system selection system to pick the task up again

build noop better

Add all stubs to noop.js so it can be imported to vector-db, languagemodel, and message bus

docker image bug

Describe the bug
docker container latest is not the latest. fix the build pipeline for package

To Reproduce
Steps to reproduce the behavior:

  1. cd docker
  2. docker-compose up
  3. errors

Expected behavior
A clear and concise description of what you expected to happen.
docker compose should pull chipprbots/chippr-agi:latest and run w/o errors

Additional context
Add any other context about the problem here.
need to update build pipelines in monorepo.

ipfs message bus

Use ipfs pubsub module as bus

  • design interface
  • enable pubsub on ipfs
  • creat pubsub test file
  • smokecheck
  • e2e
  • docs

add a repeat component

create a basic component for 'repeat'

it should store a unix time stamp for the time the task last ran
it should have a value for how long the interval is between repeats
it should have a nonce counter
it should have a value for type
it should have a value for step <nonce step is -1 or 1>

type linear the interval between values is fixed
type exponential increases the interval exponentially each nonce
type fixed - repeats a fixed number of times, step is -1 nonce is set on init or fail

  • design component schema
  • create test data
  • test on db types
  • e2e
  • document

move env to config index

everything needs to load or config to defaults when class is loaded

  • determine core systems
  • add each default to config.json or something
  • test

add ipfs pubsub

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
no

Describe the solution you'd like
A clear and concise description of what you want to happen.

i want to use ipfs pubsub as a message bus

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.
this jailbreaks the comms

add build flags to readme

add documentation for the env flags and how they are used

  • core
  • language model
  • message bus
  • vectordb

Add support for qdrant

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
reliance on one db is a single point of failure

Describe the solution you'd like
A clear and concise description of what you want to happen.

add support for qdrant as an option for vector-db

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
null
Additional context
Add any other context or screenshots about the feature request here.
https://github.com/qdrant/qdrant

multi model support

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Add openai, huggingface, and ai21 basic interaces.

Describe the solution you'd like
A clear and concise description of what you want to happen.
update lang model and env to support sever model types and manage the output

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
not doing this was considered, seemed lame

Additional context
Add any other context or screenshots about the feature request here.

add support for configured api service foe openapi and hugging face. support chat and completion mvp

  • smoke check of split files with env
  • create test payloads
  • test query
  • test completion
  • test chat

clean up dot envs

all variables should come from CHIPPRAGI.something

  • create a env for any core system variables
  • remove all import dot env
  • test

add drop entity

add a function to chippragi for drop entity

it should take an entity id
it should check the entity exists
it should check for a 'immortal' component
it should emit 'remove' with entity id

immortal component has no properties, it just exists

npm logo image

image is not making it to npm, may be in docs or something

multi module support

add support for configured api service foe openapi and hugging face. support chat and completion mvp

  • smoke check of split files with env
  • create test payloads
  • test query
  • test completion
  • test chat

ipfs support system

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
maybe, I need to store larger files and a db is not the place to do this

Describe the solution you'd like
A clear and concise description of what you want to happen.
add the ability to store and retreive files from IPFS using a data componet with a cid

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
db storage- not scaleable
cloud storage- difficult to coordinate
local storage- not scaleable

Additional context
Add any other context or screenshots about the feature request here.
I am already running an ipfs node so i can use it for testing, will need to add to docker compose maybe

add storage component

systems should use the core ips system to store attachments

it should have an array
[
{
stringfor cid,
string for creating system
time stamp for creation
},
...
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.