debate-core-js
v0.1.2
Published
Debate core library
Readme
Debate Core
A library for creating and running AI debate simulations.
Installation
npm install debate-coreUsage
import { Debate } from "debate-core";
import { Model } from "debate-core";
// Initialize models
const model1 = new Model("gpt-4-turbo");
const model2 = new Model("gpt-4-turbo");
const judgeModel = new Model("gpt-4-turbo");
// Create voter views
const voterViews = [
{ economic: 3, social: 7 },
{ economic: 8, social: 2 },
{ economic: 5, social: 5 },
];
// Create debate
const debate = new Debate([model1, model2], judgeModel, voterViews, (event) =>
console.log(event)
);
// Prepare and run debate
await debate.prepare([
"What is your position on climate change?",
"How would you address income inequality?",
]);
await debate.run();
// Get results
const voters = debate.getVoters();
const context = debate.getContext();API Reference
Debate
The main class for creating and running debates.
new Debate(
models: Model[],
judgeModel: Model,
voterViews: { economic: number; social: number }[],
onEvent: (event: DebateEvent) => void
)Methods
prepare(questions: string[]): Prepares the debate with a list of questionsrun(): Runs the debategetVoters(): Returns the list of votersgetContext(): Returns the debate context
Model
Class for interacting with language models.
new Model(model: string)Publishing
Before publishing, make sure to:
- Update the version in package.json
- Update the repository URL in package.json
- Run the publish script:
npm run publish:ts-nodeLicense
MIT
