Construction method, system and equipment of large language model application and medium

By generating the initial flow diagram of the application and orchestrating component code, the problem of high cost and insufficient flexibility of large-scale applications in specific business scenarios is solved, efficient and flexible model application implementation is achieved, and data security is ensured.

CN119718260APending Publication Date: 2025-03-28SHENZHEN YISHIHUOLALA TECH CO LTD

Patent Information

Application Number
CN202411907651.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, large models are used in model customization training and fine-tuning of specific business scenarios, and there is a problem of high cost and insufficient flexibility.

Method used

By generating an application initial flow graph, including LLM components or combinations thereof, calling and orchestrating component code, generating target applications, and implementing system support through flow graph construction, configuration, and orchestration modules.

Benefits of technology

It reduces the cost of customized implementation of large language model applications, improves flexibility, and avoids data outreach security risks through data hierarchical management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718260A_ABST
    Figure CN119718260A_ABST
Patent Text Reader

Abstract

The invention provides a construction method, system, equipment and medium of a large language model application, and relates to the technical field of artificial intelligence, the construction method comprises the following steps: according to an obtained application construction demand, generating an application initial flow graph, the application initial flow graph comprises an LLM component, and the LLM component comprises an LLM module; or the LLM component is at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component and a planning component; according to the obtained target configuration data, setting parameters of corresponding components in the application initial flow graph to generate an application configuration flow graph; and calling and arranging codes corresponding to all components in the application configuration flow graph based on the application configuration flow graph, and generating a target application. The method can support LLM full-scene coverage to assist service landing, reduces the application customization landing cost of the large language model, and has high flexibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, system, device and medium for constructing a large language model application. Background Art

[0002] Large Language Model (LLM) is a natural language processing model based on deep learning technology, with massive parameter scale and excellent text generation and understanding capabilities. Through large-scale data training, LLM can not only efficiently complete traditional language processing tasks such as translation, text classification, and summary generation, but also flexibly adapt to complex multi-scenario business needs.

[0003] In the current freight scenario, the business application of big models is still in the exploration and development stage, lacking an efficient construction method that can simplify the implementation process and widely adapt to different business scenarios. The current big model application platform focuses more on general exploration. For the customized training and fine-tuning of models for specific business scenarios, not only is the application cost high, but there is also a problem of insufficient flexibility. Therefore, there is room for improvement. Summary of the invention

[0004] In view of the shortcomings of the prior art described above, the purpose of the present invention is to provide a method, system, device and medium for constructing a large language model application, so as to solve the technical problems in the prior art of high cost and insufficient flexibility in the customized training and fine-tuning of large model applications for specific business scenarios.

[0005] To achieve the above objectives and other related objectives, the present invention provides a method for constructing a large language model application, comprising:

[0006] Generate an initial flow graph of the application according to the acquired application construction requirements, wherein the initial flow graph of the application includes multiple components;

[0007] Generate an initial flow chart of the application according to the acquired application construction requirements, wherein the initial flow chart of the application includes an LLM component, or an LLM component and at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component, and a planning component;

[0008] Based on the application configuration flow graph, the codes corresponding to all components in the application configuration flow graph are called and arranged to generate a target application.

[0009] In one embodiment of the present invention, the step of generating an initial flow graph of the application according to the acquired application construction requirements includes:

[0010] Analyze the application construction requirements to generate scenario requirement information, function requirement information and data requirement information;

[0011] Based on the scenario requirement information, determine a scenario type, where the scenario type is an LLM scenario, a Chain scenario, an Agent scenario, or a RAG scenario;

[0012] Based on the scenario type and the functional requirement information, select corresponding multiple components from a preset component library;

[0013] Acquire application data according to the data demand information;

[0014] An application initial flow graph is generated based on the selected multiple components and the application data.

[0015] In one embodiment of the present invention, the step of determining the scenario type based on the scenario requirement information, wherein the scenario type is an LLM scenario, a Chain scenario, an Agent scenario, or a RAG scenario, includes:

[0016] Determine whether to call the local knowledge base based on the scenario requirement information:

[0017] If yes, the scene type is RAG scene;

[0018] If not, determine whether to call the tool component or memory component:

[0019] If yes, the scenario type is Agent scenario;

[0020] If no, the scenario type is LLM scenario or Chain scenario.

[0021] In one embodiment of the present invention, the step of generating an initial flow graph of the application based on the selected multiple components and the application data includes:

[0022] Perform security classification and desensitization processing on the application data;

[0023] Based on the selected multiple components and the application data after security classification and desensitization processing, an initial flow graph of the application is generated.

[0024] In one embodiment of the present invention, the step of setting the parameters of the corresponding components in the application initial flow graph according to the acquired target configuration data to generate the application configuration flow graph includes:

[0025] Extracting process execution information, input and output information, and component configuration information from the acquired target configuration data;

[0026] Setting the input-output relationship of all components in the initial flow graph of the application according to the input-output information, and setting the attribute parameters of the corresponding components according to the component configuration information;

