Giter Club home page Giter Club logo

spark's Introduction

AI Spark: an LLM-powered autonomous agent platform

A framework for autonomous agents who can work together to accomplish tasks using LocalAI.

Setup

You will need at least Node 10.

Download or clone this repository, then install dependencies: yarn or npm install.

Rename the .env.template file at the root of the project to .env and add your secrets to it:

# the following are needed for the agent to be able to search the web:
GOOGLE_SEARCH_ENGINE_ID=... # create a custom search engine at https://cse.google.com/cse/all
GOOGLE_API_KEY=... # obtain from https://console.cloud.google.com/apis/credentials
AGENT_DELAY=... # optionally, a delay in milliseconds following every agent action
MODEL=... # any Llama.cpp LLM model
SERVER=... # optionally, a server to connect to (default http://localhost:8080)

You'll also need to enable the Google Custom Search API for your Google Cloud account, e.g. https://console.cloud.google.com/apis/library/customsearch.googleapis.com

Running

Start the program:

yarn dev [# of agents]

or:

npm run dev [# of agents]

Interact with the agents through the console. Anything you type will be sent as a message to all agents currently.

Action errors

After spinning up a new agent, you will often see them make some mistakes which generate errors:

  • Trying to use an action before they've asked for help on it to know what its parameters are
  • Trying to just use a raw text response instead of a correctly-formatted action (or raw text wrapping a code block which contains a valid action)
  • Trying to use a multi-line parameter value without wrapping it in the multiline delimiter (% ff9d7713-0bb0-40d4-823c-5a66de48761b)

This is a normal period of adjustment as they learn to operate themselves. They generally will learn from these mistakes and recover, although agents sometimes devolve into endless error loops and can't figure out what the problem is. It's highly advised to never leave an agent unattended.

Agent state

Each agent stores its state under the .store directory. Agent 1, for example, has

.store/1/memory
.store/1/goals
.store/1/notes

You can simply delete any of these things, or the whole agent folder (or the whole .store) to selectively wipe whatever state you want between runs. Otherwise, agents will pick up where you left off on restart.

A nice aspect of this is that when you want to debug a problem you ran into with a particular agent, you can delete the events in their memory subsequent to the point where the problem occurred, make changes to the code, and restart them to effectively replay that moment until you've fixed the bug. You can also ask an agent to implement a feature, and once they've done so you can restart, tell them that you've loaded the feature, and ask them to try it out.

Code based on ai-legion.

spark's People

Contributors

cedriking 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

Watchers

 avatar  avatar  avatar

spark's Issues

Error 426

When I try to use this after following setup instructions I get the error below I have tried different models in case that might be the issue made sure the server is up but alas

PS E:\ai\spark> npm run dev 1

[email protected] dev
ts-node -r dotenv/config src/main.ts 1

Number of agents: 1
Model: ggml-gpt4all-j-v1.3-groovy
$ E:\ai\spark\src\services\ChatGPT.ts:64
throw new Error(statusCode.toString());
^
Error: 426
at ChatGPT.getModels (E:\ai\spark\src\services\ChatGPT.ts:64:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async E:\ai\spark\src\parameters.ts:12:18

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.