Recreating AI Chat Applications with Large Language Models: Evaluation Methods and Practical Guidelines
This article presents a reproducible framework for evaluating how well large language models can recreate AI chat applications. It covers requirements analysis, high-fidelity frontend implementation, prompt design, testing metrics, API key security, and common integration failures. The framework is designed to help developers compare models and agent frameworks without relying solely on successful API responses or subjective impressions.
Calling a large language model API to generate a conversation script is relatively straightforward. The harder task is recreating a complete web application with interaction logic, responsive layouts, and multimodal input. Some platforms also limit the number of public API calls or the length of submitted input, encouraging developers to build their own frontends on top of open interfaces.
This article outlines a reproducible evaluation process for designing prompts, recording results, and assessing model performance at different stages. It does not include specific test data. Readers can use the same methodology and enter results from their own environments.
1. Evaluation Objectives
The evaluation consists of three stages, each with verifiable deliverables.
1.1 Product Documentation and Structure Diagram
The model must identify the functional modules of the target page and produce:
- A product requirements document
- A feature list
- User flows
- Acceptance criteria
- A feature mind map or equivalent structure diagram
1.2 High-Fidelity Recreation
The model uses the requirements document to generate frontend code. During acceptance testing, the implementation should be compared with the reference page under specified conditions, including:
- A designated browser
- A defined screen resolution
- Mobile viewport sizes
- Individual interaction scenarios
- Reference screenshots
The evaluation should check both visual fidelity and functional behavior.
1.3 Improved Design
The model may retrieve publicly available information and propose additional features, such as:
- Loading states during streaming output
- Code syntax highlighting
- Local storage for conversation history
Each proposed improvement must include its rationale and a corresponding acceptance method.
2. Prompt Design
A two-stage prompt structure is commonly useful.
Stage One: Requirements Decomposition
The first prompt should clearly define:
- The model’s role, such as product manager and frontend engineer
- The input materials, including page screenshots and official API documentation
- The required output format, including the requirements document, structure diagram, and acceptance checklist
Stage Two: Integration and Debugging
After the code has been generated, provide the testing environment with a dedicated API key. The model can then call the real interface and revise the code based on the returned results.
Before both stages, an additional constraint can be included:
Ignore existing templates and historical context. Reason only from the materials provided in this task.
This constraint can reduce the chance that the model reuses outdated APIs or incompatible component libraries. It does not replace the platform’s security policies and must not be used to bypass platform rules.
3. Evaluation Records and Metrics
Every model or framework should be tested with the same prompts and task set. Record the results using a consistent table. Replace each “To be completed” entry with actual test data.
| Model or Framework | Version | Test Date | Stage | Passed Items | Failed Items | Fix Iterations | Manual Interventions | Duration |
|---|---|---|---|---|---|---|---|---|
| To be completed | To be completed | To be completed | Recreation | To be completed | To be completed | To be completed | To be completed | To be completed |
The metrics are defined as follows:
- Functional pass rate: The number of passed acceptance cases divided by the total number of cases.
- UI fidelity: A score assigned under the same viewport across five dimensions: layout, typography, spacing, color, and icons.
- Fix iterations: The number of repair cycles from the first failed run until all required checks pass.
- Manual interventions: The number of times the evaluator modifies code or provides additional information to make the program run.
Confirming that an API returns HTTP 200 and prints text is not enough to demonstrate that the implementation is usable. Testing should also cover:
- Very long text inputs
- Concurrent requests
- Network timeouts and failed-request retries
- A streaming response that disconnects before completion
4. API Key Security Requirements
Integration testing may involve real credentials and should meet the following requirements:
- Use a temporary key with minimum permissions, usage limits, and an expiration time.
- Use the key only in a sandbox environment. Do not commit it to the code repository; load it through environment variables or a secrets management service.
- Do not place the key in prompts, logs, or screenshots. Inspect generated code to ensure that it contains no statements that expose or echo the key.
- Revoke the key immediately after integration testing and audit the relevant usage records.
- If the target page requires authentication, use only an account that the tester is authorized to access.
5. Common Problems
How Should You Choose a Model?
Start by identifying the capabilities required by the task, such as:
- Long-document understanding
- Code generation
- Multimodal input
- Web or document retrieval
Then test each model with the same prompts and task set, and compare the metrics in the evaluation table.
A larger context window does not necessarily indicate stronger execution. A long context helps the model read extensive documentation, but code generation and debugging also depend on reasoning ability and self-checking mechanisms. The combination of a model and an agent framework can affect the outcome as well.
What Errors Are Common During Integration?
Typical failures include:
- The API returns successfully, but the response format does not match the frontend parser.
- Long input exceeds the context limit, causing truncation or a request error.
- The interface does not return to an input-ready state after a streaming response is interrupted.
- The input field is hidden when the mobile keyboard opens.
- Concurrent responses arrive out of order, causing messages to appear in the wrong positions.
- Network failures provide neither retry logic nor a timeout message.
How Should Test Cases Be Designed?
For each feature, define:
- The input
- The expected output
- The criteria for determining failure
Test cases should cover normal flows, boundary inputs, and network failures. A human should review the test cases before they are used. This prevents a model from both generating the questions and deciding whether its own implementation passes.
6. Conclusion
Under the testing conditions described in this article, large language models can assist with product documentation, interface code generation, and parts of the integration process. Human reviewers are still required for architecture reviews, security audits, and final acceptance.
As a result, developers will increasingly spend more time defining requirements, designing tests, and verifying results rather than relying solely on generated code.