[0027] Based on the process execution information, the execution order of all components is set to form an application configuration flow graph.

[0028] In one embodiment of the present invention, the step of calling and arranging codes corresponding to all components in the application configuration flow graph based on the application configuration flow graph to generate a target application includes:

[0029] Loading the initial code corresponding to all components in the application configuration flow chart;

[0030] According to the attribute parameters and input-output relationship of each component in the application configuration flow chart, the parameters of the initial code of each component are configured to generate the target code of each component;

[0031] According to the execution order of all components in the application configuration flow chart, the target codes of all components are arranged to generate a target application.

[0032] In one embodiment of the present invention, the step of calling and arranging codes corresponding to all components in the application configuration flow graph based on the application configuration flow graph to generate a target application includes:

[0033] According to the scene fusion instruction, the target application is fused with other target applications to generate a new target application.

[0034] The present invention also provides a system for constructing a large language model application, comprising:

[0035] A flow graph construction module, used to generate an initial flow graph of an application according to the acquired application construction requirements, wherein the initial flow graph of the application includes an LLM component, or an LLM component and at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component, and a planning component;

[0036] A flow graph configuration module, used to set parameters of corresponding components in the application initial flow graph according to the acquired target configuration data, so as to generate an application configuration flow graph;

[0037] The code arrangement module is used to call and arrange the codes corresponding to all components in the application configuration flow graph based on the application configuration flow graph to generate a target application.

[0038] The present invention also provides an electronic device, comprising:

[0039] one or more processors;

[0040] A storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the electronic device implements the method for constructing a large language model application as described in any one of the above.

[0041] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer executes any one of the above-described methods for constructing a large language model application.

[0042] As described above, the method, system, device and medium for constructing a large language model application of the present invention have the following beneficial effects: the present invention provides a general solution for LLM application business implementation, which can support LLM full-scenario coverage to help business implementation, reduce the customized implementation cost of large language model applications, and have high flexibility. In addition, the present invention also performs hierarchical management on data, limits the flow of sensitive data, and avoids the security risk of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 Shown is a schematic diagram of the LLM call scenario;

[0044] Figure 2 Shown is a schematic diagram of the Chain scenario;

[0045] Figure 3 Shown is a schematic diagram of the Agent scenario;

[0046] Figure 4 Shown is a schematic diagram of a RAG scenario;

[0047] Figure 5 A flowchart showing a method for constructing a large language model application provided by an embodiment of the present invention is shown;

[0048] Figure 6 Shown is a schematic diagram of generating an initial flow chart of an application in a user interface in one embodiment of the present invention;

[0049] Figure 7 Shown is a schematic diagram of configuring component attribute parameters in a user interface in one embodiment of the present invention;

[0050] Figure 8 Shown is a structural block diagram of a system for constructing a large language model application provided by an embodiment of the present invention;

[0051] Fig. 9 Shown is a structural schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0053] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0054] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0055] First of all, it should be explained that the application construction of the Large Language Model (LLM) refers to the use of deep learning and other technologies, based on large pre-trained models, to introduce advanced technologies in the fields of natural language processing, computer vision, speech recognition, etc. into the application to build intelligent application products based on human-computer interaction. For example, intelligent customer service and virtual characters. In the field of freight, the application of large language models mainly covers four scenarios: LLM call scenario, Chain scenario, Agent scenario and RAG scenario. Business applications are usually implemented through the integration of one or more of these four methods to meet specific scenario requirements.

[0056] See also Figure 1 , LLM call scenario is defined as directly calling the knowledge question-answering function of LLM without controlling its output. LLM call is suitable for exploratory tasks that do not have strict requirements on the results. Its output is generated by the model itself, and the results may have certain uncertainties. LLM call scenario is suitable for scenario exploration or task verification in the early stage of development, such as preliminary knowledge retrieval and text generation experiments.

[0057] See also Figure 2The Chain scenario is defined as enhancing the goal orientation of LLM through carefully designed prompts, improving the accuracy and pertinence of task execution. Prompt refers to the input information provided in LLM to trigger the model to generate the expected output. It is an instruction or prompt used to guide the model to generate the target result, usually written in natural language. Chain is suitable for single task execution or static scenarios with clear goals, which can improve the quality and consistency of text generation. Chain scenarios are suitable for copywriting generation, data analysis, summarization and translation, etc.

[0058] See also Figure 3 , the Agent scenario is defined as a combination of Prompt, Memory, Tool, and Plan, so that LLM has the ability to remember and use tools. Tool allows Agent to call external APIs to obtain additional information missing from the model (i.e. information that is difficult to change after pre-training), such as real-time information, code execution capabilities, access to proprietary information sources, etc. Usually, LLM calls and executes by designing APIs. Agent supports complex multi-round conversations, can maintain contextual associations, and can integrate external tools or systems to perform complex tasks. Agent scenarios are suitable for intelligent customer service, marketing assistants, order assistants, etc.

