A questionnaire survey method and system based on a ReAct intelligent agent
Patent Information
- Application Number
- CN202610810398.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-05
- Publication Date
- 2026-10-09
AI Technical Summary
首先,普遍缺乏主动需求澄清能力,系统仅依靠用户单次输入内容开展工作,无法主动识别需求信息中的缺失项,也未设置交互式反问补全机制,当用户输入表述模糊时,最终生成的问卷内容易与实际使用需求产生较大偏差
1、本发明基于ReAct智能体循环交互机制,通过主动反问动态补全用户模糊需求,精准澄清调查口径、采集粒度及指标范围等关键信息。克服了传统单次生成模式无法主动澄清需求的缺陷,有效提升问卷生成与实际业务需求的匹配精度。
Smart Images

Figure CN122885099A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of interactive questionnaire generation technology, and in particular to a questionnaire survey method and system based on ReAct agents. Background Technology
[0002] With the continuous development of large language model technology, natural language processing technologies have been deeply applied to many scenarios such as intelligent interaction and text content generation. In the field of questionnaire design, the use of large language models to achieve automated questionnaire generation is gradually becoming an important direction for industry research and application.
[0003] Currently, questionnaire generation technologies based on large language models in the industry mainly fall into two categories. The first is a one-time generation approach. This method receives the user's input of the questionnaire topic or a brief description of the requirements, and then directly calls the large language model to output the complete questionnaire questions or overall questionnaire structure in one go. It operates on a one-time generation and direct output model, without any user-facing interaction, content modification, or requirement iteration. The second approach is a template matching combined with rule-based filling. This approach pre-configures standardized questionnaire templates for various application scenarios. After the user selects the corresponding template, the questionnaire content is customized based on preset rules or keyword replacement methods. While this approach can improve content adaptability by leveraging domain knowledge bases, it is mostly limited to a single vertical domain and has weak adaptability to generalized questionnaire design scenarios.
[0004] Existing questionnaire generation technologies still have several significant shortcomings in practical applications. First, they generally lack the ability to proactively clarify user needs. Systems rely solely on single user input, failing to proactively identify missing information or implement interactive feedback mechanisms. When user input is ambiguous, the generated questionnaire is prone to significant deviations from actual usage requirements. Second, the reuse of questionnaire knowledge systems is relatively simplistic. Related technologies either rely solely on large language models to generate content freely, making it difficult to guarantee domain-specificity, or they are limited to single-domain templates, failing to address general questionnaire design needs and lacking a hierarchical questionnaire resource architecture. This results in redundant content in general scenarios and insufficient question standardization in specialized scenarios.
[0005] Meanwhile, existing technologies lack a complete closed loop for generation and feedback, resulting in a linear overall process. Once the questionnaire is generated, adjustments can only be made manually offline, without supporting real-time user intervention or dynamic modifications during the design process. The absence of a collaborative iterative model that allows for simultaneous generation and preview significantly increases the time cost of questionnaire adjustments and leads to a poor human-computer interaction experience. Furthermore, the generation process of large language models is black-boxed, lacking complete process records for questionnaire item selection, template calls, and other steps. The design logic and selection criteria are untraceable, and the interpretability of the interaction process is poor, further reducing the practical application value of the solution.
[0006] In summary, current automated questionnaire generation technologies suffer from numerous technical bottlenecks, such as low accuracy in demand adaptation, poor knowledge reusability, weak iterative interaction capabilities, and lack of process interpretability. These limitations make it difficult to meet the needs of intelligent questionnaire design that is multi-scenario, high-precision, traceable, and iterative. There is an urgent need for an intelligent questionnaire generation technology solution that features proactive demand clarification, hierarchical knowledge reuse, human-machine collaborative iteration, and process traceability. Summary of the Invention
[0007] The main objective of this invention is to provide a questionnaire survey method based on ReAct agents.
[0008] Another objective of this invention is to propose a questionnaire survey system based on ReAct agents.
[0009] The third objective of this invention is to provide an electronic device.
[0010] The fourth objective of this invention is to provide a non-transitory computer-readable storage medium.
[0011] To achieve the above objectives, a first aspect of the present invention proposes a questionnaire survey method based on ReAct agents, comprising: A two-level questionnaire database and a corresponding retrieval vector database are pre-constructed. The two-level questionnaire database includes a general questionnaire database and a domain-specific questionnaire database. The retrieval vector database stores the embedding vectors obtained by converting the questionnaire database content and corresponding tags. Receive natural language instructions from users to create questionnaires and initialize a ReAct agent instance, which includes a reasoning module, an action module, and an observation module; The reasoning module analyzes the natural language instructions, identifies existing information and determines information gaps, the action module calls the questioning tool to generate follow-up questions and clarify user needs, and the observation module analyzes user responses to complete the questionnaire's needs information. A tag vector is generated based on the completed questionnaire requirements information. A questionnaire template is matched in the two-level questionnaire database based on the retrieval vector library. The matched templates are then fused to generate an initial questionnaire structure. The initial questionnaire structure is rendered into a visual preview interface, continuously receiving modification feedback submitted by the user. The ReAct agent cyclically executes the thinking-action-observation process to complete the questionnaire modification and updates the preview interface simultaneously. After the user confirms, the final questionnaire structure is output, and the questionnaire is completed.
[0012] Optionally, a two-tiered questionnaire database and a corresponding retrieval vector database can be pre-built, including: Collect cross-domain common standard question templates. The standard question templates include at least demographic information templates, satisfaction scale templates, net promoter score templates, and behavior frequency templates. Each template item contains a question ID, question text, a list of options and their codes, question type fields, and applicable tags, forming a general questionnaire library. Professional questionnaire templates are organized by industry or application scenario. In addition to the same fields as the general questionnaire library, each template item is also associated with domain tags, target audience tags and measurement dimension tags, thus forming a domain questionnaire library. For each template question in the two-level questionnaire database, the combination of its domain label, audience label, and dimension label is converted into a first embedding vector and stored in the first vector index; For each questionnaire template, its questionnaire title, questionnaire description, and tag combination are converted into a second embedded vector and stored in the second vector index. The first vector index and the second vector index together constitute the retrieval vector library.
[0013] Optionally, the process of initializing a ReAct agent instance includes: An independent ReAct agent is instantiated for each user session, enabling the reasoning module to analyze the currently known information and information gaps based on a large language model and output the conclusions. Configure multiple callable utility functions for the action module, including a question-and-answer tool, a questionnaire template matching tool, a question modification tool, and a completion tool. Each utility function defines its input and output interfaces in JSON Schema format. The observation module is used to analyze the execution results of the action module, update the current session state, and use the observation results as input for the next round of reasoning, forming a closed-loop iterative architecture of thinking-action-observation.
[0014] Optionally, the action module invokes a questioning tool to generate follow-up questions and clarify user needs. The observation module then analyzes the user's response to complete the questionnaire's requirements information, including: A pre-built question-asking strategy library is provided, which contains three types of question-asking templates: missing information question-asking templates, refined question-asking templates, and option-generated question-asking templates. Each type of template stores multiple semantic variations and corresponding fill slots. Once the inference module identifies an information gap, it dynamically selects a question template that matches the type of information gap from the question strategy library, and fills in the specific content of the template based on the acquired user information to generate follow-up question text. The action module calls the questioning tool to output follow-up questions, and then the observation module receives the user's reply and parses the key information fields in it to complete at least one of the following: survey scope, property collection granularity, expected questionnaire length, and policy attribute identifier, forming complete questionnaire requirement information.
[0015] Optionally, a tag vector is generated based on the completed questionnaire requirements information. A questionnaire template is then matched against the two-level questionnaire database using the retrieval vector library. The matched templates are then fused to generate an initial questionnaire structure, including: Input the complete questionnaire requirements information into the reasoning module, and the large language model will parse it to generate multi-dimensional label vectors. The dimensions of the label vectors include at least domain dimension, population dimension and measurement dimension, and each dimension is assigned a configurable weight coefficient. Using the tag vectors, a similarity search is performed in the retrieval vector library. A similarity threshold is set, and template questions or questionnaire templates with similarity scores higher than the threshold are recalled. The templates are then sorted in descending order of similarity scores, and the top N results are taken. Multiple matching templates are merged, including deduplication to remove duplicate items, merging similar items by dimension, and conflict resolution, ultimately generating the initial questionnaire structure.
[0016] Optionally, the initial questionnaire structure is rendered as a visual preview interface, continuously receiving modification feedback submitted by the user. The ReAct agent iteratively executes a think-action-observation process to complete the questionnaire modification and synchronously updates the preview interface. After user confirmation, the final questionnaire structure is output, including: The initial questionnaire structure is rendered as a visual preview interface, which allows users to submit modification feedback by clicking the edit button or through natural language dialogue. The system receives modification feedback submitted by users, and the reasoning module parses the modification intentions contained therein. The modification intentions include at least adding questions, deleting questions, modifying questions, adjusting options, adding jump logic, and rearranging the order of questions. Based on the parsed modification intent, the modification question tool or the addition question tool in the action module are called sequentially to incrementally update the current questionnaire structure and generate corresponding modification events; An event sourcing model is used to maintain the event flow, enabling the dynamic questionnaire builder to subscribe to the event flow and apply changes to update the questionnaire's JSON schema. At the same time, the preview generator listens for changes in the JSON schema and immediately re-renders the preview interface, achieving synchronous updates while creating and previewing. Repeat the steps of receiving feedback, parsing intent, calling tools, updating events, and refreshing the preview until the user's confirmation instruction is received, output the final questionnaire structure, and complete the questionnaire creation.
[0017] To achieve the above objectives, a second aspect of the present invention provides a questionnaire survey system based on ReAct agents, comprising: The questionnaire database construction unit is used to pre-build a two-level questionnaire database and a corresponding retrieval vector database, wherein the two-level questionnaire database includes a general questionnaire database and a domain questionnaire database, and the retrieval vector database stores the embedding vectors obtained by converting the questionnaire database content and corresponding tags. The agent initialization unit is used to receive the natural language instruction from the user to create a questionnaire and initialize the ReAct agent instance, which includes a reasoning module, an action module and an observation module. The requirement clarification unit is used to analyze the natural language instructions through the reasoning module, identify existing information and determine information gaps, call the questioning tool through the action module to generate follow-up questions and clarify user needs, and have the observation module parse user responses to complete the questionnaire requirement information. The template matching and fusion unit is used to generate a tag vector based on the completed questionnaire requirement information, match the questionnaire template in the two-level questionnaire database based on the retrieval vector library, and perform fusion processing on the matched templates to generate an initial questionnaire structure. The iterative generation unit is used to render the initial questionnaire structure into a visual preview interface, continuously receive modification feedback submitted by the user, and the ReAct agent cyclically executes the thinking-action-observation process to complete the questionnaire modification and update the preview interface simultaneously. After the user confirms, the final questionnaire structure is output, and the questionnaire is completed.
[0018] Regarding the system in the above embodiments, the specific manner in which each unit performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0019] To achieve the above objectives, a third aspect of this application provides an electronic device, including a processor and a memory; wherein the processor runs a program corresponding to the executable program code stored in the memory, in order to implement a questionnaire survey method based on a ReAct agent as described in the first aspect embodiment.
[0020] To achieve the above objectives, a fourth aspect of this application provides a non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements a questionnaire survey method based on a ReAct agent as described in the first aspect embodiment.
[0021] The embodiments of the present invention have the following beneficial effects: 1. This invention is based on the ReAct intelligent agent cyclical interaction mechanism, which dynamically completes users' ambiguous needs through proactive questioning, accurately clarifying key information such as survey scope, collection granularity, and indicator range. It overcomes the shortcomings of traditional single-generation mode, which cannot proactively clarify needs, and effectively improves the matching accuracy between questionnaire generation and actual business requirements.
[0022] 2. This invention constructs a two-tiered knowledge architecture consisting of a general questionnaire database and a domain-specific questionnaire database, and combines vector similarity retrieval to achieve intelligent matching and fusion of multiple templates. This ensures the standardization of general question types while also considering the professional survey dimensions of vertical scenarios, solving the problems of traditional technical knowledge reuse being singular and the inability to balance universality and professionalism, significantly improving the professionalism and adaptability of questionnaire content.
[0023] 3. This invention establishes a human-computer collaborative closed loop of simultaneous creation, preview, and iteration, enabling real-time response to user feedback and dynamic updates to the questionnaire structure and preview interface. It changes the traditional linear model of one-time generation and offline manual modification, simplifying the questionnaire iteration process, reducing editing costs, and improving the flexibility and efficiency of questionnaire design.
[0024] 4. This invention fully records the entire process of the ReAct agent's thinking, actions, and observations in each round, making the questionnaire question setting, structure adjustment, and parameter modification traceable. It solves the drawbacks of the black-box and unauditable nature of traditional large-scale model generation processes, effectively meeting the requirements of standardized and highly reliable application scenarios such as government evaluation and rural surveys. Attached Figure Description
[0025] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 A flowchart of a questionnaire survey method based on ReAct agents provided in this embodiment of the invention; Figure 2 This is a schematic diagram of the hierarchical architecture and data flow of the dynamic questionnaire construction system provided in this embodiment of the invention; Figure 3 A schematic diagram of the closed-loop iterative workflow of questionnaire design thinking-action-observation provided in this embodiment of the invention; Figure 4 This is a structural diagram of a questionnaire survey system based on ReAct agents provided in an embodiment of the present invention. Detailed Implementation
[0026] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0027] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0028] The following describes a questionnaire survey method and system based on ReAct agents according to an embodiment of the present invention, with reference to the accompanying drawings.
[0029] Example 1 This invention provides a questionnaire survey method based on ReAct agents. Figure 1 This is a flowchart illustrating a questionnaire survey method based on ReAct agents provided in an embodiment of the present invention. Figure 1 As shown, the method includes the following steps: Step S1: Pre-construct a two-level questionnaire database and a corresponding retrieval vector database, wherein the two-level questionnaire database includes a general questionnaire database and a domain questionnaire database, and the retrieval vector database stores the embedding vectors obtained by converting the questionnaire database content and corresponding tags.
[0030] In this embodiment of the invention, the overall database construction process is divided into three progressive implementation units: general questionnaire database construction, domain-specific questionnaire database construction, and retrieval vector database construction. Each unit is implemented step-by-step according to the sequence of original material collection, standardized field entry, and feature vectorization storage. During the construction of the general questionnaire database, staff collect standardized question templates across application domains. The collected content covers demographic basic information collection question types, five-level and seven-level Likert scales for satisfaction, NPS (Net Promoter Score) assessment question types, and questionnaire templates for frequency statistics of respondents' behaviors. These question items can adapt to the basic data collection needs of various survey projects. Each database template implements a unified standardized field definition. Each field is configured with a unique question number, complete question stem text, coded alternative option set, single / multiple / open-ended question type identifier, and scenario-adaptive general tags. Through the collection and integration of all standardized templates, the general questionnaire database is completed.
[0031] In the process of building the domain questionnaire database, professional questionnaire templates were classified and collected according to industry categories and application scenarios. The consumer electronics category was equipped with the SUS product usability assessment scale and product function preference ranking items. The medical and health category was equipped with the HCAHPS patient satisfaction assessment template and physical health self-assessment items. The education category was equipped with the SEEQ course evaluation system template and learner characteristic survey questionnaire.
[0032] This application focuses on digital rural application scenarios and customizes a special survey template for rural household population and property. The domain-specific templates fully inherit the established storage fields of the general questionnaire library, and on this basis, add three types of extended identifiers: domain classification tags, target survey group tags, and assessment dimension tags. These new identifiers enable a refined definition of the template's applicable scope. After collecting industry-specific templates, a domain-specific questionnaire library is formed. The general questionnaire library and the domain-specific questionnaire library are combined to constitute… Figure 2 The complete architecture of the two-tiered questionnaire database is shown.
[0033] After all questionnaire materials are entered into the database, the construction of the retrieval vector library begins. This process takes over the pre-built questionnaire database data and provides index support for the backend intelligent matching process. Firstly, for each independent item in the two-tiered questionnaire database, the domain, demographic, and dimension tags bound to the item are extracted, and the tag fields are aggregated and concatenated. The aggregation results are mapped by an algorithm to generate the first embedding vector, and all first embedding vectors are centrally written into the first vector index. Secondly, for each set of questionnaire templates, the questionnaire title, questionnaire description text, and all tag combinations associated with the template are extracted, and corresponding second embedding vectors are generated and collected into the second vector index. The first and second vector indexes are combined to form the retrieval vector library. Subsequently, when the ReAct intelligent agent engine initiates a template resource retrieval action, it uses this vector index to perform a fast similarity retrieval calculation.
[0034] Step S2: Receive the user's natural language instruction to create a questionnaire and initialize a ReAct agent instance, which includes a reasoning module, an action module, and an observation module.
[0035] This step marks the initial human-computer interaction step in the intelligent questionnaire construction process. Users can... Figure 2 The system's interaction layer interface allows users to input unformatted natural language commands to initiate questionnaire customization requests. In this embodiment, users can input commands such as "Help me create a family population and property survey questionnaire for XX village in XX county for digital village pilot evaluation." After the interaction layer completes the collection of the user's natural language commands, it transmits the standardized request data to the ReAct intelligent agent engine according to preset data flow rules, completing the front-end access and back-end input of user requests.
[0036] To ensure operational independence and data security in multi-user, multi-session scenarios, this application embodiment instantiates a dedicated ReAct intelligent agent runtime unit for each independent user session process. This independent instantiation mechanism enables physical isolation of runtime parameters, interaction logs, and requirement data across different sessions, effectively preventing data cross-interference and parameter misalignment issues in multi-session scenarios, and ensuring the independence and stability of the single-session questionnaire design process.
[0037] The overall architecture of the instantiated ReAct agent and Figure 3 The workflow shown is fully compatible, and the overall structure is divided into three core functional units: reasoning, action, and observation. Each module performs its own function while cooperating with others to form a complete intelligent computing logic chain. Among them, the reasoning module uses a large language model as its core computing foundation. It can semantically decompose, identify information, and analyze requirements from the user's original natural language commands, accurately identify the clearly defined and valid research information in the commands, locate the missing information in the current requirements, and output standardized requirements assessment results, providing a logical basis for subsequent intelligent decision-making.
[0038] The action module has four built-in functional tool units that can be intelligently scheduled. These four tool units are related to... Figure 3 The four action branches shown—questioning, template matching, question modification, and process completion—correspond one-to-one, specifically including a questioning tool, a questionnaire template matching tool, a question modification tool, and a completion tool. Each tool unit uses the JSON Schema standard to standardize the definition of input parameters, output results, and call interfaces. The unified calling standard can effectively improve the accuracy of intelligent agent tool scheduling and data integrity, ensuring the standardization, consistency, and reusability of tool calls throughout the entire process.
[0039] The observation module plays a core role in data feedback, status updates, and link connection. It receives real-time operational data returned by various tool units in the action module after completing tasks, and performs semantic parsing, information extraction, and effective field extraction on the returned data. Simultaneously, the observation module updates the global operational status of the current user session in real-time based on the parsing results, and then inputs the finalized observation information back into the inference module as the core input data for the next round of iterative inference and intelligent decision-making. This module's linkage mechanism can be built from both logical and operational levels. Figure 3 The closed-loop operational architecture shown, which involves iterative processes of thinking, action, and observation, supports the continuous iterative optimization of the questionnaire design process.
[0040] Step S3: The reasoning module analyzes the natural language instructions, identifies existing information and determines information gaps, the action module calls the questioning tool to generate follow-up questions and clarify user needs, and the observation module parses the user's response to complete the questionnaire's requirement information.
[0041] Before executing the requirements clarification process, the configuration and deployment of the questioning strategy library are completed in advance to provide standardized strategy support for intelligent requirements completion work. In this embodiment, the questioning strategy library has three types of functionally differentiated questioning templates, specifically including missing information questioning templates, refined questioning templates, and option-generated questioning templates. Each type of template is configured with multiple sets of semantically differentiated standard sentence structures, and the template has reserved adaptation slots that can be dynamically filled with business parameters, which can complete adaptive content generation according to different user needs scenarios. For the digital rural survey application scenario adapted to this application, the three types of basic questioning templates are customized and optimized for specific scenarios. In the missing information questioning template, exclusive questions are added to define the statistical scope of migrant workers and the statistical boundary of family assets; in the refined questioning template, special inquiries are added to distinguish the land ownership area from the actual operating area and define the depth of digital survey indicator collection; in the option-generated questioning template, scenario-based alternative inquiries such as the family income level classification standard and the housing ownership type classification method are pre-configured, further improving the professionalism and scenario adaptability of intelligent questioning.
[0042] Building upon the agent initialization and initial requirement analysis completed in step S2, the inference module performs in-depth semantic decomposition and element identification of the user's original requirements, locating the missing key information needed for the current questionnaire design. Based on the identified information gap types, it matches corresponding template structures from the questioning strategy library, and fills the variable slots within the template with the parsed and obtained valid user requirement information, automatically generating standardized follow-up questions adapted to the current survey scenario. Subsequently, the action module activates the built-in questioning tool, transmitting the generated structured follow-up questions through... Figure 2 The interaction layer pushes the message to the user's front-end interface to complete the intelligent query output.
[0043] In the digital rural household population and property survey scenario of this application embodiment, the automatically generated standardized follow-up questions are as follows: "Hello, regarding the digital rural household population and property survey, I need to clarify the following points: 1) Survey subjects: Are both registered residents and permanent residents collected simultaneously? Are people who have been working away from home for more than six months included? 2) Property dimensions: Is it necessary to break it down to 'housing type + building area + number of homesteads', 'contracted land area and transfer status', and 'list of productive fixed assets'? Or is it only necessary to collect the total amount of household assets?" After the user completes a targeted response at the interaction layer, the response data is transmitted back to the ReAct intelligent agent engine along the original data link, where the observation module performs structured parsing, key information extraction, and semantic calibration of the user feedback text.
[0044] The observation module can accurately extract core demand elements from user responses, such as the statistical scope of the survey respondents, the granularity of household property data collection, and the number of digital indicators collected. In an exemplary user response scenario, the parsed demand parameters include: the survey respondents are based on registered population as the core statistical benchmark, simultaneously including the income and asset information of migrant workers; household property data adopts a detailed itemized collection mode, specifically covering information related to homesteads, contracted land, and productive fixed assets; the questionnaire needs to include five to six additional questions on digital rural development. Through a multi-round interactive parsing mechanism, all information gaps in the initial user demands are completely filled, forming a standardized questionnaire design requirement that is complete in elements, clear in scope, and conforms to scenario specifications, providing accurate input basis for subsequent questionnaire template matching and structure generation.
[0045] Step S4: Generate a tag vector based on the completed questionnaire requirement information, match the questionnaire template in the two-level questionnaire database based on the retrieval vector library, and perform fusion processing on the matched templates to generate the initial questionnaire structure.
[0046] In this embodiment, after step S3 completes the filling of all demand gaps and forms a complete and standardized questionnaire design requirement, the reasoning module performs structured semantic decomposition and element extraction on the solidified questionnaire requirement information. This module uses a large language model to perform multi-dimensional analysis of the demand scenario, survey subjects, and assessment direction, accurately extracting core feature tags such as domain attributes, target audience, and measurement dimensions. Multiple sets of discrete feature tags are then vectorized to generate a unique multi-dimensional tag vector corresponding to the current survey requirements. Each dimension of this tag vector supports custom weight configuration, allowing for adaptive weight allocation based on the focus of different survey scenarios. Taking the digital rural survey scenario of this application as an example, the weights for each dimension can be configured as follows: population dimension 0.4, property dimension 0.3, digitalization dimension 0.2, and policy dimension 0.1. This weight configuration mechanism ensures that the retrieval process aligns with the core needs of the scenario, improving the accuracy and adaptability of template matching.
[0047] After the tag vectors are generated, the ReAct agent initiates the retrieval and matching process, calling the preset retrieval vector library to conduct a global similarity comparison retrieval. In this embodiment, a similarity threshold of 0.7 is pre-set as the screening criterion. All item vectors and the entire questionnaire template vector in the retrieval vector library are traversed, and valid template resources with similarity values greater than this threshold are selected. All compliant resources are sorted in descending order according to their similarity matching scores. The top three questionnaire templates in the sorted results are used as the basic materials for subsequent fusion processing, maximizing the retention of standardized questionnaire resources that are highly adapted to user survey needs.
[0048] After completing the selection of high-quality template resources, Figure 2The dynamic questionnaire builder in the architecture receives all the selected materials and initiates the standardized template fusion process. This fusion process includes three core standardized operations: duplicate item removal, merging of question types within the same dimension, and content conflict resolution. Duplicate item removal eliminates overlapping and redundant survey questions across multiple templates, avoiding repetitive questionnaire content. Merging of question types within the same dimension categorizes and integrates scattered items belonging to the same assessment dimension, ensuring a clear hierarchical structure. Content conflict resolution uniformly calibrates content with logical conflicts or inconsistent definitions across multiple templates, ensuring overall questionnaire standardization and consistency.
[0049] After the above systematic integration process, the dynamic questionnaire builder outputs structured initial questionnaire data in a standardized JSON format, forming a renderable, editable, and iterable initial questionnaire draft. In the digital village scenario of this application embodiment, after integrating three types of special survey templates, an initial questionnaire structure containing twenty-two standardized questions is finally generated. The specific question types are distributed as follows: eight questions on basic population information, four questions on housing and land resource surveys, three questions on productive fixed asset statistics, four questions on household income and expenditure statistics, and three questions on digital village special evaluation indicators, fully covering all evaluation dimensions required for this digital village household population and property survey.
[0050] Step S5: Render the initial questionnaire structure into a visual preview interface, continuously receive modification feedback submitted by the user, and have the ReAct agent execute the thinking-action-observation process in a loop to complete the questionnaire modification and update the preview interface in a synchronous manner. After the user confirms, output the final questionnaire structure to complete the questionnaire creation.
[0051] In this embodiment, after the initial questionnaire structure is generated, the standardized JSON format questionnaire structure data is pushed to the real-time preview generator. The real-time preview generator performs visual analysis and interface rendering on the questionnaire data, generating a visual preview interface that users can intuitively view, review, and verify. Users can... Figure 2 The interaction layer allows users to view the complete questionnaire layout, question content, option styles, and question type attributes in real time. Users can also submit corresponding questionnaire adjustment and optimization requests through built-in interactive controls or natural language input, enabling interactive iterative editing.
[0052] The ReAct agent continuously listens for and captures various modification feedback commands submitted by users. Upon receiving user modification requests, the inference module immediately initiates semantic parsing to identify all the user's modification intentions. These intentions cover various editing types, including adding or deleting questions, adjusting question stems, changing option structures, switching answer formats, configuring logical jumps, and rearranging question order. For typical optimization requests from users, such as changing open-ended fill-in-the-blank questions about annual family income to multi-level range single-choice questions, or adding attribute questions about poverty-stricken households and monitored households at the end of the population information module, the inference module can accurately break down and categorize these requests.
[0053] After clarifying the specific modification intent, the action module matches and calls the corresponding tool units based on the modification type, including question modification tools and question addition tools, to incrementally and finely update the questionnaire JSON structure maintained internally by the dynamic questionnaire builder. Each time a single or multiple modification operations are completed, a corresponding standardized change event is generated to record the specific content and changed attributes of this questionnaire structure adjustment.
[0054] This application employs an event-based sourcing mechanism to achieve end-to-end state synchronization. The dynamic questionnaire builder continuously subscribes to the full change event stream and updates the underlying JSON Schema structure data of the questionnaire item by item according to the event content. Simultaneously, the real-time preview generator continuously monitors the data change status of the JSON Schema. Once it detects a change in the questionnaire structure, field parameters, or question type content, it immediately triggers a re-rendering of the front-end interface, achieving real-time synchronous updates between questionnaire editing and interface preview, forming a continuous iterative mechanism of building, modifying, and previewing simultaneously.
[0055] The above modification, update, and preview process can be executed repeatedly, with each iteration strictly following the established procedures. Figure 3 The diagram illustrates a closed-loop workflow of thinking, action, and observation. After completing a single modification and interface refresh, the intelligent agent can proactively push refined optimization suggestions based on the current questionnaire structure, guiding users to complete deeper level of caliber standardization and parameter optimization. In this embodiment, after adjusting the income question type and adding policy attribute questions, the system proactively prompts the user whether they need to supplement the unit of measurement and numerical precision specifications for the contracted land area field. After the user confirms the optimization requirements, the field attributes are updated and the preview interface is refreshed simultaneously, further improving the questionnaire's standardization and rigor.
[0056] Once the user has reviewed and confirmed that the current questionnaire structure, question content, and overall layout meet the survey requirements, they can issue a confirmation command through the interaction layer, triggering... Figure 3Upon completion of the corresponding action branch, the iteration loop terminates and the current questionnaire version is solidified, outputting the final standardized questionnaire structure. This invention supports exporting results in multiple formats, including JSON for system backend integration, PDF for offline paper distribution, and a standardized questionnaire format compatible with batch import from mainstream third-party questionnaire platforms. Simultaneously, a complete ReAct loop log is retained for the entire questionnaire design cycle. Each log entry records the reasoning, tool execution actions, and observation and analysis results for each iteration, ensuring full traceability of the questionnaire design basis, modification process, and iteration logic. This provides comprehensive data support and process documentation for government research review, policy evaluation verification, and subsequent template iteration optimization.
[0057] Example 2 This invention provides a questionnaire survey system based on ReAct agents. Figure 4 This is a schematic diagram of the structure of a questionnaire survey system based on ReAct agents provided in an embodiment of the present invention. Figure 4 As shown, the system includes: The questionnaire database construction unit 100 is used to pre-build a two-level questionnaire database and a corresponding retrieval vector database, wherein the two-level questionnaire database includes a general questionnaire database and a domain questionnaire database, and the retrieval vector database stores the embedding vectors obtained by converting the questionnaire database content and corresponding tags. The agent initialization unit 200 is used to receive the natural language instruction from the user to create a questionnaire and initialize the ReAct agent instance, which includes a reasoning module, an action module and an observation module. The requirement clarification unit 300 is used to analyze the natural language instructions through the reasoning module, identify existing information and determine information gaps, call the questioning tool through the action module to generate follow-up questions and clarify user needs, and have the observation module parse user responses to complete the questionnaire requirement information. The template matching and fusion unit 400 is used to generate a tag vector based on the completed questionnaire requirement information, match the questionnaire template in the two-level questionnaire database based on the retrieval vector library, and perform fusion processing on the matched templates to generate an initial questionnaire structure. The iterative generation unit 500 is used to render the initial questionnaire structure into a visual preview interface, continuously receive modification feedback submitted by the user, and the ReAct agent cyclically executes the thinking-action-observation process to complete the questionnaire modification and synchronously updates the preview interface. After the user confirms, the final questionnaire structure is output, and the questionnaire is completed.
[0058] Regarding the system in the above embodiments, the specific manner in which each unit performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0059] Example 3 To implement the methods of the above embodiments, the present invention also provides an electronic device, which includes a memory and a processor; wherein the processor reads executable program code stored in the memory to run a program corresponding to the executable program code, so as to implement the various steps of the methods described above.
[0060] Example 4 To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the method described in the foregoing embodiments.
[0061] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0062] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0063] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
Claims
1. A questionnaire survey method based on ReAct agents, characterized in that, include: A two-level questionnaire database and a corresponding retrieval vector database are pre-constructed. The two-level questionnaire database includes a general questionnaire database and a domain-specific questionnaire database. The retrieval vector database stores the embedding vectors obtained by converting the questionnaire database content and corresponding tags. Receive natural language instructions from users to create questionnaires and initialize a ReAct agent instance, which includes a reasoning module, an action module, and an observation module; The reasoning module analyzes the natural language instructions, identifies existing information and determines information gaps, the action module calls the questioning tool to generate follow-up questions and clarify user needs, and the observation module analyzes user responses to complete the questionnaire's needs information. A tag vector is generated based on the completed questionnaire requirements information. A questionnaire template is matched in the two-level questionnaire database based on the retrieval vector library. The matched templates are then fused to generate an initial questionnaire structure. The initial questionnaire structure is rendered into a visual preview interface, continuously receiving modification feedback submitted by the user. The ReAct agent cyclically executes the thinking-action-observation process to complete the questionnaire modification and updates the preview interface simultaneously. After the user confirms, the final questionnaire structure is output, and the questionnaire is completed.
2. The method according to claim 1, characterized in that, A two-tiered questionnaire database and a corresponding retrieval vector database are pre-built, including: Collect cross-domain common standard question templates. The standard question templates include at least demographic information templates, satisfaction scale templates, net promoter score templates, and behavior frequency templates. Each template item contains a question ID, question text, a list of options and their codes, question type fields, and applicable tags, forming a general questionnaire library. Professional questionnaire templates are organized by industry or application scenario. In addition to the same fields as the general questionnaire library, each template item is also associated with domain tags, target audience tags and measurement dimension tags, thus forming a domain questionnaire library. For each template question in the two-level questionnaire database, the combination of its domain label, audience label, and dimension label is converted into a first embedding vector and stored in the first vector index; For each questionnaire template, its questionnaire title, questionnaire description, and tag combination are converted into a second embedded vector and stored in the second vector index. The first vector index and the second vector index together constitute the retrieval vector library.
3. The method according to claim 2, characterized in that, The process of initializing a ReAct agent instance includes: An independent ReAct agent is instantiated for each user session, enabling the reasoning module to analyze the currently known information and information gaps based on a large language model and output the conclusions. Configure multiple callable utility functions for the action module, including a question-and-answer tool, a questionnaire template matching tool, a question modification tool, and a completion tool. Each utility function defines its input and output interfaces in JSON Schema format. The observation module is used to analyze the execution results of the action module, update the current session state, and use the observation results as input for the next round of reasoning, forming a closed-loop iterative architecture of thinking-action-observation.
4. The method according to claim 3, characterized in that, The action module invokes a questioning tool to generate follow-up questions and clarify user needs. The observation module then analyzes the user's responses to complete the questionnaire's information, including: A pre-built question-asking strategy library is provided, which contains three types of question-asking templates: missing information question-asking templates, refined question-asking templates, and option-generated question-asking templates. Each type of template stores multiple semantic variations and corresponding fill slots. Once the inference module identifies an information gap, it dynamically selects a question template that matches the type of information gap from the question strategy library, and fills in the specific content of the template based on the acquired user information to generate follow-up question text. The action module calls the questioning tool to output follow-up questions, and then the observation module receives the user's reply and parses the key information fields in it to complete at least one of the following: survey scope, property collection granularity, expected questionnaire length, and policy attribute identifier, forming complete questionnaire requirement information.
5. The method according to claim 4, characterized in that, A tag vector is generated based on the completed questionnaire requirements information. A questionnaire template is matched against the two-level questionnaire database using the retrieval vector library. The matched templates are then fused to generate an initial questionnaire structure, including: Input the complete questionnaire requirements information into the reasoning module, and the large language model will parse it to generate multi-dimensional label vectors. The dimensions of the label vectors include at least domain dimension, population dimension and measurement dimension, and each dimension is assigned a configurable weight coefficient. Using the tag vectors, a similarity search is performed in the retrieval vector library. A similarity threshold is set, and template questions or questionnaire templates with similarity scores higher than the threshold are recalled. The templates are then sorted in descending order of similarity scores, and the top N results are taken. Multiple matching templates are merged, including deduplication to remove duplicate items, merging similar items by dimension, and conflict resolution, ultimately generating the initial questionnaire structure.
6. The method according to claim 5, characterized in that, The initial questionnaire structure is rendered as a visual preview interface, continuously receiving user-submitted modification feedback. The ReAct agent iteratively executes a think-action-observation process to complete the questionnaire modification and simultaneously updates the preview interface. After user confirmation, the final questionnaire structure is output, including: The initial questionnaire structure is rendered into a visual preview interface, which allows users to submit modification feedback by clicking the edit button or through natural language dialogue. The system receives modification feedback submitted by users, and the reasoning module parses the modification intentions contained therein. The modification intentions include at least adding questions, deleting questions, modifying questions, adjusting options, adding jump logic, and rearranging the order of questions. Based on the parsed modification intent, the modification question tool or the addition question tool in the action module are called sequentially to incrementally update the current questionnaire structure and generate corresponding modification events; An event sourcing model is used to maintain the event flow, enabling the dynamic questionnaire builder to subscribe to the event flow and apply changes to update the questionnaire's JSON schema. At the same time, the preview generator listens for changes in the JSON schema and immediately re-renders the preview interface, achieving synchronous updates while creating and previewing. Repeat the steps of receiving feedback, parsing intent, calling tools, updating events, and refreshing the preview until the user's confirmation instruction is received, output the final questionnaire structure, and complete the questionnaire creation.
7. A questionnaire survey system based on ReAct agents, characterized in that, include: The questionnaire database construction unit is used to pre-build a two-level questionnaire database and a corresponding retrieval vector database, wherein the two-level questionnaire database includes a general questionnaire database and a domain questionnaire database, and the retrieval vector database stores the embedding vectors obtained by converting the questionnaire database content and corresponding tags. The agent initialization unit is used to receive the natural language instruction from the user to create a questionnaire and initialize the ReAct agent instance, which includes a reasoning module, an action module and an observation module. The requirement clarification unit is used to analyze the natural language instructions through the reasoning module, identify existing information and determine information gaps, call the questioning tool through the action module to generate follow-up questions and clarify user needs, and have the observation module parse user responses to complete the questionnaire requirement information. The template matching and fusion unit is used to generate a tag vector based on the completed questionnaire requirement information, match the questionnaire template in the two-level questionnaire database based on the retrieval vector library, and perform fusion processing on the matched templates to generate an initial questionnaire structure. The iterative generation unit is used to render the initial questionnaire structure into a visual preview interface, continuously receive modification feedback submitted by the user, and the ReAct agent cyclically executes the thinking-action-observation process to complete the questionnaire modification and update the preview interface simultaneously. After the user confirms, the final questionnaire structure is output, and the questionnaire is completed.
8. The system according to claim 7, characterized in that, The questionnaire database construction unit is also used for: Collect cross-domain common standard question templates. The standard question templates include at least demographic information templates, satisfaction scale templates, net promoter score templates, and behavior frequency templates. Each template item contains a question ID, question text, a list of options and their codes, question type fields, and applicable tags, forming a general questionnaire library. Professional questionnaire templates are organized by industry or application scenario. In addition to the same fields as the general questionnaire library, each template item is also associated with domain tags, target audience tags and measurement dimension tags, thus forming a domain questionnaire library. For each template question in the two-level questionnaire database, the combination of its domain label, audience label, and dimension label is converted into a first embedding vector and stored in the first vector index; For each questionnaire template, its questionnaire title, questionnaire description, and tag combination are converted into a second embedded vector and stored in the second vector index. The first vector index and the second vector index together constitute the retrieval vector library.
9. An electronic device, characterized in that, Including processor and memory; The processor reads executable program code stored in the memory to run a program corresponding to the executable program code, so as to implement the method as described in any one of claims 1-6.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.