- Step1: Run npm install openai-swarm-node in your project directory
- Step2: Import the Swarm class: import { Swarm } from 'openai-swarm-node'
- Step3: Initialize a swarm instance: const swarm = new Swarm({ model: 'gpt-4', agents: 5, strategy: 'majority' })
- Step4: Call const result = await swarm.ask('Your prompt here') to get the consensus response
- Step5: Process the aggregated result and integrate it into your application