[0059] See also Figure 4 ,RAG scenario is defined as the integration of external documents or knowledge base (RAG) to enhance the knowledge coverage and accuracy of LLM in specific fields. RAG focuses on the updating and customization of knowledge (i.e. current knowledge), which can make up for the lack of LLM training data (i.e. historical knowledge) and provide real-time, accurate and comprehensive knowledge support. RAG scenario is suitable for FAQ, professional consultation, etc.

[0060] The present invention provides a method, system, device and medium for constructing a large language model application, which relates to the field of artificial intelligence technology and can be specifically used to solve the technical problems of high cost and insufficient flexibility in the application of large models in the model customization training and fine-tuning for specific business scenarios in the prior art. The present invention provides a general solution for the implementation of LLM application business, which can support LLM full-scenario coverage to help business implementation. The following is a detailed description through specific embodiments.

[0061] See also Figure 5 The present invention provides a method for constructing a large language model application, which may include the following steps:

[0062] Step S100: Generate an initial application flow chart according to the acquired application construction requirements, wherein the initial application flow chart includes an LLM component, or an LLM component and at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component, and a planning component;

[0063] Step S200: according to the acquired target configuration data, set the parameters of the corresponding components in the application initial flow graph to generate an application configuration flow graph;

[0064] Step S300: Based on the application configuration flow graph, call and arrange the codes corresponding to all components in the application configuration flow graph to generate a target application.

[0065] See also Figure 6 In one embodiment of the present invention, when step S100 is executed, an initial application flow chart is generated according to the acquired application construction requirements, wherein the initial application flow chart includes an LLM component, or an LLM component and at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component, and a planning component. Specifically, first, the present invention provides a visual user interface, which can be used to receive application construction requirements. The application construction requirement is a request for building a large model application input by a user (referring to a developer) to a computing device. In response to the request, the computing device displays a corresponding user interface, which can be operated by the user to execute the construction of the large model application. The application construction requirement can be a descriptive text, a templated input, or a specific functional requirement, such as a scenario target, a model type, and data input and output. Then, the business requirements are parsed using natural language processing technology, and key elements (such as scenarios, functions, and data) are identified and mapped to an initial application flow chart. The initial application flow chart is a preliminary framework for application development, and is convenient for users to view and confirm through visual display. In this embodiment, step S100 may include the following steps:

[0066] Step S110: parse and process the application construction requirements to generate scenario requirement information, function requirement information, and data requirement information;

[0067] Step S120: Determine the scenario type based on the scenario requirement information, where the scenario type is an LLM scenario, a Chain scenario, an Agent scenario, or a RAG scenario;

[0068] Step S130: Selecting multiple corresponding components from a preset component library based on the scenario type and functional requirement information;

[0069] Step S140: Obtain application data according to data demand information;

[0070] Step S150: Generate an initial application flow graph based on the selected multiple components and application data.

[0071] In one embodiment of the present invention, when step S110 is executed, the application construction requirements are parsed and processed to generate scenario requirement information, functional requirement information and data requirement information. Specifically, first, the application construction requirements for the application to be built input by the business party are obtained, and the application construction requirements are parsed and processed to understand the specific requirements of the business party. The goal of this step is to clearly identify the three core aspects of the demand information of the large model application to be built (hereinafter referred to as the application to be built), which are scenario requirement information, functional requirement information and data requirement information. Among them, the scenario requirement information describes the problems that the application to be built needs to solve or the business scenarios that need to be supported. The functional requirement information describes the functional characteristics that the application to be built should have, such as automated processes, data analysis, etc. The data requirements vividly describe the data types, sources and formats required for the application to be built, as well as how to process these data.

[0072] In one embodiment of the present invention, when executing step S120, the scenario type is determined based on the scenario requirement information, and the scenario type is LLM scenario, Chain scenario, Agent scenario or RAG scenario. Specifically, the following steps may be included:

[0073] Step S121: Determine whether to call the local knowledge base based on the scenario requirement information:

[0074] Step S122: If yes, the scene type is a RAG scene;

[0075] Step S123: If not, determine whether to call the tool component or the memory component: if yes, the scenario type is the Agent scenario; if not, the scenario type is the LLM scenario or the Chain scenario.

[0076] In one embodiment of the present invention, when executing steps S121 to S123, specifically, based on the scenario requirement information obtained in the previous step, it is determined which type of scenario the application to be built belongs to. Possible scenarios include but are not limited to LLM call scenarios, Chain scenarios, Agent scenarios, and RAG scenarios. In this embodiment, first, the scenario requirement information is analyzed to determine whether there is a need for specific domain knowledge, or whether it is required to combine existing data for decision support. If the application scenario involves complex queries and needs to retrieve relevant content from a large amount of existing information to generate answers or suggestions, it may be necessary to call a local knowledge base. If it is determined that a local knowledge base needs to be used, the scenario of the application to be built is defined as a RAG (retrieval enhanced generation) scenario. The characteristic of the RAG scenario is that it can find relevant information fragments through a retrieval mechanism and use them to generate more accurate and targeted answers or outputs. This scenario is very suitable for applications that need to use historical data or existing knowledge bases to provide services.

