Question and answer text generation method and device based on large model, equipment, medium and product
By adopting a large model factory architecture and a unified interface design, the resource waste and flexibility issues in model switching and multi-model deployment of existing intelligent question answering systems are solved, achieving efficient and flexible question answering services and improving the system's adaptability and user experience.
Patent Information
- Application Number
- CN202511272421.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-11-28
AI Technical Summary
Existing intelligent question-answering systems based on large language models suffer from problems such as wasted R&D resources, high hardware costs, and poor system flexibility when switching models and deploying multiple models. Furthermore, they lack intelligent scheduling mechanisms and are difficult to automatically adapt to business needs.
It adopts a large model factory architecture, and through a unified application programming interface and factory design pattern, it realizes flexible scheduling and automatic adaptation of models, supports unified calling and switching of multiple large language models, and provides synchronous and streaming calling modes to ensure efficient processing of question and answer requests.
It reduced R&D and deployment costs, improved system flexibility and adaptability, enhanced server utilization and user interaction experience, and achieved a "one-time connection, multiple models available" service model.
Smart Images

Figure CN121029280A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence, in particular to the field of finance, and more particularly to a large model question and answer generation method, device, equipment, medium and product. BACKGROUND
[0002] In recent years, artificial intelligence technology has developed rapidly, especially large language models (LLM) continue to evolve under the promotion of computing power improvement and algorithm innovation, showing the characteristics of diversification and high-frequency iteration, with rapid version updates.
[0003] Intelligent question and answer systems based on large language models have become important enterprise-level and personal services, and are widely used in various scenarios. However, the current system generally adopts an architecture deeply bound to a single model, resulting in repeated development of the entire system when a new model is accessed or a new version is adapted, causing waste of research and development resources and difficulty in reusing technology. If multiple models are to be supported, multiple independent systems need to be deployed in parallel, resulting in a large amount of redundancy in application programs, dependent libraries and running environments, occupying storage space, reducing server utilization, and significantly increasing hardware costs and operation and maintenance burdens. At the same time, model switching relies on manual operation, lacks a flexible and intelligent scheduling mechanism, and is difficult to automatically adapt to business needs, limiting system flexibility and response capabilities. SUMMARY
[0004] In view of the above problems, the present application provides a large model question and answer generation method, device, equipment, medium and product, which can at least partially solve the above technical problems.
[0005] According to a first aspect of the present application, a large model question and answer generation method is provided, the method comprising: in response to a user's question and answer request, obtaining a target model identifier, the target model identifier being used to indicate an instantiated target model to be called; according to the target model identifier, calling a corresponding instantiated target model from a large model factory, processing the question and answer request according to the request data construction logic and response data analysis logic encapsulated by the instantiated target model, and generating a question and answer text.
[0006] According to an embodiment of the present application, in response to a user's question and answer request, obtaining a target model identifier comprises: in response to a user's question and answer request, obtaining a plurality of pre-configured model identifiers; based on the semantic information of the question and answer request, matching the plurality of model identifiers to determine the target model identifier from the plurality of model identifiers.
[0007] According to an embodiment of the present application, the instantiated target model also encapsulates a calling interface; the question and answer request is processed according to the request data construction logic and the response data analysis logic encapsulated by the instantiated target model, and a question and answer text is generated, including: the question and answer request is processed according to the request data construction logic to obtain request data; the request data is processed based on the calling interface corresponding to the instantiated target model to obtain response data; the response data is analyzed according to the response data analysis logic to generate the question and answer text.
[0008] According to an embodiment of the present application, the method further includes: in response to a question and answer request of a user, if the semantic information of the question and answer request matches the model identifier below a threshold, switching to a default instantiated target model corresponding to a default model identifier to process the question and answer request.
[0009] According to an embodiment of the present application, the method further includes: the abstract class includes a synchronous calling interface and a streaming calling interface; each instantiated model selects the synchronous calling interface or the streaming calling interface to analyze the response data according to the corresponding preset identifier to generate the question and answer text.
[0010] According to an embodiment of the present application, the large model factory is configured with a unified application programming interface, the application programming interface defines a standardized input format and an output format; the question and answer text is output in a unified format through the application programming interface.
[0011] The second aspect of the present application provides a large model-based question and answer generation device, the device comprising: a response module configured to respond to a question and answer request of a user, obtain a target model identifier, and the target model identifier is used to indicate an instantiated target model to be called; a generation module configured to call a corresponding instantiated target model from a large model factory according to the target model identifier, process the question and answer request according to the request data construction logic and the response data analysis logic encapsulated by the instantiated target model, and generate a question and answer text.
[0012] The third aspect of the present application provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0013] The fourth aspect of the present application further provides a computer-readable storage medium having a computer program or instructions stored thereon, wherein the computer program or instructions are executed by a processor to implement the steps of the above method.
[0014] The fifth aspect of the present application further provides a computer program product comprising a computer program or instructions, wherein the computer program or instructions are executed by a processor to implement the steps of the above method. BRIEF DESCRIPTION OF DRAWINGS
[0015] The above content of the present application and other purposes, features and advantages will be more apparent through the following description of the embodiments of the present application with reference to the accompanying drawings, in which:
[0016] Figure 1 An application scenario diagram of the large model-based question and answer text generation according to the embodiments of the present application is schematically shown;
[0017] Figure 2 A flowchart of the large model-based question and answer text generation method according to the embodiments of the present application is schematically shown;
[0018] Figure 3 A question and answer text generation flowchart according to the embodiments of the present application is schematically shown;
[0019] Figure 4 A target model identification matching method according to the embodiments of the present application is schematically shown;
[0020] Figure 5 A structural block diagram of the large model-based question and answer text generation apparatus according to the embodiments of the present application is schematically shown;
[0021] Figure 6 A block diagram of an electronic device suitable for implementing the question and answer text generation method according to the embodiments of the present application is schematically shown. DETAILED DESCRIPTION
[0022] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. It is to be understood, however, that the description is merely exemplary of the present application, and is not intended to limit the scope of the present application. In the following detailed description of the embodiments of the present application, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, it will be apparent to one skilled in the art that one or more embodiments of the present application can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring aspects of the present application.
[0023] The terms used herein are merely used to describe specific embodiments, and are not intended to limit the present application. The terms "include", "comprise" and the like used herein indicate the presence of the described features, steps, operations and / or components, but do not exclude the presence or addition of one or more other features, steps, operations or components.
[0024] All terms used herein (including technical and scientific terms) have meanings commonly understood by one of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the specification, and should not be interpreted in an idealized or overly formal manner.
[0025] In the case of using expressions similar to "at least one of A, B, and C, etc.", it is generally intended to include any of A, B, and C alone, or in any combination, as well as the system including at least one of A, B, and C, etc.
[0026] For the scheme involving personal information, as unavoidable, the following expression is added in the specification:
[0027] In the technical solutions of the present application, the user information (including but not limited to user personal information, user image information, user equipment information, such as location information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards, necessary security measures are taken, do not violate public order and good customs, and provide corresponding operation portal for user to choose authorization or refusal.
[0028] In the scenario of using personal information for automated decision-making, the method, device and system provided by the embodiments of the present application all provide the user with a corresponding operation portal for the user to choose to agree or refuse the automated decision-making result; if the user chooses to refuse, the expert decision-making process is entered. The expression "automated decision-making" here refers to the activity of automatically analyzing, evaluating the behavior habits, interests and hobbies, or economic, health, credit status, etc. of an individual through a computer program, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by personnel who are engaged in a certain field of work, have specialized experience, knowledge and skills, and have reached a certain professional level. Figure 1 An application scenario diagram of the large model-based question and answer text generation according to the embodiments of the present application is schematically shown.
[0029] As shown in Figure 1 The application scenario 100 according to the embodiments can include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used as a medium to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0030] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive the user's question and answer request or send the generated question and answer text, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
[0031] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smartphones, tablet computers, laptop computers, desktop computers, and the like.
[0032] The server 105 can be a server providing various services, such as a background management server providing support for the user's question and answer request using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (only as an example). The background management server can analyze and process the received user request and other data, and feed back the processing result (such as the question and answer text generated according to the user request) to the terminal device.
[0033] It should be noted that the large model-based question and answer text generation method provided by the embodiments of the present application can generally be executed by the server 105. Correspondingly, the large model-based question and answer text generation apparatus provided by the embodiments of the present application can generally be arranged in the server 105. The large model-based question and answer text generation method provided by the embodiments of the present application can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105. Correspondingly, the large model-based question and answer text generation apparatus provided by the embodiments of the present application can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105.
[0034] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the above-mentioned system is only illustrative. According to the needs of implementation, there can be any number of terminal devices, networks, and servers.
[0035] It should be noted that the large model-based question and answer text generation method and apparatus of the embodiments of the present application can be applied in the field of financial technology.
[0036] For example, in the scenarios of intelligent financial customer service and investment consulting services, financial institutions need to face a large number of users' complex consultations on financial products, market trends, asset allocation, risk assessment, etc. The traditional manual service is high in cost and slow in response, and a single AI model is difficult to balance professional, coverage and interactive experience. Therefore, the system integrates multiple large language models, such as general models for daily questions and answers, special financial models for compliance interpretation and risk warning, and high-performance models for generating in-depth market analysis reports. Through the "large model factory" architecture proposed in this application, the system provides a unified Application Programming Interface (API) and defines a standardized input and output format. The front-end application (such as mobile banking APP, intelligent counter, customer service system) only needs to interface with this unified interface, and can transparently call the back-end optimal model without needing to perceive the underlying differences. When the user asks "how should I allocate my family assets in the current economic environment?", the system first analyzes the problem semantics and identifies that it belongs to the "asset allocation" field, and selects the model that is best at this field based on the matching degree; if the semantics are ambiguous or there is no high-matching model, the system automatically switches to the default model to ensure service availability. After selecting the model, the system calls the instantiation processor to complete the request format conversion, remote call and response analysis, and re-encapsulates the generated question and answer text into a unified format for return, ensuring consistent and analyzable output. In addition, the system supports synchronous and streaming invocation modes: ordinary questions and answers use the synchronous mode for quick response, and long investment suggestions use the streaming interface to achieve "word-by-word generation", improving user interaction experience. The entire process is scheduled by the large model factory, realizing a "one interface, multiple models available" service mode.
[0037] It should be noted that the question and answer text generation method and device based on a large model according to the embodiments of the present application can be used in the financial field and other scenarios, and can also be used in any field other than the financial field, such as e-commerce, telecommunications, etc. The application field of the question and answer text generation method and device based on a large model according to the embodiments of the present application is not limited.
[0038] The following describes the question and answer text generation method based on a large model according to the embodiments of the present application. Figure 1 The question and answer text generation method based on a large model according to the embodiments of the present application will be described in detail. Figure 2 The question and answer text generation method based on a large model according to the embodiments of the present application will be described in detail.
[0039] Figure 2 The flowchart of the question and answer text generation method based on a large model according to the embodiments of the present application is schematically shown.
[0040] As shown in Figure 2 The question and answer text generation method based on a large model according to the embodiments of the present application includes operations S210-S220, which can be executed in the server 105.
[0041] At operation S210, in response to the user's question and answer request, the target model identifier is obtained, which is used to indicate the instantiated target model to be called.
[0042] At operation S220, according to the target model identifier, the corresponding instantiated target model is called from the large model factory, and the question and answer request is processed according to the request data encapsulated by the instantiated target model to construct the logic and response data analysis logic, and the question and answer text is generated.
[0043] In the embodiments of the present application, the abstract class and inheritance subclass structure mode are adopted to build an extensible and easy-to-maintain intelligent question and answer system. Among them, the abstract class defines the general process of processing the question and answer request, including: obtaining the calling address, constructing the request parameter, initiating the interface call, processing the response result and other key steps. Among them, part of the general operation can provide default implementation in the abstract class, and the logic related to the specific model is implemented in the form of abstract method by the subclass. On this basis, different large language models are created by the system. The inheritance classes inherit from the abstract class and rewrite the abstract method according to the API specification of the respective instantiated model to realize the individualized request data construction logic and response data analysis logic.
[0044] The large model factory is a core scheduling component based on the factory design pattern, which is responsible for unified registration, centralized management and on-demand distribution of all large language model processor instances. By defining an abstract class, the general process of model calling is standardized, and a corresponding inheritance class is created for each specific large model to implement its unique request data construction logic and response data analysis logic. The instances of these inheritance classes are registered in the large model factory during system initialization, forming a mapping relationship between "model identifier" and "instance".
[0045] The instantiated model can be a large model service process that has been loaded onto the hardware, is in a running state, is consuming computing resources (such as graphics processor memory), and is ready to receive input (user question) and then generate output (answer) at any time.
[0046] The request data construction logic can be to wrap the user's question and answer request into a request body that the target model can accept according to the specification of the target model. The response data analysis logic can be to accurately extract the text content generated by the model from the structured data packet containing the answer, meta information, status code, etc.
[0047] Based on the mapping relationship between the model identifier and the instantiated model, it is determined which large language model the target model identifier corresponds to should process this request. This decision can be based on user selection or system strategy (such as cost, performance, professional field) to dynamically determine, which is the premise of flexible scheduling of models. Among them, the instantiated model encapsulates the request data construction logic and response data analysis logic that completely match the model, the former is responsible for converting user problems into the input format required by the model, and the latter is used to analyze the original response data returned by the model and extract the effective answer content. Based on the question and answer request, first call its request data construction logic to generate a request body that meets the target model specification; then initiate a call through a network interface to send the request to the model server; after receiving the original response, call its response data analysis logic to accurately extract the text content generated by the model from the structured data containing meta information, status code and other fields, and finally form the question and answer results that can be directly read by the user and return.
[0048] According to the embodiments of the present application, the decoupling of model calling logic and business process is realized, avoiding the repeated development of independent systems for each large model, significantly reducing the research and development cost and deployment overhead. At the same time, with the help of unified factory mode and encapsulated communication logic, the system can flexibly support the rapid access and dynamic switching of new models, has good scalability and intelligent scheduling ability, effectively coping with the technical challenges of high-frequency iteration and diversified coexistence of large language models. And when accessing new models, only one inherited class needs to be added and registered to the factory, without modifying the main process, greatly improving the scalability and maintainability of the system.
[0049] Figure 3 The question and answer text generation flowchart according to the embodiments of the present application is schematically shown.
[0050] As Figure 3As shown, the operator configures the underlying large model used by the current intelligent Q&A system in the system background. For example, the "first large model" is selected as the default model. After receiving the configuration instruction from the operator, the intelligent Q&A system passes this information to the large model factory, informing it that it needs to switch to a new underlying model. After receiving the notification, the large model factory calls the corresponding underlying model (such as the first large model) for preparation. The first large model confirms that it is ready and sends a confirmation notification to the large model factory. The large model factory confirms that the model switching is successful and updates the internal state to ensure that subsequent requests will use the newly configured model. After receiving the notification of successful model switching, the intelligent Q&A system confirms that the configuration operation is complete and updates the system state. The user raises a question through the front-end interface, such as "how to perform asset allocation". After receiving the user's question, the intelligent Q&A system first identifies that the currently configured underlying model is the "first large model" and confirms that it is the target model for this Q&A request. According to the current configuration, the large model factory calls the specific instance of the first large model to process the user's question. The first large model generates an answer text and returns it to the large model factory. The large model factory re-encapsulates the answer generated by the model into a standard output format and returns it to the intelligent Q&A system. After receiving the answer, the intelligent Q&A system displays it to the user. The user sees the answer of the intelligent Q&A system on the front-end interface, completing a Q&A interaction. Similarly, the second large model generates a Q&A text based on the second Q&A request.
[0051] Figure 4 The target model identification matching method according to the embodiments of the present application is schematically shown.
[0052] As Figure 4 shown, in response to the user's Q&A request, the target model identification is obtained, including:
[0053] In response to the user's Q&A request, a plurality of pre-configured model identifications are obtained;
[0054] Based on the semantic information of the Q&A request, the plurality of model identifications are matched to determine the target model identification from the plurality of model identifications.
[0055] In the embodiments of the present application, when receiving the user's Q&A request, the system first analyzes the domain features based on the problem semantic information and matches the most suitable target model identification from the plurality of pre-configured model identifications. Subsequently, through the large model factory, the corresponding instantiated target model is found and obtained according to the identification. The instantiated target model is a service process that has been loaded to the hardware, is in a running state, encapsulates complete communication capabilities, and can be immediately used to process requests.
[0056] According to the embodiments of the present application, the mechanism realizes the automation and intelligence of model scheduling, not only avoids manual intervention, but also dynamically optimizes the model selection strategy according to the business scene, significantly improves the adaptability and service quality of the system and the utilization rate of resources. At the same time, the new model access only needs to add an inherited class and configure its capability tag, without modifying the scheduling logic, fully reflecting the scalability and engineering advantages of object-oriented design.
[0057] On the basis of the above-mentioned embodiments, the instantiated target model also encapsulates the calling interface.
[0058] According to the request data construction logic and response data analysis logic encapsulated by the instantiated target model, the question and answer request is processed to generate the question and answer text, including: processing the question and answer request according to the request data construction logic to obtain the request data; processing the request data based on the calling interface to obtain the response data; and analyzing the response data according to the response data analysis logic to generate the question and answer text.
[0059] In the embodiments of the present application, each instantiated target model completely encapsulates all communication details related to a specific large model at runtime, including: request format (field name, nested structure, parameter requirement); interface address; authentication method; response structure (answer field path, error code definition), etc.
[0060] By calling the request data construction logic encapsulated by the instantiated target model, the user's original question is converted into standardized request data required by the instantiated target large model. This logic is implemented by a specific inherited class to ensure that the request format meets the model interface specification. Secondly, based on the calling interface corresponding to the model, the constructed request data is sent to the remote server, and the original response data returned by the server is received. Finally, the system calls the response data analysis logic encapsulated by the instance to extract the text content generated by the model from the structured response data to generate the final question and answer text. This logic is also implemented by an inherited class and accurately analyzes the response structure of different models.
[0061] According to the embodiments of the present application, by constructing an instantiated target model that encapsulates complete communication capabilities, efficient, accurate and stable processing of question and answer requests is realized. The instance has loaded the necessary configurations and resources at runtime, and completely encapsulates the request data construction logic, calling interface information and response data analysis logic corresponding to the target model. When processing user requests, the system directly calls the standardized methods of the instance, without condition judgment or dynamic adaptation in the main process, significantly improving the execution efficiency and code simplicity.
[0062] On the basis of the above-mentioned embodiments, the method further comprises: in response to a user's question and answer request, in the case that the semantic information of the question and answer request matches the plurality of model identifiers below a threshold, switching to a default instantiation target model corresponding to a default model identifier to process the question and answer request.
[0063] In the embodiments of the present application, in order to further enhance the robustness and usability of the system, a fault-tolerant processing mechanism based on semantic matching is provided. Specifically, when the system responds to a user's question and answer request, it will match a plurality of pre-configured model identifiers based on the semantic information of the request to determine the optimal target model. However, when the semantic analysis result shows that the matching degree of all models is below a preset threshold, it indicates that the current problem cannot be clearly classified into the specialized field of any model, which may be due to ambiguous problem statement, unknown domain, or semantic ambiguity, etc. In this case, to avoid interruption of request processing or unavailability of service, the system automatically switches to a default instantiation target model corresponding to a default model identifier to process the question and answer request. The default model is usually a large language model with strong general ability, good Chinese understanding level and stable service performance, and is loaded as a resident running instance by the large model factory during system initialization to ensure that it can be called immediately.
[0064] According to the embodiments of the present application, this bottoming mechanism effectively guarantees the service continuity of the system in boundary scenarios, avoiding response failure due to no matching model, and providing reasonable answers through the default model to maintain the integrity of user experience. At the same time, this design reflects the balance between intelligent scheduling and stability of the system: precise calling when matching succeeds, and reliable bottoming when matching fails, significantly improving the fault tolerance, robustness and overall service quality of the intelligent question and answer system.
[0065] According to the embodiments of the present application, the abstract class comprises a synchronous calling interface and a streaming calling interface; each instantiation model selects the synchronous calling interface or the streaming calling interface to parse the response data according to the corresponding preset identifier, and generates a question and answer text.
[0066] In the embodiments of the present application, after the user initiates a request, the client blocks and waits until the large model completes the generation of all content and returns the complete response data at once, and then the system parses and returns the final answer.
[0067] The streaming calling interface is a mode in which the text is returned in the form of "data stream" in blocks during the generation of the answer, and the client can display it in real time word by word or sentence by sentence. This mode realizes the interactive effect of "generating and presenting simultaneously". This mode significantly improves the user's perception of response speed, and is especially suitable for scenarios with high experience requirements such as long text generation and conversational interaction.
[0068] In this embodiment, each instantiated target model autonomously selects to use a synchronous or streaming interface for response processing according to the API capabilities of its corresponding large model and system preset identification. For example, an instance that supports streaming output registers a callback function to process each segment of returned content, while a model that only supports synchronous response uniformly returns the complete answer after obtaining the complete answer.
[0069] According to embodiments of the present application, the communication capabilities of different models are flexibly adapted, which not only guarantees the universality of basic functions, but also supports the expansibility of advanced interaction modes. Users can obtain the optimal response experience without perceiving the underlying differences, thereby significantly improving the practicality, compatibility, and service quality of the intelligent question answering system.
[0070] According to embodiments of the present application, the large model factory is configured with a unified application programming interface, which defines standardized input and output formats; the question answering text is output in a unified format through the application programming interface.
[0071] In embodiments of the present application, although the system backend integrates multiple large language models from different manufacturers with different protocols and capabilities, and each model has significant differences in request format, response structure, and calling method, to ensure that the upper layer application (such as the front-end system, mobile application, or third-party service) can access the intelligent question answering function in a unified, stable, and predictable manner, the system configures a unified application programming interface at the large model factory level. This unified API is the only service entry exposed by the system, which defines standardized input and output formats. The calling party only needs to submit a problem request according to the specified structure and receive an answer result in a consistent format, without perceiving the specific model used in the underlying and its communication details. After receiving a request in a standard format, the large model factory automatically performs a complete processing flow of model matching, instance calling, response analysis, etc. internally, and returns the finally generated question answering text re-packaged as a standard format. In this process, the large model factory effectively shields the heterogeneity of each model in request construction, response path, calling protocol, etc., achieving the architecture design goal of "multiple internally, unified externally".
[0072] According to embodiments of the present application, this design significantly reduces the technical threshold for external systems to access the intelligent question answering function, avoids the interface adaptation cost caused by model switching or addition, and realizes the service mode of "one connection, multiple models available".
[0073] Based on the above question answering text generation method, the present application also provides a question answering text generation device. The following will be described in detail. Figure 5 The device is described in detail.
[0074] Figure 5 The structure block diagram of the question answering text generation device according to embodiments of the present application is schematically shown.
[0075] As Figure 5 shown, the question and answer text generation apparatus 500 of this embodiment includes a response module 510 and a generation module 520.
[0076] The response module 510 is configured to, in response to a user's question and answer request, obtain a target model identifier, the target model identifier being used to indicate an instantiated target model to be invoked. In an embodiment, the response module 510 can be configured to perform the operation S210 described in the foregoing, and details are not repeated here.
[0077] The generation module 520 is configured to, according to the target model identifier, invoke a corresponding instantiated target model from the large model factory, and process the question and answer request according to the request data encapsulated by the instantiated target model and the response data analysis logic to generate a question and answer text. In an embodiment, the generation module 520 can be configured to perform the operation S220 described in the foregoing, and details are not repeated here.
[0078] Further, the response module 510 is further configured to, in response to a user's question and answer request, obtain a target model identifier, including: in response to a user's question and answer request, obtaining a plurality of pre-configured model identifiers; based on the semantic information of the question and answer request, matching the plurality of model identifiers to determine the target model identifier from the plurality of model identifiers. It is also used to respond to a user's question and answer request, in the case where the semantic information of the question and answer request and the plurality of model identifiers match below a threshold, switching a default model identifier to process the question and answer request with a corresponding default instantiated target model.
[0079] The generation module 520 is further configured to encapsulate an invocation interface in the instantiated target model; process the question and answer request according to the request data construction logic and the response data analysis logic to generate a question and answer text, including: processing the question and answer request according to the request data construction logic to obtain request data; processing the request data based on the invocation interface corresponding to the instantiated target model to obtain response data; and parsing the response data according to the response data analysis logic to generate a question and answer text. It is also used to define a synchronous invocation interface and a streaming invocation interface in the abstract class; each instantiated model selects the synchronous invocation interface or the streaming invocation interface to parse the response data according to the corresponding preset identifier to generate a question and answer text.
[0080] The apparatus further includes a configuration module configured to configure the large model factory with a uniform application programming interface, the application programming interface defining a standardized input format and output format; and the question and answer text is output in a uniform format through the application programming interface.
[0081] According to an embodiment of the present application, any of the response module 510 and the generation module 520 can be combined in one module, or any of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of the other modules, and implemented in one module. According to an embodiment of the present application, at least one of the response module 510 and the generation module 520 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging a circuit, etc. hardware or firmware, or in any one of software, hardware and firmware three implementation ways or in any appropriate combination of any of them. Alternatively, at least one of the response module 510 and the generation module 520 can be at least partially implemented as a computer program module which can perform corresponding functions when it is run.
[0082] Figure 6 The block diagram of an electronic device suitable for implementing the question and answer text generation method according to an embodiment of the present application is schematically shown.
[0083] As shown in Figure 6 The electronic device 600 according to an embodiment of the present application includes a processor 601 which can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 602 or loaded from a storage portion 608 to a random access memory (RAM) 603. The processor 601 can include, for example, a general purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special purpose microprocessor (such as an application specific integrated circuit (ASIC)), etc. The processor 601 can also include an on-board memory for cache use. The processor 601 can include a single processing unit or multiple processing units for performing different actions of the method processes according to embodiments of the present application.
[0084] In the RAM 603, various programs and data required for the operation of the electronic device 600 are stored. The processor 601, the ROM 602 and the RAM 603 are connected to each other through a bus 604. The processor 601 performs various operations of the method processes according to embodiments of the present application by executing programs in the ROM 602 and / or the RAM 603. It should be noted that the programs can also be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 can also perform various operations of the method processes according to embodiments of the present application by executing programs stored in the one or more memories.
[0085] According to an embodiment of the present application, the electronic device 600 can further include an input / output (I / O) interface 605 that is also connected to the bus 604. The electronic device 900 can further include one or more of the following components connected to the input / output (I / O) interface 605: an input part 606 including a keyboard, a mouse, etc.; an output part 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 608 including a hard disk, etc.; and a communication part 609 including a network interface card such as a LAN card, a modem, etc. The communication part 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as necessary. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 610 as necessary, so that a computer program read out therefrom is installed in the storage part 608 as necessary.
[0086] The present application also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or can exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present application.
[0087] According to an embodiment of the present application, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present application, the computer readable storage medium can include one or more memories such as the ROM 602 and / or the RAM 603 described above and / or one or more memory other than the ROM 602 and the RAM 603.
[0088] The embodiments of the present application also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the recommended information method provided by the embodiments of the present application.
[0089] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this application embodiment. According to the embodiments of this application, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0090] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0091] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, it performs the functions defined in the system of this application embodiment. According to the embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0092] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0093] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0094] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.
Claims
1. A question-answering text generation method based on a large model, characterized in that, The method includes: In response to a user's question and answer request, obtain the target model identifier, which is used to indicate the instantiated target model to be invoked; Based on the target model identifier, the corresponding instantiated target model is called from the large model factory. The question-and-answer request is processed according to the request data construction logic and response data parsing logic encapsulated in the instantiated target model, and question-and-answer text is generated.
2. The method according to claim 1, characterized in that, The step of responding to a user's question-and-answer request and obtaining the target model identifier includes: In response to a user's question-and-answer request, retrieve multiple pre-configured model identifiers; The multiple model identifiers are matched based on the semantic information of the question-and-answer request, and the target model identifier is determined from the multiple model identifiers.
3. The method according to claim 1, characterized in that, The instantiated target model also encapsulates the calling interface; The step of processing the question-and-answer request based on the request data construction logic and response data parsing logic encapsulated in the instantiated target model to generate question-and-answer text includes: The request data is processed according to the logic constructed based on the request data to obtain the request data; The request data is processed based on the aforementioned API call to obtain response data; The response data is parsed according to the response data parsing logic to generate question and answer text.
4. The method according to claim 2, characterized in that, Also includes: In response to a user's question-and-answer request, if the semantic information of the question-and-answer request matches the multiple model identifiers to a degree below a threshold, the default instantiation target model corresponding to the default model identifier is switched to process the question-and-answer request.
5. The method according to claim 1, characterized in that, Also includes: Abstract classes include synchronous call interfaces and streaming call interfaces; Each instantiated model selects either a synchronous call interface or a streaming call interface based on its corresponding preset identifier to parse the response data and generate question-and-answer text.
6. The method according to claim 1, characterized in that, The large model factory is equipped with a unified application programming interface (API), which defines standardized input and output formats; the question-and-answer text is output in a unified format through the API.
7. A question-and-answer text generation device based on a large model, characterized in that, The device includes: The response module is used to respond to the user's question and answer request and obtain the target model identifier, which is used to indicate the instantiated target model to be invoked; The generation module is used to call the corresponding instantiated target model from the large model factory according to the target model identifier, process the question and answer request according to the request data construction logic and response data parsing logic encapsulated in the instantiated target model, and generate question and answer text.
8. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 6.
