Skip to content

Swarms for Javascript, the future of AI, where we leverage the power of autonomous agents to create 'swarms' of Language Models (LLM) that work together, creating a dynamic and interactive AI system.

License

Notifications You must be signed in to change notification settings

The-Swarm-Corporation/swarms-js

Repository files navigation

Swarms

Swarms is a package that allows you to integrate various AI agents from platforms like OpenAI, Langchain, and others to work together as a team and automate tasks. With Swarms, you can create powerful AI teams that can handle complex tasks with ease.

Features


  • Integration with Multiple AI Platforms: Swarms allows you to integrate AI agents from various platforms like OpenAI, Langchain, and others. This gives you the flexibility to choose the best AI agents for your tasks.

  • Teamwork: With Swarms, AI agents can work together as a team. This allows for more efficient and effective task automation.

  • Easy to Use: Swarms is designed to be easy to use. You can get your AI team up and running in no time.

Install


To install Swarms, you can use any of the following:

npm install swarms-js

yarn add swarms-js

pnpm add swarms-js

Usage


Here is a basic example of how to use Swarms:

const { ChatOpenAI, HumanMessage, SystemMessage } = require('@langchain/openai');
const ConcurrentSwarm = require('swarms');

// Initialize the chat model
const chatModel = new ChatOpenAI({
  openAIApiKey: "your-openai-api-key",
});

// Create a swarm with a maximum of 10 concurrent threads
const swarm = new ConcurrentSwarm(10);

// Define the OpenAI logic as a function
async function openAiLogic() {
  const messages = [
    new SystemMessage("You're a helpful assistant"),
    new HumanMessage("Create the code for a snake game in python"),
  ];

  const response = await chatModel.invoke(messages);
  console.log(response);
}

// Add 40 agents to the swarm
for (let i = 0; i < 40; i++) {
  swarm.addAgent(openAiLogic);
}

// Perform the task
swarm.performTask();

Please refer to our API documentation for more detailed usage instructions.

Contributing


We welcome contributions from the community. If you would like to contribute, please check out our contributing guidelines.

Support


If you need help with Swarms, you can reach out to us on our support page.

License


Swarms is licensed under the MIT License.

Join the Swarms community and start automating tasks with your AI team today!

About

Swarms for Javascript, the future of AI, where we leverage the power of autonomous agents to create 'swarms' of Language Models (LLM) that work together, creating a dynamic and interactive AI system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published