[0077] If it does not involve calling the local knowledge base, continue to determine whether it is necessary to call tool components or memory components, such as API interfaces, database queries, session management, etc. These components are usually used to process dynamic data or maintain status information. If necessary, define the scenario of the application to be built as an Agent scenario. Agent scenarios are suitable for applications that need to continuously monitor and respond to environmental changes, or need to remember and use past interaction records to optimize future behaviors. If not necessary, define the scenario of the application to be built as a Chain scenario or LLM scenario.

[0078] Furthermore, the Chain scenario and the LLM scenario can be distinguished based on whether the Chain component or the prompt component needs to be called. Among them, the LLM scenario emphasizes the use of large language models for tasks such as text generation, dialogue understanding, and question-answering systems. The Chain scenario focuses on defining and executing a series of tasks or operations arranged in a specific order. Each task or operation can be regarded as a node on the chain, and there is a clear order relationship between them.

[0079] See also Figure 6 In one embodiment of the present invention, when step S130 is executed, corresponding multiple components are selected from a preset component library based on the scenario type and functional requirement information. Specifically, according to the determined scenario type and functional requirement information, suitable components are selected from a pre-prepared component library. This library contains modules with various uses and technical characteristics, which can be quickly assembled into an application architecture that meets specific needs. Factors considered when selecting components include but are not limited to the functional matching degree, performance indicators, integration difficulty, etc. of the components. In this embodiment, the component library may include but is not limited to LLM components, tools (Tools) components, Chain components, Datasets (knowledge base) components, prompts (Prompts) components, memories (Memorys) components, Agents components, plans (Plan) components and Output_parsers components.

[0080] Among them, the LLM component is the core component responsible for understanding and generating human language. It is usually trained based on deep learning and a large amount of text data. The Tools component refers to small applications or services that can enhance or expand the functionality of LLM. For example, they can be APIs for specific tasks, such as image recognition, payment processing, or other third-party service interfaces. The Chain component allows multiple operations to be linked together to form a workflow. The steps in each chain can be a simple function call or a more complex sub-process. The Datasets component provides structured or unstructured data sets required for pre-training models. These datasets can contain data in multiple forms such as text, images, and audio. The Prompts component is used to optimize the interaction with users, guide the direction of the conversation through carefully constructed prompts, and improve the quality and efficiency of the conversation. The Memories component is used to add persistent storage capabilities to the dialogue system so that it can remember the content of previous interactions and use this information in subsequent communications to provide more personalized services. Agents components are entities with autonomous behavior capabilities that can perceive, make decisions, and act in the environment. In AI applications, agents can automatically perform a series of tasks according to set goals. The Plan component is used to define a series of actions or strategies on how to achieve a specific goal. The Output_parsers component is used to parse the output received from LLM or other components to ensure that it is in the correct format and easy to use by other parts. Figure 6 As shown in the figure, each component can be automatically selected by the system according to the requirements, or manually selected by the user by dragging and dropping in the user interface.

[0081] In one embodiment of the present invention, when step S140 is executed, application data is obtained according to the data demand information. Specifically, necessary data resources are located and collected according to the data demand information. This step ensures that sufficient and correct data is available in subsequent application development, and further involves data cleaning, conversion and verification to ensure data quality.

[0082] In one embodiment of the present invention, when executing step S150, an initial flow chart of the application is generated based on the selected multiple components and application data. Specifically, the following steps may be included:

[0083] Step S151: Perform security classification and desensitization processing on application data;

[0084] Step S152: Generate an initial application flow chart based on the selected multiple components and the security classification and desensitized application data.

[0085] In one embodiment of the present invention, when step S151 is executed, the application data is security graded and desensitized. Specifically, first, the application data needs to be comprehensively classified and identified to determine which data is sensitive information (such as personal identity information, financial data, etc.) and which is non-sensitive information. This step can be performed using an automated tool or a rule engine to divide the application data into ordinary data and sensitive data. Then, the sensitive data is desensitized. For example, the data can be encoded using an encryption algorithm so that unauthorized personnel cannot read it, and sensitive data can be limited to flow within the company to avoid security risks of data transmission. In this embodiment, a data setting window is also provided in the user interface, allowing users to customize the desensitization method of the selected data, and one-click desensitization is supported.

