https://github.com/the-swarm-corporation/swarms-js
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.
https://github.com/the-swarm-corporation/swarms-js
Last synced: 2 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/the-swarm-corporation/swarms-js
- Owner: The-Swarm-Corporation
- License: mit
- Created: 2023-07-04T04:36:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T19:46:09.000Z (11 months ago)
- Last Synced: 2024-11-17T18:23:59.013Z (11 months ago)
- Language: JavaScript
- Size: 65.1 MB
- Stars: 13
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```javascript
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](https://domain.apac.ai/API.md) for more detailed usage instructions.
## Contributing
------------We welcome contributions from the community. If you would like to contribute, please check out our [contributing guidelines](https://github.com/kyegomez/swarms-js).
## Support
-------If you need help with Swarms, you can reach out to us on our [support page](https://github.com/kyegomez/swarms-js).
## License
-------Swarms is licensed under the [MIT License](https://github.com/kyegomez/swarms-js/LICENSE).
Join the Swarms community and start automating tasks with your AI team today!