Legal document generation method and system, electronic equipment and storage medium
By using two agents to work together, key information is extracted and task chains are executed, the problems of low efficiency and difficult to guarantee the quality of legal documents in the existing technology are solved, and efficient, accurate and interpretable legal documents are achieved.
Patent Information
- Application Number
- CN202510527766.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2045-04-25
AI Technical Summary
The prior art has low efficiency, difficult to guarantee quality, and lacks explanatory ability when generating factor-based legal documents.
Two agents work together: the first agent Agent is used to extract key information from multi-source heterogeneous data, and the second agent Agent performs subtasks in the task chain based on the extracted information and preset legal information, and generates factor-based legal documents.
It improves the efficiency and quality of legal documents, makes the generation process interpretable, can accurately and accurately deal with complex legal issues, and reduces human errors.
Smart Images

Figure CN120087345A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and particularly to a method, system, electronic device, and storage medium for generating legal documents. Background Art
[0002] Element-based legal documents (including complaints and responses) are a type of tabular legal documents. When generating or creating element-based legal documents, it is necessary to extract the information required for element-based legal documents from multi-source heterogeneous data (such as documents, images, videos, etc.), and then fill in this information into the template file of the element-based legal document to obtain the element-based legal document.
[0003] Currently, the methods for generating element-based legal documents mainly include manual extraction and filling methods, rule matching methods, and methods of automatically generating based on general large models / fine-tuned large models.
[0004] 1. Regarding the manual extraction and filling method. This method mainly involves the user manually extracting information from multi-source heterogeneous data and manually filling in this information into the template file of the legal document. Therefore, this method is time-consuming and laborious, and is prone to errors. Especially when the number of legal cases is relatively large and / or relatively complex, it is difficult to ensure the acquisition efficiency and quality of legal documents.
[0005] 2. Regarding the rule matching method. This method mainly involves pre-defining some rules / templates, using these rules / templates to extract information from multi-source heterogeneous data, that is, obtaining information that meets the rules / templates, and then filling in this information into the template file of the element-based legal document. Although this method is relatively simple and intuitive, it is relatively mechanical and difficult to apply to the diverse expressions of the same information in different materials. For example, the same information may be expressed differently in different documents, and the corresponding rule / template only covers one of the expressions. Then, when using this rule / template to extract information from each document, it may not be possible to accurately extract this information from each document. In addition, it is difficult for rules / templates to cover all situations, and they need to be updated and maintained frequently.
[0006] 3. Regarding the method of automatically generating based on fine-tuned large models.
[0007] Methods for fine-tuning large language models usually fine-tune (or train the model) a general large language model in the form of question-and-answer pairs with the facts of legal cases and application conclusions. Although this method can improve the performance of general large language models to a certain extent, it also has obvious limitations: (1) The intermediate steps are uncontrollable: Traditional fine-tuning mainly focuses on the direct mapping relationship between the input and output, ignoring the intermediate reasoning steps. This "black box" training method makes the model lack transparency and interpretability when dealing with complex tasks. (2) The quality is uncontrollable: Due to the lack of control over the intermediate steps, the model may produce logically incoherent or unrealistic results when generating results. Especially in the field of law where high requirements are placed on logic and accuracy, this uncontrollability may lead to serious problems. (3) Knowing what but not why: Although the model trained by traditional fine-tuning can generate results, it cannot clearly explain its reasoning process. Such a model lacking transparency is difficult to gain the trust of users in practical applications, especially in scenarios where the basis for decision-making needs to be explained.
[0008] Accordingly, a new technical solution is needed in this field to solve the above problems. Summary of the Invention
[0009] To overcome the above defects, this application is proposed to solve or at least partially solve the following technical problems: how to improve the generation efficiency and quality of element-based legal documents and make the generation process of element-based legal documents interpretable.
[0010] In a first aspect, a method for generating legal documents is provided, the method comprising: Obtain the case information and case claims of the case to be processed; Use a first intelligent agent to extract key information from the case information to obtain the key information in the case information; Determine the claim task of the case to be processed according to the case claims; Decompose the claim task into multiple subtasks, analyze the dependency relationships between the multiple subtasks, and determine the execution order of the multiple subtasks according to the dependency relationships; Link the multiple subtasks according to the execution order of the multiple subtasks to form a task chain corresponding to the claim task; Use a second intelligent agent and execute each subtask in the task chain according to the key information and preset legal information to obtain the task result of the claim task; Fill in information in the template of the element-based legal document according to the task result and the key information, and generate the element-based legal document of the case to be processed according to the template with the information filled in.
[0011] In a technical solution of the above legal document generation method, the case information includes multiple types of sub-information, there are multiple first agents, and the multiple first agents correspond to multiple information types one by one. Using the first agent to extract key information from the case information to obtain the key information in the case information includes: For each type of sub-information in the case information, obtain the first agent corresponding to the type of the sub-information, and use the first agent to extract key information from the sub-information to obtain the key information in the sub-information.
[0012] In a technical solution of the above legal document generation method, analyzing the dependency relationships between the multiple subtasks includes: If the input of a first subtask includes the output of a second subtask, then the first subtask depends on the second subtask; otherwise, the first subtask does not depend on the second subtask; Wherein, the first subtask and the second subtask are both any one of the multiple subtasks, and the first subtask is different from the second subtask.
[0013] In a technical solution of the above legal document generation method, determining the execution order of the multiple subtasks according to the dependency relationships includes: If a first subtask depends on a second subtask, then the execution order of the second subtask takes precedence over the execution order of the first subtask; Wherein, the first subtask and the second subtask are both any one of the multiple subtasks, and the first subtask is different from the second subtask.
[0014] In a technical solution of the above legal document generation method, determining the execution order of the multiple subtasks according to the dependency relationships includes: Successively take each subtask in the multiple subtasks as the current subtask, and determine the dependency degree of the current subtask according to the dependency relationships between the current subtask and other subtasks; If the current subtask depends on other subtasks and is also depended on by other subtasks, then the dependency degree is the highest; If the current subtask depends on other subtasks or is depended on by other subtasks, then the dependency degree is the second highest; If the current subtask does not depend on other subtasks and is not depended on by other subtasks, then the dependency degree is the lowest; Determine the priority of the current subtask according to the dependency degree, and the priority is positively correlated with the dependency degree; Arrange the execution order of the multiple subtasks in sequence according to the descending order of the said priorities; if, when arranging, the priority of the first subtask is higher than or equal to the priority of the second subtask, but the first subtask depends on the second subtask, then make the execution order of the second subtask prior to the execution order of the first subtask; Wherein, both the first subtask and the second subtask are any one of the multiple subtasks, and the first subtask is different from the second subtask.
[0015] In a technical solution of the above legal document generation method, there are multiple second agents, and the second agents are adopted and each subtask in the task chain is executed according to the key information and the preset legal information to obtain the task result of the claim task, including: Determine the task type of each subtask in the task chain according to the dependency relationship between the multiple subtasks; if the current subtask in the task chain does not depend on other subtasks, the task type of the current subtask is a parallel task; otherwise, the task type of the current subtask is a serial task; the current subtask is any one of the subtasks in the task chain, and the other subtasks are the remaining subtasks in the task chain except the current subtask; When there are multiple parallel tasks in the task chain, use multiple second agents to execute each parallel task in the multiple parallel tasks in parallel respectively.
[0016] In a technical solution of the above legal document generation method, the method further includes task monitoring by the following means: Monitor the execution status of each subtask in the task chain; If it is monitored that an exception occurs during the execution of the current subtask in the task chain, obtain an exception handling mechanism corresponding to the type of the exception, use the exception handling mechanism to handle the current subtask, and suspend the execution of the target subtask, wherein the current subtask is any one of the subtasks in the task chain, and the target subtask is the other subtask that is executed after the current subtask in the task chain; If it is monitored that the current subtask fails to execute, re-execute the current subtask.
[0017] In a technical solution of the above legal document generation method, the disassembling the claim task into multiple subtasks includes: Based on the claim task and the first to the i-th subtasks, a plurality of (i + 1)-th subtasks are predicted, where i ≥ 2, and the first subtask is predicted based on the claim task; wherein, the input of the (i + 1)-th subtask includes the output of the i-th subtask.
[0018] In a technical solution of the above legal document generation method, the predicting a plurality of (i + 1)-th subtasks according to the claim task and the first to the i-th subtasks includes: obtaining the task characteristics of the claim task and the first to the i-th subtasks; using the function call mechanism of the large language model, and predicting at least one of the plurality of (i + 1)-th subtasks according to the task characteristics; And / or, the predicting a plurality of (i + 1)-th subtasks according to the claim task and the first to the i-th subtasks includes: obtaining the text description information of the claim task and the first to the i-th subtasks; inputting the text description information into the large language model for processing, and predicting at least one of the plurality of (i + 1)-th subtasks; And / or, The predicting a plurality of (i + 1)-th subtasks according to the claim task and the first to the i-th subtasks includes: obtaining target legal information related to the claim task from a preset legal knowledge base, where the legal knowledge base is used to store legal information, and the legal information includes legal provisions and cases; predicting at least one of the plurality of (i + 1)-th subtasks based on the target legal information and according to the claim task and the first to the i-th subtasks.
[0019] In a second aspect, a legal document generation system is provided, and the system includes an information input module, a perception module, a planning module, and a document generation module; The information input module is configured to: obtain the case information and the case claim of the case to be processed; The perception module is configured to: use a first intelligent agent to extract key information from the case information to obtain the key information in the case information; The planning module is configured to: determine the claim task of the case to be processed according to the case claim; decompose the claim task into a plurality of subtasks, analyze the dependency relationship between the plurality of subtasks, and determine the execution order of the plurality of subtasks according to the dependency relationship; link the plurality of subtasks according to the execution order of the plurality of subtasks to form a task chain corresponding to the claim task; use a second intelligent agent, and execute each subtask in the task chain according to the key information and the preset legal information to obtain the task result of the claim task; The document generation module is configured to: fill in information in the template of the element-based legal document according to the task result and the key information, and generate the element-based legal document of the case to be processed according to the template with the information filled in.
[0020] In a technical solution of the above legal document generation system, the system further includes a memory module and / or a decision-making module; The memory module is configured to: store the key information, the execution results of each subtask in the task chain, and the task result of the claim task; The decision-making module is configured to: monitor the execution status of each subtask in the task chain; If it is monitored that an exception occurs during the execution of the current subtask in the task chain, an exception handling mechanism corresponding to the type of the exception is obtained, and the current subtask is processed by using the exception handling mechanism, and the execution of the target subtask is paused, where the current subtask is any subtask in the task chain, and the target subtask is other subtasks in the task chain that are executed after the current subtask; If it is monitored that the execution of the current subtask fails, the current subtask is re-executed.
[0021] In a third aspect, an electronic device is provided, which includes at least one processor; and a memory communicatively connected to the at least one processor; wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method described in any one of the technical solutions provided in the first aspect above is implemented.
[0022] In a fourth aspect, a computer-readable storage medium is provided, which stores multiple pieces of program code, and the program code is suitable for being loaded and run by a processor to execute the method described in any one of the technical solutions provided in the first aspect above.
[0023] One or more of the above technical solutions of the present application have at least one or more of the following beneficial effects: In a technical solution for implementing the legal document generation method provided in this application, case information and case demands of a case to be processed can be obtained; a first intelligent agent is used to extract key information from the case information to obtain the key information in the case information; according to the case demands, the demand tasks of the case to be processed are determined; the demand tasks are disassembled into multiple subtasks, and the dependency relationships between the multiple subtasks are analyzed, and the execution order of the multiple subtasks is determined according to the dependency relationships; the multiple subtasks are linked according to the execution order of the multiple subtasks to form a task chain corresponding to the demand tasks; a second intelligent agent is used, and each subtask in the task chain is executed according to the key information and the preset legal information to obtain the task result of the demand tasks; according to the task result and the key information, the template of the element-based legal document is filled with information, and the element-based legal document of the case to be processed is generated according to the template with the information filled in.
[0024] The above implementation can automatically extract the information required for the element-based legal document from the case information and case demands of the case to be processed, and automatically fill the information into the template of the element-based legal document according to this information. Compared with the manual extraction and filling methods in the prior art, the above implementation can greatly improve the acquisition efficiency and quality of legal documents.
[0025] The above implementation uses a first intelligent agent to extract key information from the case information. Even if the expression of the same key information is different in different case information, the key information can be accurately extracted from different case information. Compared with the rule matching method in the prior art, the above implementation is more flexible when extracting key information, can extract key information more accurately and reliably, and at the same time, since there is no need to predefine rules / templates, there is no need to frequently update and maintain these rules / templates.
[0026] The above implementation disassembles a complex demand task into multiple subtasks, and then links the multiple subtasks in their respective execution order to form a task chain. The execution process of this task chain is equivalent to the process of inferring the case demand result from the case information, and a subtask is equivalent to an intermediate step of the above process, and the execution result of the subtask is the result of the intermediate step. According to the results of each intermediate step, the user can accurately understand how to infer the task result from the case information, so that the task result is interpretable. In addition, when the task result is logically incoherent or does not meet the actual requirements, the subtasks in the task chain (that is, control the intermediate steps) can be adjusted to optimize the task result and ensure the quality of the task result. Description of the Drawings
[0027] With reference to the accompanying drawings, the disclosure of the present application will become more readily understandable. It is easily understood by those skilled in the art that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present application. Among them: Figure 1 is a schematic flowchart of the main steps of a legal document generation method according to an embodiment of the present application; Figure 2 is a schematic diagram of a task chain according to an embodiment of the present application Figure 1 ; Figure 3 is a schematic flowchart of the main steps of determining the execution order of multiple subtasks according to an embodiment of the present application; Figure 4 is a schematic flowchart of the main steps of executing each subtask in the task chain according to an embodiment of the present application; Figure 5 is a schematic diagram of a task chain according to an embodiment of the present application Figure 2 ; Figure 6 is a schematic flowchart of the main steps of task monitoring when executing the task chain according to an embodiment of the present application; Figure 7 is a main structural block diagram of a legal document generation system according to an embodiment of the present invention; Figure 8 is a main structural block diagram of a legal document generation system according to another embodiment of the present invention; Figure 9 is a main structural schematic diagram of an electronic device according to an embodiment of the present application.
[0028] Reference numerals: 11: Information input module; 12: Sensing module; 13: Planning module; 14: Document generation module; 15: Memory module; 16: Decision-making module; 21: Memory; 22: Processor. Detailed embodiments
[0029] The following describes some embodiments of the present application with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the scope of protection of the present application.
[0030] In the description of the present application, "module" and "processor" may include hardware, software, or a combination of both. A module may include a hardware circuit, various appropriate sensors, communication ports, memory, and may also include a software part, such as program code, or may be a combination of software and hardware. A processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other appropriate processor. The processor has data and / or signal processing functions. The processor may be implemented in software, in hardware, or in a combination of both. A computer-readable storage medium includes any appropriate medium that can store program code, such as magnetic disks, hard disks, optical discs, flash memories, read-only memories, random access memories, and so on. The term "A and / or B" represents all possible combinations of A and B, such as only A, only B, or A and B.
[0031] The embodiments of the legal document generation method provided by the present application will be described below.
[0032] Refer to the appendix Figure 1 , Figure 1 is a schematic diagram of the main steps of the legal document generation method according to an embodiment of the present application. As Figure 1 shown, the legal document generation method in the embodiments of the present application mainly includes the following steps S101 to S107.
[0033] Step S101: Obtain the case information and case claims of the case to be processed.
[0034] The case to be processed may be a civil case to be processed, such as a divorce case, a contract dispute case, an inheritance dispute case, etc.
[0035] The case information may be information related to the case to be processed provided by a user (such as a party to the case or a legal practitioner). The case information should contain as much information as possible related to the case to be processed to avoid missing any important details that may affect the outcome of the case. Taking a divorce case as an example, the case information may include, but is not limited to: identification documents of both spouses, marriage certificate, identification documents of children, pre-marital property certificate, post-marital property and debts, and other information.
[0036] The case claim refers to the litigation request. Taking a divorce case as an example, the case claim may include: requesting a divorce from the defendant, the plaintiff raising the daughter, and dividing the marital joint property of X yuan.
[0037] Step S102: Use the first intelligent agent to extract key information from the case information to obtain the key information in the case information.
[0038] The first intelligent agent is a network model constructed using artificial intelligence technology, and the first intelligent agent has the ability to extract information from case information. For example, the first intelligent agent is a large language model (LLM).
[0039] In some embodiments, the case information may include multiple types of sub-information, and there may also be multiple first intelligent agents, and the multiple first intelligent agents correspond one-to-one with multiple information types, and the multiple information types include the types of the above-mentioned sub-information. For each type of sub-information in the case information, a first intelligent agent corresponding to the type of the sub-information can be obtained, and the first intelligent agent is used to extract key information from the sub-information to obtain the key information in the sub-information. Through this embodiment, in the case where the case information has multiple types of sub-information, the intelligent agents corresponding to each type of sub-information can be used to perform information extraction in parallel, effectively improving the extraction efficiency.
[0040] In some embodiments, for each type of sub-information, the type of key information to be extracted from the sub-information can be preset in advance, and then the sub-information is extracted according to the type of key information. Taking a divorce case as an example, Table 1 below exemplarily shows multiple types of sub-information in the case information, the labels (or types) of each type of sub-information, and the types of key information in each type of sub-information.
[0041] Table 1
[0042] Step S103: Determine the claim task of the case to be processed according to the case claim. Specifically, the claim content of the case claim can be used as the claim task.
[0043] Step S104: Decompose the claim task into multiple subtasks, analyze the dependency relationships between the multiple subtasks, and determine the execution order of the multiple subtasks according to the dependency relationships.
[0044] When decomposing the claim task, the reasoning steps required to infer the task result of the claim task from the input information can be determined first, and each reasoning step is used as a subtask. When there are multiple claim tasks, each claim task can be decomposed into multiple subtasks, and different claim tasks may have the same subtasks. In this case, only one subtask can be set, and different claim tasks share this one subtask. Taking a divorce case as an example, if the claim task is that the wife requires the husband to leave the house clean, this claim task can be decomposed into subtasks such as judging whether the couple's relationship has broken down, whether there is a fault party, the custody of children, and property division.
[0045] The dependency relationship between two subtasks is used to describe whether one subtask (hereinafter described as the first subtask) depends on another subtask (hereinafter described as the second subtask); if the first subtask depends on the second subtask, it means that the execution of the first subtask requires the use of the result of the second subtask, and the second subtask needs to be executed first and then the first subtask, that is, the execution order of the second subtask takes precedence over that of the first subtask; if the first subtask and the second subtask do not depend on each other, then there is no restriction on the execution order between the first and second subtasks, and even the two can be executed in parallel. Among them, the first and second subtasks are both any one of the above-mentioned multiple subtasks, and the first and second subtasks are different.
[0046] In some embodiments, when analyzing the dependency relationship between the first and second subtasks, the inputs and outputs of the first and second subtasks can be analyzed; if the input of the first subtask includes the output of the second subtask, it means that the first subtask needs to directly use the result of the second subtask to execute, so the first subtask depends on the second subtask; otherwise, the first subtask does not depend on the second subtask. Taking a divorce case as an example, the first and second subtasks are respectively "judging whether the feelings between the husband and wife have broken down" and "property division". When performing property division, the result of whether the feelings between the husband and wife have broken down needs to be used. Therefore, "property division" depends on "judging whether the feelings between the husband and wife have broken down", and "judging whether the feelings between the husband and wife have broken down" is executed first, and then "property division" is executed. Step S105: Link the multiple subtasks according to the execution order of the multiple subtasks to form a task chain corresponding to the claim task. Specifically, each subtask is linked in sequence according to its own execution order to form a task chain.
[0047] Step S106: Adopt a second intelligent agent Agent, and execute each subtask in the task chain according to the key information and the preset legal information to obtain the task result of the claim task.
[0048] The second intelligent agent Agent is a network model constructed using artificial intelligence technology. The second intelligent agent Agent can execute the operations of the subtasks according to the input information of the subtasks to obtain the execution results of the subtasks. The execution result of the subtask arranged last in the execution order in the task chain can be used as the task result of the claim task. Taking a divorce case as an example, the claim task is that the woman requests the man to leave the house clean. This claim task is disassembled into four subtasks: judging whether the feelings between the husband and wife have broken down, whether there is a fault party, the custody of children, and property division, which are executed in sequence from first to last. When the subtask of property division is completed, the result of property division can be used as the task result of the claim task.
[0049] Refer to the appendix Figure 2 , Figure 2Exemplarily, the task chains corresponding to three claim tasks are shown, and three second intelligent agents Agent ( Figure 2 the Agent 1, Agent 2, and Agent 3 in Figure 2 are respectively used to execute the subtasks in three task chains. Among them, one task chain includes four subtasks executed in sequence from first to last ( Figure 2 Tasks 1 to 4 in Figure 2 ), one task chain includes two subtasks executed in sequence from first to last (
[0050] Tasks 5 to 6 in
[0051] ), and one task chain only includes one subtask (
[0052] Task 7 in
[0053]
[0054] ). The task results of the three claim tasks respectively include the execution results w7, w10, and w11 of Task 4, Task 6, and Task 7. In some embodiments, a legal knowledge base can be set up. The legal knowledge base stores legal provisions and cases. The preset legal information can include the legal provisions and cases in the legal knowledge base related to the case type of the case to be processed. Taking a divorce case as an example, the legal provisions related to the divorce case can include the legal provisions recorded in the "Civil Code", the "Marriage Law", etc. In some embodiments, when obtaining legal provisions and cases from the legal knowledge base, keywords of the case to be processed can be obtained, and the legal provisions and cases recorded in the legal knowledge base are matched according to the keywords to obtain the legal provisions and cases matching the case to be processed; or, the similarity between the case to be processed and the cases recorded in the legal knowledge base can also be calculated, and the cases similar to the case to be processed are obtained according to the result of the similarity calculation. For example, if the keywords of the case to be processed contain words related to domestic violence, the relevant provisions in the "Civil Code" regarding divorce caused by domestic violence, as well as cases similar to the case to be processed, can be obtained. Step S107: Fill in information in the template of the element-based legal document according to the task result and key information, and generate the element-based legal document of the case to be processed according to the template with the information filled in. Specifically, the template with the information filled in can be used as the element-based legal document. Taking a divorce case as an example, the element-based legal document can be a complaint or a reply.Taking the complaint in a divorce case as an example, the complaint includes information about the parties, litigation requests and bases, agreed jurisdiction and litigation preservation, facts and reasons, etc. Among them, the information about the parties includes the information of the plaintiff (including name, gender, date of birth, etc.) and the information of the defendant (including name, gender, date of birth, etc.), and these information can be filled in according to the key information. The litigation requests and bases include community property of the couple, joint debts of the couple, child support, etc. These information may come from the key information or the task results. When filling in, the information to be filled in can be queried from the key information and the task results. The filling in of the contents such as agreed jurisdiction and litigation preservation, facts and reasons is similar to the above-mentioned information about the parties, litigation requests and bases, and will not be elaborated here.
[0055] The method described in the above steps S101 to S107 has the following technical effects: (1) The above method can automatically extract the information required for the element-based legal document from the case information and case demands of the case to be processed, and automatically fill in the information in the template of the element-based legal document according to this information, improving the acquisition efficiency and quality of the legal document.
[0056] (2) The above method uses the first intelligent agent Agent to extract key information from the case information. Even if the expression of the same key information is different in different case information, the key information can be accurately extracted from different case information.
[0057] (3) In the above method, the execution process of the task chain is equivalent to the process of inferring the case demand result from the case information. The execution result of the subtask in the task chain is the intermediate step result of this process. Based on each intermediate step result, the user can accurately understand how to infer the task result from the case information, making the task result interpretable. By means of multi-step reasoning, complex legal problems can be processed more accurately, avoiding legal risks caused by information loss or logical errors. In addition, when the task result is logically incoherent or does not meet the actual requirements, the subtasks in the task chain (i.e., controlling the intermediate steps) can be adjusted to optimize the task result, ensuring the quality of the task result, so that the generated legal document can accurately reflect the actual situation of the case to be processed and meet the legal requirements.
[0058] (4) The above method uses multiple intelligent agents to work together, which can efficiently complete the generation of legal documents. For example, the first intelligent agent is used to extract key information (such as extracting the identity information and property status of both spouses in a divorce case, etc.), and different task chains corresponding to different claim tasks can be executed by different second intelligent agents (such as performing the matching and application of legal rules to ensure that the generated legal documents meet the requirements of relevant laws and regulations such as the Civil Code). Through the division of labor and cooperation of multiple intelligent agents, the processing efficiency, stability, and reliability are improved.
[0059] Briefly speaking, the above method realizes the efficient and accurate automatic generation of element-based legal documents, provides powerful tool support for users (such as legal practitioners), and also brings higher efficiency and better legal protection to the handling of legal cases (such as civil cases), with broad application prospects and important social value. At the same time, each step and decision-making process in the process of task chain execution are transparent, and users can clearly understand how this method gradually derives the case result (Case Result, CR) from the case input (CaseInput set, CI), which provides higher credibility and acceptability for the practical application of this method.
[0060] Next, the embodiments of the legal document generation method provided in this application will be further described, specifically for the above steps S102, S104, and S106.
[0061] First, step S102 will be described.
[0062] In some embodiments of the above step S102, after extracting the key information, data cleaning processing, structuring processing, and vectorization processing can be sequentially performed on the key information to obtain the final key information and store the final key information.
[0063] Next, data cleaning processing, structuring processing, and vectorization processing will be described.
[0064] 1. Description of data cleaning processing.
[0065] Data cleaning processing can be used to remove invalid and redundant data in the key information, which is beneficial for the intelligent agent to improve the execution efficiency and accuracy when performing subtasks according to the key information.
[0066] In some embodiments, data cleaning processing may include object unification, duplicate removal, text error correction, removal of irrelevant information, format unification, and data integrity check.
[0067] The object is uniformly used for: When the same party appears in multiple documents (or multiple case information), the ID number of the party is used as the unique identifier of the party. Based on this, when information conflicts occur for the same party in different documents (or case information), according to the ID number of the party, obtain the information in the original ID record of the party, and use this information as the standard.
[0068] Duplicate removal processing is used for: By comparing case information, remove duplicate case information or duplicate key information to avoid interference with subsequent analysis and processing.
[0069] Text error correction is used for: Identify and correct misspelled words, wrong words, wrong serial numbers, etc. in case information.
[0070] Removal of irrelevant information is used for: Remove information irrelevant to the case such as headers, footers, advertisements, etc. in the document, as well as some redundant expressions and format content to make the data more concise and effective.
[0071] Format unification is used for: Format key information so that it conforms to a unified data format standard, facilitating subsequent structured processing and analysis. For example, unify the date into the "YYYY-MM-DD" format, and unify the amount into Arabic numerals, etc.
[0072] Data integrity check is used for: Check whether the key information extracted is complete. For missing information, supplement or mark it according to the actual situation to ensure data integrity so as to more comprehensively reflect the case situation.
[0073] 2. Explain the structured processing.
[0074] Structured processing can be used to convert the data structures of information of the same type into the same data structure, that is, unify the data structures of information of the same type, which is also conducive to improving the execution efficiency and accuracy of the intelligent agent Agent when performing subtasks according to key information. For example, the data structure of property information is property type and market value amount. Based on this, the data structure of premarital property can be converted into premarital property type and market value amount, and the data structure of post-marital property can be converted into post-marital property type and market value amount.
[0075] 3. Explain the vectorization processing.
[0076] Vectorization processing can be used to convert the key information that has been structured into a vector form. In some embodiments, an RAG (Retrieval-augmented Generation) model can be adopted to convert the key information into a vector form, and then the key information in vector form is stored as the final key information. In addition, when it is necessary to obtain a certain or certain key information, the RAG model can also be used for retrieval or query to quickly obtain the required key information.
[0077] Second, step S104 will be described.
[0078] In some embodiments of the above step S104, the appeal task can be disassembled into multiple subtasks by the following formula: Based on the appeal task and the 1st to the i-th subtasks, multiple (i + 1)-th subtasks are predicted, where i ≥ 2, and the 1st subtask is predicted based on the appeal task; among them, the input of the (i + 1)-th subtask includes the output of the i-th subtask.
[0079] That is to say, aiming at using the output of the i-th subtask as the input of the (i + 1)-th subtask, and at the same time combining the appeal task and all the subtasks that have been predicted before the i-th subtask, to predict the (i + 1)-th subtask. Based on this, each subtask can be gradually predicted, and the predicted order of each subtask is linked in sequence to form a task chain, which can be described as a Chain of Task Prediction (CoP).
[0080] In some embodiments, the (i + 1)-th subtask can be predicted in the following way: Obtain the task characteristics of the appeal task and the 1st to the i-th subtasks, adopt the function call mechanism of a large language model (LLM), and based on the task characteristics, predict at least one of the multiple (i + 1)-th subtasks.
[0081] Specifically, the functions used when the large language model makes function calls can be preset in advance. When it is necessary to predict the (i + 1)-th subtask, the large language model calls the above functions and processes them with the above task characteristics as function parameters to obtain the (i + 1)-th subtask. It should be noted that the function call mechanism of the large language model is a conventional function call method. For the form of the function, this application does not make specific limitations, and at the same time, for the content of the task characteristics, it also does not make specific limitations. Those skilled in the art can flexibly set the function form and the content of the task characteristics according to actual needs, as long as the subtasks can be predicted by calling the functions and based on the task characteristics.
[0082] In some embodiments, the (i + 1)-th subtask can be predicted in the following manner: Obtain the text description information of the claim task and the first to the i-th subtasks, input the text description information into a large language model (LLM) for processing, and predict at least one of the multiple (i + 1)-th subtasks. Herein, the text description information is the text used to describe the task content.
[0083] The large language model can reason about the above text description information and predict the (i + 1)-th subtask. In the embodiments of the present application, conventional model training methods can be used to enable the large language model to have this ability, and the model training method will not be elaborated herein.
[0084] In some embodiments, the (i + 1)-th subtask can be predicted in the following manner: Obtain the target legal information related to the claim task from a preset legal knowledge base, where the legal knowledge base is used to store legal information, and the legal information includes legal provisions and cases; based on the target legal information, and according to the claim task and the first to the i-th subtasks, predict at least one of the multiple (i + 1)-th subtasks. Taking a divorce case as an example, the legal provisions related to the divorce case may include the legal provisions recorded in the "Civil Code", the "Marriage Law", etc.
[0085] The case information of the case to be processed can be understood as internal information, and the legal information can be understood as external information. In some cases, the input of some tasks may include legal information in addition to internal information. At this time, the legal information that may be required can be obtained from the legal knowledge base, and the (i + 1)-th subtask can be determined in combination with the legal information. For example, if the task content of the (i - 1)-th subtask is to select the correct cited legal article, then the content of the predicted (i + 1)-th subtask is to perform property division based on the execution results of other tasks before the (i - 1)-th subtask (such as the result of determining whether the couple's relationship has broken down) and the cited legal article selected by the (i - 1)-th subtask.
[0086] In some embodiments of the above step S104, it can be determined the execution order of the multiple subtasks through Figure 3 the following steps S1041 to S1043 as shown.
[0087] Step S1041: Successively take each subtask among multiple subtasks as the current subtask, and determine the dependency degree of the current subtask according to the dependency relationship between the current subtask and other subtasks; if the current subtask depends on other subtasks and is also depended on by other subtasks, then the dependency degree is the highest; if the current subtask depends on other subtasks or is depended on by other subtasks, then the dependency degree is the second highest; if the current subtask does not depend on other subtasks and is not depended on by other subtasks, then the dependency degree is the lowest. Among them, other subtasks are the remaining subtasks among the multiple subtasks except the current subtask.
[0088] Step S1042: Determine the priority of the current subtask according to the dependency degree. Among them, the priority is positively correlated with the dependency degree, that is, the higher the dependency degree, the higher the priority, and the lower the dependency degree, the lower the priority.
[0089] In some embodiments, the corresponding relationship between the priority and the dependency degree can be preset in advance, and the priority corresponding to the dependency degree of the current subtask is obtained according to this corresponding relationship. Through this embodiment, the priority of the current subtask can be obtained quickly and accurately.
[0090] Step S1043: Arrange the execution order of multiple subtasks in descending order of priority; if when arranging, the priority of the first subtask is higher than or equal to the priority of the second subtask, but the first subtask depends on the second subtask, then make the execution order of the second subtask prior to the execution order of the first subtask. Since the first subtask depends on the second subtask, the output of the second subtask will be used as the input of the first subtask. If only the priority is considered, then the first subtask will be executed before the second subtask, and the output of the second subtask is missing during execution, which will ultimately cause the first subtask to execute failed. Considering this problem, in this embodiment, when arranging according to the priority, it will be judged whether there is a situation where "the priority of the first subtask is higher than or equal to the priority of the second subtask, but the first subtask depends on the second subtask". If this situation occurs, then make the execution order of the second subtask prior to the execution order of the first subtask to ensure that the subtasks can be executed normally. Among them, the first and second subtasks are both any one of the multiple subtasks, and the first and second subtasks are different.
[0091] For Figure 2Taking the task chain composed of Task 1 to Task 4 as an example, the degree of dependence of Task 2 and Task 3 is the highest, and the degree of dependence of Task 1 and Task 4 is the second. Based on this, the priorities of Task 2 and Task 3 are the same and both are the highest priorities; the priorities of Task 1 and Task 4 are the same and both are the lowest priorities. When arranging the execution order, first arrange the tasks with the highest priority, Task 2 and Task 3. Since Task 3 depends on Task 2, the execution order of Task 2 takes precedence over that of Task 3. When arranging, there is a situation where "the priority of Task 2 is higher than that of Task 1, but Task 2 depends on Task 1". Therefore, even though the priority of Task 2 is higher than that of Task 1, the execution order of Task 1 takes precedence over that of Task 2. Finally, the arrangement order is: Task 1, Task 2, Task 3, Task 4.
[0092] In addition, if the priorities of the first and second subtasks are the same and they do not depend on each other, then the execution orders of the first and second subtasks can be the same. For example, Figure 5 in the dependencies of Task 2 and Task 3 are the same, their priorities are the same, and Task 2 and Task 3 do not depend on each other, then the execution orders of Task 2 and Task 3 are the same.
[0093] Based on the method described in the above Step S1041 to Step S1043, it is possible to take into account both the priorities and dependencies of subtasks to determine the execution order of subtasks and ensure that each subtask can be executed normally.
[0094] Third, an explanation of Step S106 is given.
[0095] In some embodiments of the above Step S106, there are multiple second agents Agent, and through Figure 4 the following Step S1061 to Step S1062 shown, each subtask in the task chain is executed.
[0096] Step S1061: According to the dependencies between multiple subtasks, determine the task types of each subtask in the task chain. The task types include parallel tasks and serial tasks.
[0097] Specifically, if the current subtask in the task chain does not depend on other subtasks, the task type of the current subtask is a parallel task; otherwise, the task type of the current subtask is a serial task; the current subtask is any one of the subtasks in the task chain, and the other subtasks are the remaining subtasks in the task chain except the current subtask.
[0098] Step S1062: When there are multiple parallel tasks in the task chain, use multiple second agents Agent to execute each parallel task in the multiple parallel tasks in parallel.
[0099] Taking a divorce case as an example, both "custody of children" and "property division" are parallel tasks. In this case, two second agents can be used to execute these two subtasks in parallel. For another example, before property division, it is necessary to first determine whether the relationship between the husband and wife has broken down and whether there is a fault party. Property division is a serial task. It is necessary to first complete the subtasks of whether the relationship between the husband and wife has broken down and whether there is a fault party, and then execute the subtask of property division.
[0100] For another example, when dealing with a divorce case involving disputes over the custody of multiple children, multiple second agents can be used simultaneously to analyze and reason about the situation of each child, and finally summarize the results to generate a complete legal document.
[0101] See appendix Figure 5 , Task 2 and Task 3 are parallel tasks and can be executed by two second agents respectively; Task 1, Task 4, and Task 5 are all serial tasks and can be executed sequentially by one second agent. This second agent can be one of the two second agents used to execute Task 2 and Task 3, or a third second agent different from these two second agents.
[0102] Based on the method described in the above steps S1061 to S1062, multiple subtasks can be executed in parallel, improving the execution efficiency of the entire task chain and obtaining the task result as soon as possible.
[0103] Next, the embodiments of the legal document generation method provided by the present application will be further described. See appendix Figure 6 , In some embodiments according to the present application, when executing the task chain, it can be passed through Figure 6 The following steps S201 to S203 shown are used for task monitoring.
[0104] Step S201: Monitor the execution status of each subtask in the task chain.
[0105] The execution status may include: the start time of task execution, the end time of task execution, the execution progress, the execution result. The execution result may include whether an exception occurs, whether the execution is successful, and the task result when the execution is successful, etc. If it is detected that an exception occurs during the execution of the current subtask, go to step S202; if it is detected that the current subtask fails to execute, go to step S203. Among them, the current subtask is any subtask in the task chain.
[0106] Step S202: Obtain an exception handling mechanism corresponding to the type of the exception, use the exception handling mechanism to process the current subtask, and pause the execution of the target subtask. Here, the target subtask is other subtasks in the task chain that are executed after the current subtask.
[0107] In this embodiment, the corresponding relationship between the type of the exception and the exception handling mechanism can be preset in advance. According to this corresponding relationship, obtain the exception handling mechanism corresponding to the type when the current subtask has an exception, and use this exception handling mechanism for processing.
[0108] The type of the exception can include data loss, logical error, etc. Data loss means that the input information of the current subtask is missing, and logical error means that the information input to the current subtask is not the input information required by the current subtask, etc.
[0109] The exception handling mechanism corresponding to data loss can be to pause the execution of the current subtask and give a prompt so that the user can supplement information according to the prompt. For example, if it is found that the property information is incomplete in the "property division" task, the task execution will be paused, and the user will be prompted to supplement the relevant information. The exception handling mechanism corresponding to a logical error can be to pause the execution of the current subtask and give a prompt so that the user can adjust the input information of the current subtask. Those skilled in the art can flexibly set the type of the exception and the corresponding exception handling mechanism according to actual needs, and this embodiment does not make specific limitations in this regard.
[0110] Step S203: Re-execute the current subtask.
[0111] After detecting that the task execution fails, the task can be automatically re-executed, or the current subtask can be re-executed in response to the user's operation. In some embodiments, an electronic device can be used to execute the legal document generation method provided in this application. A control for user operation can be set on the display interface of the electronic device, and the user can perform operations such as clicking, dragging, and sliding on this control. The electronic device can re-execute the current subtask in response to this operation of the user.
[0112] In some embodiments, when detecting that the task execution fails, the execution failure information can be recorded. The execution failure information can include information such as the failure reason, so that the user can quickly take measures according to the execution failure information to ensure that the current subtask can be successfully executed. For example, the "custody of children" task fails due to incorrect input information, and the execution failure information can include the incorrect input information for the user to correct the information.
[0113] Based on the method described in the above steps S201 to S203, the execution status of each subtask can be monitored during the execution of the task chain to ensure the reliability of the task execution.
[0114] It should be noted that although the above embodiments describe the various steps in a specific order, those skilled in the art can understand that for the purpose of achieving the effects of the present application, the different steps do not necessarily have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders, and these adjusted solutions are equivalent technical solutions to the technical solutions described in the present application, and thus will also fall within the protection scope of the present application.
[0115] Those skilled in the art can understand that all or part of the processes in the method of implementing the above embodiments of the present application can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable storage medium can include: any entity or device, medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal, and software distribution medium, etc., that can carry the computer program code.
[0116] On the other hand, the present application also provides a legal document generation system.
[0117] Refer to the appendix Figure 7 , Figure 7 is the main structural block diagram of the legal document generation system according to an embodiment of the present invention. As Figure 7 shown, the legal document generation system in the embodiment of the present invention mainly includes an information input module 11, a perception module 12, a planning module 13, and a document generation module 14. The information input module 11 can be configured to obtain the case information and case demands of the case to be processed. The perception module 12 can be configured to use a first intelligent agent Agent to extract key information from the case information to obtain the key information in the case information. The planning module 13 can be configured to determine the demand tasks of the case to be processed according to the case demands; disassemble the demand tasks into multiple subtasks, analyze the dependency relationships between the multiple subtasks, and determine the execution order of the multiple subtasks according to the dependency relationships; link the multiple subtasks according to the execution order of the multiple subtasks to form a task chain corresponding to the demand tasks; use a second intelligent agent Agent, and execute each subtask in the task chain according to the key information and the preset legal information to obtain the task results of the demand tasks. The document generation module 14 can be configured to fill in information in the template of the element-based legal document according to the task results and the key information, and generate the element-based legal document of the case to be processed according to the template with the information filled in.
[0118] Descriptions of the specific implementation functions of the above modules can be referred to those described in steps S101 to S107. In some embodiments, one or more of the information input module 11, the perception module 12, the planning module 13, and the document generation module 14 may be combined into one module.
[0119] In some implementation manners, the legal document generation system may further include a memory module 15 and / or a decision-making module 16. The memory module 15 may be configured to store key information, execution results of each subtask in the task chain, and task results of the claim task. In some implementation manners, the execution results of the subtasks may not only include the determination of case facts (such as whether there is premarital property, marital joint debts, etc.), but also include a preliminary judgment on the application of law (such as according to the law, premarital property shall belong to the individual, etc.). The memory module 15 will perform associated memory on the execution results of all subtasks to provide support for the execution of subsequent subtasks. For example, when calculating marital property, the memory module 15 will remember information such as the source and appreciation of the property, so as to accurately handle it in accordance with the law during property division.
[0120] The decision-making module 16 may be configured to: monitor the execution status of each subtask in the task chain; if it is detected that an exception occurs during the execution of the current subtask in the task chain, obtain an exception handling mechanism corresponding to the type of the exception, use the exception handling mechanism to handle the current subtask, and suspend the execution of the target subtask, where the current subtask is any subtask in the task chain, and the target subtask is other subtasks that are executed after the current subtask in the task chain; if it is detected that the current subtask fails to execute, re-execute the current subtask. Descriptions of the specific implementation functions of the decision-making module 16 can be referred to those described in steps S201 to S203.
[0121] Next, in combination with the attached Figure 8 , the legal document generation system provided by this application will be described. Figure 8Exemplarily shown are a perception module 12, a planning module 13, a memory module 15, and a decision-making module 16. The scenario requirement is used to represent the type of case to be processed, and the scenario requirement instruction is used to indicate an instruction for generating an element-based legal document, which is a legal document for the type of case represented by the scenario requirement. The perception module 12 uses a first intelligent agent (Agent) to extract key information from the case information, obtains the key information in the case information, and stores the key information in the memory module 15. The planning module 13 can form a task chain corresponding to the claim task, and uses a second intelligent agent (Agent) to execute each subtask in the task chain according to the key information and the preset legal information, obtains the task result of the claim task, and stores the execution result of the subtask in the memory module 15 during the execution process. The decision-making module 16 can monitor the execution status of each subtask during the execution of the task chain, and dynamically adjust the subtasks according to the monitoring result. For example, pause the execution of the current subtask, or when the task result is logically incoherent or does not meet the actual requirements, adjust the subtasks in the task chain (such as adjusting the dependency relationship between subtasks) to optimize the task result and ensure the quality of the task result.
[0122] By integrating the perception module 12, the planning module 13, the memory module 15, and the decision-making module 16, the above system starts from the input (Case Input set, CI) of a specific scenario (or a type of legal case), goes through multiple intermediate steps or a task chain (Chain of Task, COT), and finally obtains a case result (Case Result, CR), realizing the simulation of the thinking and working logic of the human brain. The above system can be understood as a legal document generation system based on a cognitive architecture model, which can efficiently and accurately generate element-based legal documents (such as pleadings, responses, etc.) for cases to be processed.
[0123] The above legal document generation system is used to execute Figures 1 to 6 the legal document generation method embodiment shown. The technical principles, the technical problems solved, and the technical effects produced by the two are similar. Those skilled in the art of this technology can clearly understand that for the convenience and conciseness of description, the specific working process and relevant explanations of the legal document generation system can refer to the content described in the embodiment of the legal document generation method, which will not be elaborated here.
[0124] On the other hand, the present application also provides a computer-readable storage medium.
[0125] In an embodiment of a computer-readable storage medium according to the present application, the computer-readable storage medium may be configured to store a program for executing the legal document generation method in the above method embodiments. The program may be loaded and run by a processor to implement the above legal document generation method. For ease of description, only parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The computer-readable storage medium may be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiments of the present application is a non-transitory computer-readable storage medium.
[0126] Another aspect of the present application also provides an electronic device.
[0127] In an embodiment of an electronic device according to the present application, the electronic device may include at least one processor; and a memory communicatively connected to the at least one processor; wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method described in any of the above embodiments is implemented. Refer to the attached Figure 9 , Figure 9 It is exemplarily shown in the figure that the memory 21 and the processor 22 are communicatively connected via a bus.
[0128] The electronic device described in the present application may be, but is not limited to, a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an augmented reality (AR) / virtual reality (VR) device, etc. The embodiments of the present application do not make any limitations thereto.
[0129] So far, the technical solution of the present application has been described in conjunction with an embodiment shown in the drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments. Without departing from the principle of the present application, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present application.
Claims
1. A method for generating a legal document, characterized in that: The method comprises: Obtain case information and case demands for pending cases; Using a first intelligent agent to extract key information from the case information to obtain key information from the case information; Determine the task of the pending case based on the case demands; Decomposing the demand task into multiple subtasks, analyzing the dependency relationships between the multiple subtasks, and determining the execution order of the multiple subtasks according to the dependency relationships; Linking the multiple subtasks according to the execution order of the multiple subtasks to form a task chain corresponding to the demand task; Using a second agent Agent, and executing each subtask in the task chain according to the key information and the preset legal information, to obtain the task result of the appeal task; According to the task result and the key information, the template of the element-based legal document is filled with information, and the element-based legal document of the case to be processed is generated according to the template with the completed information filled in.
2. The method according to claim 1, characterized in that The case information includes multiple types of sub-information, there are multiple first intelligent agents, and the multiple first intelligent agents correspond to multiple types of information one by one, and the first intelligent agent is used to extract key information from the case information to obtain key information in the case information, including: For each type of sub-information in the case information, a first intelligent agent corresponding to the type of the sub-information is obtained, and the first intelligent agent is used to extract key information from the sub-information to obtain key information in the sub-information.
3. The method according to claim 1, characterized in that The analyzing the dependency relationship between the multiple subtasks includes: If the input of the first subtask includes the output of the second subtask, then the first subtask depends on the second subtask; otherwise, the first subtask does not depend on the second subtask; in, The first subtask and the second subtask are both any one of the multiple subtasks, and the first subtask is different from the second subtask.
4. The method according to claim 1 or 3, characterized in that: Determining the execution order of the plurality of subtasks according to the dependency relationship includes: If the first subtask depends on the second subtask, the execution order of the second subtask takes precedence over the execution order of the first subtask; in, The first subtask and the second subtask are both any one of the multiple subtasks, and the first subtask is different from the second subtask.
5. The method according to claim 1 or 3, characterized in that: Determining the execution order of the plurality of subtasks according to the dependency relationship includes: Taking each of the multiple subtasks as the current subtask in turn, and determining the dependency degree of the current subtask according to the dependency relationship between the current subtask and the other subtasks; if the current subtask is both dependent on other subtasks and is also dependent on by other subtasks, the dependency degree is the highest; if the current subtask is dependent on other subtasks or is dependent on by other subtasks, the dependency degree is the second highest; if the current subtask is neither dependent on other subtasks nor dependent on by other subtasks, the dependency degree is the lowest; Determining the priority of the current subtask according to the dependency degree, wherein the priority is positively correlated with the dependency degree; Arranging the execution order of the plurality of subtasks in descending order of the priorities; if the priority of the first subtask is higher than or equal to the priority of the second subtask during the arrangement, but the first subtask depends on the second subtask, making the execution order of the second subtask take precedence over the execution order of the first subtask; in, The first subtask and the second subtask are both any one of the multiple subtasks, and the first subtask is different from the second subtask.
6. The method according to claim 1, characterized in that The second agent Agent is multiple, and the second agent Agent is used to execute each subtask in the task chain according to the key information and the preset legal information to obtain the task result of the appeal task, including: Determine the task type of each subtask in the task chain according to the dependency relationship between the multiple subtasks; if the current subtask in the task chain does not depend on other subtasks, the task type of the current subtask is a parallel task; otherwise, the task type of the current subtask is a serial task; the current subtask is any subtask in the task chain, and the other subtasks are the remaining subtasks in the task chain except the current subtask; When the task chain has multiple parallel tasks, multiple second intelligent agents are used to execute each of the multiple parallel tasks in parallel.
7. The method according to claim 1, characterized in that The method also includes performing task monitoring by: Monitoring the execution status of each subtask in the task chain; If it is monitored that an exception occurs during the execution of the current subtask in the task chain, an exception handling mechanism corresponding to the type of the exception is obtained, the current subtask is processed using the exception handling mechanism, and the execution of the target subtask is suspended, wherein the current subtask is any subtask in the task chain, and the target subtask is another subtask in the task chain that is executed after the current subtask; If it is detected that the current subtask fails to execute, the current subtask is re-executed.
8. The method according to claim 1, characterized in that The task of appeal is broken down into multiple subtasks, including: According to the demand task and the 1st to ith subtasks, a plurality of i+1th subtasks are predicted, i≥2, and the 1st subtask is predicted based on the demand task; The input of the (i+1)th subtask includes the output of the (i)th subtask.
9. The method according to claim 8, characterized in that The method predicts a plurality of (i+1)th subtasks based on the demand task and the 1st to i-th subtasks, including: Obtaining the task features of the demand task and the 1st to ith subtasks; Using a function call mechanism of a large language model, and predicting at least one of a plurality of i+1th subtasks according to the task characteristics; and / or, The method predicts a plurality of (i+1)th subtasks based on the demand task and the 1st to i-th subtasks, including: Obtain text description information of the demand task and the 1st to ith subtasks; Inputting the text description information into a large language model for processing, and predicting at least one of the multiple (i+1)th subtasks; and / or, The method predicts a plurality of (i+1)th subtasks based on the demand task and the 1st to i-th subtasks, including: Acquire target legal information related to the appeal task from a preset legal knowledge base, where the legal knowledge base is used to store legal information, including legal provisions and cases; Based on the target legal information and according to the demand task and the 1st to ith subtasks, at least one of the multiple (i+1)th subtasks is predicted.
10. A legal document generation system, characterized in that: The system includes an information input module, a perception module, a planning module and a document generation module; The information input module is configured to: obtain case information and case demands of the case to be processed; The perception module is configured to: extract key information from the case information using a first agent to obtain key information from the case information; The planning module is configured to: determine the appeal task of the case to be processed according to the case appeal; Decomposing the demand task into multiple subtasks, analyzing the dependency relationships between the multiple subtasks, and determining the execution order of the multiple subtasks according to the dependency relationships; linking the multiple subtasks according to the execution order of the multiple subtasks to form a task chain corresponding to the demand task; Using a second agent Agent, and executing each subtask in the task chain according to the key information and the preset legal information, to obtain the task result of the appeal task; The document generation module is configured to: fill in information on a template of an element-based legal document according to the task result and the key information, and generate an element-based legal document for the case to be processed according to the template with the completed information filled in.
11. The system according to claim 10, characterized in that The system also includes a memory module and / or a decision module; The memory module is configured to: store the key information, the execution results of each subtask in the task chain and the task result of the demand task; The decision module is configured to: monitor the execution status of each subtask in the task chain; If it is monitored that an exception occurs during the execution of the current subtask in the task chain, an exception handling mechanism corresponding to the type of the exception is obtained, the current subtask is processed using the exception handling mechanism, and the execution of the target subtask is suspended, wherein the current subtask is any subtask in the task chain, and the target subtask is another subtask in the task chain that is executed after the current subtask; If it is detected that the current subtask fails to execute, the current subtask is re-executed.
12. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; Wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the legal document generation method described in any one of claims 1 to 9 is implemented.
13. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the legal document generation method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Legal decision prediction method based on priori knowledge and subtask dependency relationship
CN114707701A
Method and device for predicting judgment result of legal document and storage medium
CN115878815A
Multi-source and multi-mode fused knowledge reasoning method, system and device and medium
CN119005340A
Method and apparatus for determining case judgment result, device, and computer-readable storage medium
WO2021051866A1
Cited By
Processing method and system for presenting double intelligent agents based on service disassembly and visualization
CN120744108A
Multi-agent scheduling method and multi-agent system
CN121255391A