[0086] In one embodiment of the present invention, when step S152 is executed, an initial flow graph of the application is generated based on the selected multiple components and the security classification and desensitized application data. Specifically, based on the multiple components selected previously, start building the preliminary architecture of the application. This involves defining the interfaces and interaction logic between the components to ensure that they can work together seamlessly. Map the application data that has been security classified and desensitized to the corresponding components. This means clarifying which data will flow into which component and how to process the data. In this process, the security of data transmission also needs to be considered, such as using encrypted communication protocols. Draw the initial flow graph of the application based on the functional characteristics of the components and the way data flows. This diagram should intuitively show the workflow of the entire application, including data input points, processing nodes, output results, etc. It should also reflect the dependencies between different components and the order of service calls. The initial flow graph of the application may include an LLM component, or an LLM component and at least one of a Chain component, a memory component, a knowledge base component, a tool component, and a planning component. Figure 6 As shown, the current user interface displays an application initial flow chart of a RAG scenario application, which includes an LLM component, a Prompts component, a Chain component, and a datasets component.

[0087] Furthermore, after the initial flow graph of the application is generated, it can be verified to ensure that all security measures have been correctly implemented and will not affect the functional integrity of the application. In addition, the user can also optimize the initial flow graph of the application according to actual conditions to simplify unnecessary complexity and improve efficiency. The above optimization operations can be implemented through the user interface.

[0088] In one embodiment of the present invention, when executing step S200, the parameters of the corresponding components in the initial flow chart of the application are set according to the acquired target configuration data to generate the application configuration flow chart. Specifically, based on the specific configuration data provided by the business party (such as component configuration, input-output relationship, execution order, etc.), the initial flow chart is modified to adjust the behavior, data connection and process logic of each module, and finally generate a complete application configuration flow chart for the target application. In this step, step S200 may include the following steps:

[0089] Step S210: extracting process execution information, input and output information, and component configuration information from the acquired target configuration data;

[0090] Step S220: setting the input-output relationship of all components in the initial flow graph of the application according to the input-output information, and setting the attribute parameters of the corresponding components according to the component configuration information;

[0091] Step S230: Based on the process execution information, set the execution order of all components to form an application configuration flow chart.

[0092] In one embodiment of the present invention, when step S210 is executed, process execution information, input / output information, and component configuration information are extracted from the acquired target configuration data. Specifically, the acquired target configuration data is parsed to extract three types of key information required to build an application, namely, process execution information, input / output information, and component configuration information. Among them, the process execution information describes the execution logic and rules of the entire application or business process, including dependencies between tasks, trigger conditions, etc. The input / output information describes the data input source and output target of each component to ensure that data can be correctly transferred between different components. The input / output information defines the direction and format of data flow. The component configuration information describes the specific properties and setting parameters of each component, such as the URL of the API call, the database connection string, the model training parameters, etc., to ensure that these components work as expected.

[0093] See also Figure 7In one embodiment of the present invention, when step S220 is executed, the input-output relationship of all components in the initial flow chart of the application is set according to the input-output information, and the attribute parameters of the corresponding components are set according to the component configuration information. Specifically, first, based on the input-output information extracted in the previous step, the data interaction mode between all components in the initial flow chart of the application is set. This involves determining which components serve as upstream or downstream nodes of other components, and ensuring that the interfaces between them are compatible and that communication is smooth. Then, specific attribute parameters are set for each component based on the component configuration information. For example, if a component is an LLM component, its model type, API key, hyperparameters, etc. need to be specified; if it is a local knowledge base component, the database connection details, SQL statement templates, etc. need to be configured. This step ensures that each component can operate in the predetermined manner and can work in conjunction with other components to form a complete functional link. As Figure 7 As shown, the current user interface displays the property parameter configuration window of the LLM component, and multiple property values ​​of the component can be customized.

[0094] In one embodiment of the present invention, when step S230 is executed, the execution order of all components is set based on the process execution information to form an application configuration flow chart. Specifically, based on the process execution information, the configured components are arranged and connected in a specified order to ensure that data and operations can flow seamlessly in the flow chart. In this step, it is necessary to clarify which components should be executed first and which components need to wait for the completion of the predecessor tasks before they can be started. The expected system performance is achieved through a reasonable execution order, and the accuracy of the final result is guaranteed. After completing the above settings, the final application configuration flow chart can be generated. The application configuration flow chart can characterize the location and relationship of each component, as well as the workflow of the entire application. It should clearly reflect the operation content, data flow and decision points of each step, so that developers can intuitively understand the operation mechanism of the application.

[0095] In one embodiment of the present invention, when executing step S300, based on the application configuration flow chart, the codes corresponding to all components in the application configuration flow chart are called and arranged to generate the target application. Specifically, according to the final application configuration flow chart, the predefined code template, component library or automatically generated code is called for arrangement and integration to transform the target application from the design stage into an executable product form. In this embodiment, step S300 may include the following steps:

[0096] Step S310, loading the initial codes corresponding to all components in the application configuration flow chart;

[0097] Step S320: According to the attribute parameters and input-output relationship of each component in the application configuration flow chart, the parameters of the initial code of each component are configured to generate the target code of each component;

[0098] Step S330: Arrange the target codes of all components according to the execution order of all components in the application configuration flow chart to generate a target application.

