This repository is a research-focused project for creating AI assistants based on Large Language Models (LLMs) that engage in structured discussions to improve the performance of requirements engineering tasks, such as requirements classification.
llm-discussion/
│
├── code/ # Python modules for assistant creation, interaction, and evaluation
│ ├── llm/ # Logic for interacting with OpenAI API
│ ├── evaluation/ # Scripts for generating baselines and computing metrics
│ └── ...
│
├── data/ # All data-related resources
│ ├── assistants/ # Metadata and files related to created assistants
│ ├── config/ # Configuration files defining assistant roles and coordination logic
│ ├── prompts/ # System and user prompts for various assistant roles
│ ├── datasets/ # Input CSV datasets (e.g., PROMISE dataset)
│ ├── output/ # Output generated by assistants (raw responses, predictions)
│ └── evaluation/ # Evaluation metrics, confusion matrices, and summaries
│
└── requirements.txt # Python dependencies
- Clone the repository
git clone https://github.com/nlp4se/llm-discussion.git
cd llm-discussion- Add your API keys in a
.envfile
OPENAI_API_KEY=your_openai_api_key_here
# Add other keys if needed- Install dependencies
pip install -r requirements.txtThis pattern defines three assistants:
- Functional (F) debater: argues why the given requirement is functional.
- Non-Functional (NF) debater: argues why the given requirement is non-functional.
- Judge: analyses the response from the debaters and leads to a classification decision (F/NF).
python -m code.llm.openai.create_assistant_openai --assistant_name non-functional-debater --prompt_file_path ./data/prompts/discussant/non-functional-debater-prompt.txtpython -m code.llm.openai.create_assistant_openai --assistant_name functional-debater --prompt_file_path ./data/prompts/discussant/functional-debater-prompt.txtpython -m code.llm.openai.create_assistant_openai --assistant_name judge-debater --prompt_file_path ./data/prompts/coordinator/judge-prompt.txt --schema_file_path ./data/prompts/coordinator/requirements-schema-binary.jsonpython -m code.llm.openai.ask_assistant_openai --assistant_name functional-debater --prompt_file ./data/prompts/discussant/requirement-example-prompt.txtpython -m code.evaluation.baseline --input_path ./data/datasets/PROMISE/nfr.csv --output_folder ./data/output/baseline/binary/ --batch_size 10 --assistant_name persona_classifier_binary --model gpt-4opython -m code.evaluation.metrics --input ./data/output/baseline/binary/nfr.csv --output ./data/evaluation/binaryRun classification using multi-agent debate strategy:
python -m code.llm.coordinator --input ./data/datasets/PROMISE/nfr.csv --output ./data/output/judge/binary/nfr.csv --assistants-file ./data/config/assistants.json --judge-file ./data/config/judge.json --temperature 0 --iterations 1 &Explanation of parameters:
- --input: Input CSV file path
- --output: Output CSV file path
- --assistants-file: JSON file with assistant configs
- --judge-file: JSON file with judge config
- --temperature: Temperature for generation (default: 0)
- --n: Number of requirements to sample per class (optional)
- --iterations: Number of debate iterations between the debaters (default: 0)
python -m code.evaluation.metrics --input ./data/output/judge/binary/nfr.csv --output ./data/evaluation/judge/binaryThis project is licensed under the GNU General Public License v3.0.
You are free to use, modify, and distribute this software under the terms of the GPLv3 License.