# Automated Test Creation Using Large Language Models: A Practical Application
## 4 AI-Powered Quiz Creation and Management Tool
### Communication between the Application and LLM APIs. Prompt Engineering  
A Large Language Model is a type of machine learning model trained to understand and generate text in natural language. LLMs are based on deep neural networks and typically contain billions of parameters, enabling them to handle complex text-related tasks such as translation, summarization, question-answering, text generation, foreign language translation, and more [70]. LLMs are widely used in chatbots, auto-completion systems, search engines, and other natural language processing services. The process of creating and refining input text prompts, which are fed to LLMs like GPT-3, GPT-4, and others, to achieve the desired outcomes is known as Prompt Engineering [71]. This is a crucial aspect of interacting with LLMs, as well-formulated prompts can significantly improve the quality and accuracy of the responses generated by the model. Communication between the client application and the LLM requires careful formulation of the questions directed to the model. The usual approach, where the user asks a question in natural language and receives a free-text response, is unsuitable for subsequent automated processing of this text by the application. If the results are returned in a structured format, it will significantly facilitate their automated processing by the client application. JSON is a widely used standard for data transfer in internet communication between applications. In the context of LLMs, generating output in JSON format provides a clear and organized data structure that the client application can easily interpret and process. Many of the latest versions of leading LLM APIs, including those from OpenAI and Gemini, offer the capability to generate structured JSON output. However, different APIs use different functions and parameters for this purpose, which can complicate the logic of the client application and hinder the future integration of new LLMs into it. Our research shows that all major LLMs, such as ChatGPT [72], Gemini [73], Llama [74], Claude [75], Mistral [76], Cohere [77], Reka [78], DeepSeek [79], and others, can generate structured JSON output if the query is properly formulated and includes instructions for the desired output format. This allows the client application to work uniformly with different LLM APIs using the same prompt and to receive results in a format defined by the developers. Figure 2 presents a UML sequence diagram illustrating the main steps in the process of automated test question generation using an LLM. These steps include:  
* Teacher Configuration: A user with the role of a teacher configures the parameters for generating test questions, such as the topic, target group, test complexity, question types, and other specific requirements. * Prompt Generation: Upon starting the process, the application generates a prompt that includes the teacher-defined parameters and a JSON template for the response structure. * Prompt Submission: The client application sends this prompt to the LLM through the appropriate model's API. * LLM Response: The LLM returns an output that contains the generated test questions and answers in JSON format. * Output Processing: The client application processes the received JSON output and displays the questions and answers in a user-friendly format. * Teacher Review and Storage: The teacher reviews and edits the questions, after which they are saved in the application's database. A prompt template that can be used for all of the reviewed LLMs is presented in Figure 3. It returns a structured JSON result containing test questions and answers. Sample values for the parameters <n>, <m>, and <subject area> are \"5\", \"4\", and \"Databases\", respectively. The presented JSON structure consists of an array of questions, each of which has two sub-elements: the question text and an array of answers.