[0099] In one embodiment of the present invention, when step S310 is executed, the initial code corresponding to all components in the application configuration flow chart is loaded. Specifically, according to the component list in the application configuration flow chart, the corresponding initial code file or module is searched from the preset code library. The initial code refers to the basic implementation code without any specific configuration adjustment, which is usually pre-written by the developer and stored in a specific location (such as the local file system, remote warehouse). The integrity and availability of the code need to be guaranteed during the loading process, for example, the switching between different versions is managed through a version control system. After loading is completed, basic syntax checking and dependency parsing should be performed on the code of each component to ensure that there are no omissions and that all necessary external resources can be accessed correctly.

[0100] In one embodiment of the present invention, when step S320 is executed, the parameters of the initial code of each component are configured according to the attribute parameters and input-output relationship of each component in the application configuration flow chart to generate the target code of each component. Specifically, first, the attribute parameters of each component are read from the application configuration flow chart, and the extracted attribute parameters are mapped to the corresponding positions in the initial code of the component, such as modifying function parameters, configuration files or environment variables. These parameters may include but are not limited to API endpoints, database connection strings, model training parameters, etc. Based on the input-output relationship defined in the application configuration flow chart, the input source and output target of each component are determined to build its data processing chain. That is, it is clearly stated where the data comes from and where it goes, and how to convert the format to meet the needs of the next component to ensure that the data can flow smoothly throughout the application. Then, using the above configuration information, the target code of each component is generated by modifying the default parameters in the initial code.

[0101] Furthermore, after completing the code configuration of each component, the target code of each component can be unit tested separately to verify whether its functions meet the configuration requirements and ensure that the code modification does not introduce new errors.

[0102] In one embodiment of the present invention, when step S330 is executed, the target codes of all components are arranged according to the execution order of all components in the application configuration flow chart to generate a target application. Specifically, according to the execution order of all components defined in the application configuration flow chart, an execution flow table or task queue is planned and generated. According to the execution flow table or task queue, the target codes of each component are serially integrated through function calls, API integration or workflow engines to form a complete target application. Finally, according to established standards and specifications, the integrated application is packaged into a deployable form (such as Docker images, JAR packages, etc.), and deployed to an appropriate environment (such as a test server, production environment).

[0103] In one embodiment of the present invention, after the target application code is arranged, the test and launch phase is entered to test the target application, and after the test is passed, the target application is launched. This step is intended to verify whether the function and performance of the target application meet the requirements and ensure that it can run stably in the production environment. Specifically, first, the target application is fully tested, and the pass rate of the test cases and the problems found are recorded to find and solve potential problems. The test process includes the following links: functional testing, verifying whether the core functions of the target application run correctly as expected in the requirement document or the application configuration flow chart; integration testing, verifying whether the interaction between the components is correct and whether the data transfer is logical; performance testing, testing the response speed and resource occupancy of the target application under high load scenarios; security testing, checking whether the target application has data leakage or other security risks; abnormal testing, simulating abnormal input or boundary conditions, and checking the behavior of the application under abnormal conditions. Then, for the problems found in the test, return to the target code arrangement or parameter configuration phase for repair. After the repair is completed, retest to ensure that the problem is completely solved. When the repaired target application passes all test cases, a test acceptance report is generated. Finally, after confirming that the target application meets the online conditions, it is deployed to the production environment.

[0104] Furthermore, when the business needs of the fusion scenario are met, the target application can be fused with other target applications to generate a new target application according to the scenario fusion instructions. Specifically, the fusion scenario is usually fused by multiple single-scenario AI applications (such as LLM calls, Chain, Agent, RAG, etc.). These single-scenario applications have achieved their respective functional goals, such as answering questions, calling tools, accessing local knowledge bases, etc. By integrating different target applications, complex business logic can be implemented, for example: combining the results generated by RAG with the chain execution of Chain; or allowing Agent to access local knowledge through RAG and then perform tasks; or using Multi-Agent to achieve cross-task collaboration.

[0105] In one embodiment of the present invention, first, the scene fusion instruction is obtained and parsed. The scene fusion instruction clarifies the fused target application and its interaction logic. Combine LLM with Chain: The answer generated by LLM is further processed by Chain, such as sentiment analysis or format optimization. Combine RAG with Agent: Let RAG provide local knowledge support, and Agent continues to operate based on the retrieval results. Multi-Agent system: Register a single Agent application as a tool to support multiple Agents to work together. Then, clarify the input, output and functional characteristics of each target application, and integrate each target application component into a unified process according to the scene type and functional requirements.

[0106] Among them, the Chain+RAG fusion scenario is suitable for users who need to call RAG to retrieve local knowledge first, and then use Chain to implement chain operations. The specific implementation steps are: first, build the RAG process, configure the knowledge base and retrieval logic; then, connect the RAG output component to the Chain input component; finally, optimize the Chain prompt to achieve further processing of the RAG results.

