Elicitation is a very important step in software engineering, in which business analysts draw out the requirements to gain access to relevant data. It is the practice of discovering requirements for a system by interacting with end-users and stakeholders. It is done to identify different kinds of requirements (new and old) and to document the origin and production methodology of data. Errors made during this step can become a cause of project failure. However, this step is very time-consuming and human labour is not very efficient. Poorly written requirements can cause the project to fail completely. Apart from a few NLP techniques which can assist in the individual steps of requirements elicitation, there are no AI tools that can generate quality requirements written in natural language. Thus there is a serious need of having automation tools for this task alone, which can be very helpful in eliciting requirements quickly. For this purpose, we have built an application which generates software requirements given a brief description of the application.
The application uses the GPT-3.5 Large Language Model developed by OpenAI to generate the requirements. We use the OpenAI API to interact with the model. With a help of pre-structured prompt based on the prompting guidelines and various prompt engineering techniques, we are able to generate the requirements of highest quality. The user is required to enter the title, the description and the field of use of their application that they want requirements for. This data is combined with a prompt and with the help of the API, it is given as an input to the GPT model. After collecting the output, we then extract a set of software requirements and a set of five questions from it which could help refine the quality of the requirements. If the user is not satisfied with the requireemnts, they can answer those questions to get better quality requirements.
Prompt engineering is a field developed to provide a set of principles and techniques to optimise the prompts for maximum quality output. Due to the way the LLMs have been trained and the dataset they have been trained on, there are specific prompt formats that work better at a given task. The quality of outputs generated by the LLMs can improve significantly if the quality of prompts increases. With a specific prompt, it is possible to create new interaction paradigms, new output patterns, etc. After iteratively trying out different prompt patterns and prompting techniques, we have designed our prompt to include the Persona, Cognitive Verifier and Template prompt patterns so as to program the GPT model to produce content of desired quality.
From now on, act as a software requirements engineer who is tasked to elicit the functional and non functional requirements of an application.
When you are asked a question, follow these rules:
1. Generate a number of additional questions that would help more accurately answer the question
2. Combine the answers to the individual questions to produce the final answer to the overall question
1. The questions should be in JSON format with a question ID
2. Use the delimiter "SEP" after printing the additional questions.
Sample Output: [
{'Q1': 'abc?', ..., 'Q5': 'xyz?'}
SEP
{'FR1': 'abc', ..., 'FR12': 'xyz'}
SEP
{'NFR1': 'abc', ..., 'NFR6': 'xyz'}
]
- Clone the repository
git clone https://github.com/pahchangarg/chatgpt_interface
- Install the required libraries
pip install -r requirements.txt
- Create a developer's account at OpenAI
- Setup a Secret Key for the OpenAI API
- Store the Secret key in a text file named
apiKey.txt - Run the
Main.pyfile
python -u Main.py