[0107] The RAG+Agent fusion scenario is suitable for RAG to provide knowledge support, and Agent is responsible for task execution. The specific implementation steps are: build the RAG application and register it as a tool that can be called; configure the Agent process and use the RAG application as one of its calling tools; test whether the Agent can correctly call the RAG application and perform subsequent operations based on the returned results.

[0108] The Multi-Agent fusion scenario is suitable for multiple Agents to collaborate to complete tasks, such as one Agent is responsible for data processing and another Agent is responsible for generating reports. The specific implementation steps are: register a single Agent application as a tool to ensure that each Agent application runs normally independently; define the collaboration order and trigger conditions of different Agent applications in the Multi-Agent process; configure data flow and task allocation logic to ensure smooth data interaction between Agent applications.

[0109] Furthermore, the new target application generated by the fusion of multiple applications is tested and optimized, and after the test is passed, the fused new target application is deployed, and a registration interface is provided for other processes to call. Through the construction of scene fusion, the processing capability of complex business needs can be effectively improved, the development and operation and maintenance costs can be reduced, and complex tasks that a single target application cannot handle independently can be solved, thus improving business efficiency and intelligence.

[0110] From the above, it can be seen that the present invention provides a comprehensive business solution for LLM application implementation scenarios, improves user experience and LLM application implementation efficiency, and at the same time avoids the security risks of data transmission.

[0111] See also Figure 8 The present invention also provides a construction system for a large language model application, and the processing system corresponds to the processing method in the above embodiment. The processing system may include a code arrangement module for a flow graph construction module 11, a flow graph configuration module 12, and a code arrangement module 13. The functional modules are described in detail as follows:

[0112] The flow graph construction module 11 can be used to generate an initial flow graph of the application according to the acquired application construction requirements, wherein the initial flow graph of the application includes an LLM component, or an LLM component and at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component, and a planning component. Further, the flow graph construction module 11 can be specifically used to parse and process the application construction requirements, generate scenario requirement information, functional requirement information, and data requirement information; based on the scenario requirement information, determine the scenario type, which is an LLM scenario, a Chain scenario, an Agent scenario, or a RAG scenario; based on the scenario type and the functional requirement information, select corresponding multiple components from a preset component library; based on the data requirement information, obtain application data; based on the selected multiple components and application data, generate an initial flow graph of the application.

[0113] The flow graph configuration module 12 can be used to set the parameters of the corresponding components in the initial flow graph of the application according to the acquired target configuration data to generate the application configuration flow graph. Further, the flow graph configuration module 12 can be specifically used to extract the process execution information, input and output information and component configuration information from the acquired target configuration data; set the input and output relationship of all components in the initial flow graph of the application according to the input and output information, and set the attribute parameters of the corresponding components according to the component configuration information; and set the execution order of all components based on the process execution information to form the application configuration flow graph.

[0114] The code arrangement module 13 can be used to call and arrange the codes corresponding to all components in the application configuration flow chart based on the application configuration flow chart to generate the target application. Further, the code arrangement module 13 can be specifically used to load the initial codes corresponding to all components in the application configuration flow chart; according to the attribute parameters and input-output relationship of each component in the application configuration flow chart, configure the parameters of the initial code of each component to generate the target code of each component; according to the execution order of all components in the application configuration flow chart, arrange the target codes of all components to generate the target application.

[0115] For the specific definition of the construction system for large language model applications, please refer to the definition of the construction method above, which will not be repeated here. Each module in the above construction system can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.

[0116] An embodiment of the present invention also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the method for constructing a large language model application provided in the above-mentioned embodiments.

[0117] See also Fig. 9 The electronic device 2 may include a memory 22, a processor 23 and a bus, and may also include a computer program stored in the memory 22 and executable on the processor 23, such as a program for building a large language model application.

[0118] Among them, the memory 22 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 22 can be an internal storage unit of the electronic device 2, such as a mobile hard disk of the electronic device 2. In other embodiments, the memory 22 can also be an external storage device of the electronic device 2, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 2. Further, the memory 22 can also include both an internal storage unit of the electronic device 2 and an external storage device. The memory 22 can not only be used to store application software and various types of data installed in the electronic device 2, such as the code of the construction method of the large language model application, but also can be used to temporarily store data that has been output or is to be output.

[0119] In some embodiments, the processor 23 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 23 is the control core (Control Unit) of the electronic device 2, and uses various interfaces and lines to connect various components of the entire electronic device 2, and executes or executes programs or modules (such as fatigue prediction model training programs, etc.) stored in the memory 22, and calls data stored in the memory 22 to execute various functions of the electronic device 2 and process data.

[0120] The processor 23 executes the operating system and various installed applications of the electronic device 2. The processor 23 executes the application to implement the steps in the method for constructing the large language model application.

[0121] Exemplarily, the computer program may be divided into one or more modules, which are stored in the memory 22 and executed by the processor 23 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 2. For example, the computer program may be divided into a flow graph construction module 11, a flow graph configuration module 12, and a code arrangement module 13.

[0122] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium, and the computer-readable storage medium can be non-volatile or volatile. The above-mentioned software function module is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to perform part of the functions of the method for constructing a large language model application described in each embodiment of the present application.

[0123] In summary, the present invention discloses a method, system, device and medium for constructing a large language model application, which relates to the field of artificial intelligence technology. The present invention can achieve full coverage of LLM implementation scenarios and provide a general solution for the implementation of LLM application services. At the same time, the present invention optimizes the visual interface and platform function construction, on the one hand, improves the user experience and lowers the threshold for users to use LLM; on the other hand, it improves the efficiency of large model AI application implementation from multiple aspects such as reducing participating roles, optimizing demand implementation steps, and optimizing time consumption. In addition, the present invention also performs hierarchical management on data, limits the flow of sensitive data, and avoids security risks of data transmission. Therefore, the present invention effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.

[0124] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A method for constructing a large language model application, characterized in that: include: Generate an initial flow chart of the application according to the acquired application construction requirements, wherein the initial flow chart of the application includes an LLM component, or an LLM component and at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component, and a planning component; According to the acquired target configuration data, parameters of corresponding components in the application initial flow graph are set to generate an application configuration flow graph; Based on the application configuration flow graph, the codes corresponding to all components in the application configuration flow graph are called and arranged to generate a target application.

2. The method for constructing a large language model application according to claim 1, characterized in that: The step of generating an initial flow graph of the application according to the acquired application construction requirements includes: Analyze the application construction requirements to generate scenario requirement information, function requirement information and data requirement information; Based on the scenario requirement information, determine a scenario type, where the scenario type is an LLM scenario, a Chain scenario, an Agent scenario, or a RAG scenario; Based on the scenario type and the functional requirement information, select corresponding multiple components from a preset component library; Acquire application data according to the data demand information; An application initial flow graph is generated based on the selected multiple components and the application data.

3. The method for constructing a large language model application according to claim 2, characterized in that: The step of determining the scenario type based on the scenario requirement information, wherein the scenario type is an LLM scenario, a Chain scenario, an Agent scenario, or a RAG scenario, comprises: Determine whether to call the local knowledge base based on the scenario requirement information: If yes, the scene type is RAG scene; If not, determine whether to call the tool component or memory component: If yes, the scenario type is Agent scenario; If no, the scenario type is LLM scenario or Chain scenario.

4. The method for constructing a large language model application according to claim 2, characterized in that: The step of generating an initial flow graph of the application based on the selected multiple components and the application data comprises: Perform security classification and desensitization processing on the application data; Based on the selected multiple components and the application data after security classification and desensitization processing, an initial flow graph of the application is generated.

5. The method for constructing a large language model application according to claim 1, characterized in that: The step of setting the parameters of the corresponding components in the application initial flow graph according to the acquired target configuration data to generate the application configuration flow graph includes: Extracting process execution information, input and output information, and component configuration information from the acquired target configuration data; Setting the input-output relationship of all components in the initial flow graph of the application according to the input-output information, and setting the attribute parameters of the corresponding components according to the component configuration information; Based on the process execution information, the execution order of all components is set to form an application configuration flow graph.

6. The method for constructing a large language model application according to claim 5, characterized in that: The step of calling and arranging the codes corresponding to all components in the application configuration flow graph based on the application configuration flow graph to generate the target application comprises: Loading the initial code corresponding to all components in the application configuration flow chart; According to the attribute parameters and input-output relationship of each component in the application configuration flow chart, the parameters of the initial code of each component are configured to generate the target code of each component; According to the execution order of all components in the application configuration flow chart, the target codes of all components are arranged to generate the target application.

7. The method for constructing a large language model application according to claim 1, characterized in that: The step of calling and arranging the codes corresponding to all components in the application configuration flow graph based on the application configuration flow graph to generate the target application includes: According to the scene fusion instruction, the target application is fused with other target applications to generate a new target application.

8. A system for constructing a large language model application, characterized in that: include: A flow graph construction module, used to generate an initial flow graph of an application according to the acquired application construction requirements, wherein the initial flow graph of the application includes an LLM component, or an LLM component and at least one of a Chain component, a Prompts component, a memory component, a knowledge base component, a tool component, and a planning component; A flow graph configuration module, used to set parameters of corresponding components in the application initial flow graph according to the acquired target configuration data, so as to generate an application configuration flow graph; The code arrangement module is used to call and arrange the codes corresponding to all components in the application configuration flow graph based on the application configuration flow graph to generate a target application.

9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the method for constructing a large language model application as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the method for constructing a large language model application according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Component assembly and large language model combined application development method and device

    CN117193745A

  • LLM-based low-code application development method and system

    CN117215551A

  • Model application construction method and device

    CN117931189A

Cited By

  • Enterprise scene-oriented intelligent application visualization construction method and system

    CN121364855A