Question and answer method and device and storage medium
By using the classification model to determine the propt type and target propt template in the intelligent question and answer system, and combining the query vector to rewrite the query content, the existing intelligent question and answer system has solved the problems of low accuracy and poor timeliness in data query and data analysis, achieving higher answer accuracy and faster reply speed.
Patent Information
- Application Number
- CN202411643601.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-04-04
AI Technical Summary
The existing intelligent question-and-answer system has problems such as low accuracy and poor timeliness in data query and data analysis, which cannot meet the personalized needs of users.
By obtaining the user's query content, determine the propt type using the classification model, and determine the target propt template based on the propt type. Then, determine the query vector corresponding to the query content, override the query content, and splice it with the target propt template into the target propt. Finally, the large language model is used to determine the answer to the query content based on the target propt.
It improves the answer accuracy and timeliness of the Q&A system, and can quickly and accurately answer users' questions.
Smart Images

Figure CN119760060A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent question answering technology, and specifically to a question answering method, device and storage medium. Background Art
[0002] Currently, data query and data analysis require data analysts to develop data reports in advance, and then users log in to the system to view the developed reports to determine the results of the query content. There are communication barriers and cognitive barriers between data analysts and users, and the logic and style of data reports are fixed and can only provide users with existing results, resulting in query results that cannot meet user needs in terms of personalization and timeliness.
[0003] With the development of intelligence, intelligent question-answering systems are gaining more and more attention, and many intelligent question-answering systems are also applied to data query and data analysis. Existing intelligent question-answering systems usually use deep learning models trained with a large amount of text data, which need to be trained with a large amount of question and answer texts, which can easily cause "hallucinations" in the model, and there are deficiencies in data query and data analysis, resulting in inaccurate responses to questions and answers, which cannot meet the personalized needs of users, and the model training time is long, which is also insufficient in timeliness. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a question-answering method, device and storage medium to solve the problems of low question-answering accuracy and poor timeliness in the prior art.
[0005] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a question-answering method, the method comprising:
[0006] Get the user's query content;
[0007] Input the query content into the classification model to obtain the prompt type corresponding to the query content;
[0008] Determine the target prompt template based on the prompt type;
[0009] Determine a query vector corresponding to the query content;
[0010] Rewrite the query content according to the query vector to obtain rewritten query content;
[0011] Concatenate the target prompt template and the rewritten query content to get the target prompt;
[0012] Determine the answer to the query based on the target prompt.
[0013] In an embodiment of the present application, determining the answer to the query content according to the target prompt includes: inputting the target prompt into a large language model to determine a target function corresponding to the target prompt through the large language model, and outputting a first calling parameter for calling the target function; calling the target function based on the first calling parameter to perform a query operation in a database to obtain a query result; and inputting the query result into the large language model to obtain an answer.
[0014] In an embodiment of the present application, determining the answer to the query content according to the target prompt includes: defining a function according to the rewritten query content; inputting the target prompt and the function definition into a large language model to obtain a second call parameter of the defined function; calling the defined function based on the second call parameter to perform a query operation in a database to obtain a query result; and inputting the query result into the large language model to obtain an answer.
[0015] In an embodiment of the present application, determining a query vector corresponding to the query content includes: determining an entity in the query content; and inputting the entity into an embedding model to obtain a query vector.
[0016] In an embodiment of the present application, determining an entity in the query content includes: inputting the query content into an entity recognition model to obtain the entity.
[0017] In an embodiment of the present application, determining the target prompt template according to the prompt type includes: inputting the prompt type into a prompt template library to determine the matching degree between the prompt type and each prompt template in the prompt template library; and determining the prompt template corresponding to the maximum matching degree as the target prompt template.
[0018] In an embodiment of the present application, rewriting the query content according to the query vector to obtain the rewritten query content includes: matching at least one field from a preset knowledge base according to the query vector; and generating the rewritten query content according to the at least one field.
[0019] In an embodiment of the present application, rewriting the query content according to the query vector to obtain the rewritten query content includes: determining the similarity between the query vector and each text vector in a preset knowledge base; selecting a text vector whose similarity is greater than a preset value, and generating the rewritten query content according to the selected text vector.
[0020] A second aspect of the present application provides a question-answering device, comprising:
[0021] a memory configured to store instructions;
[0022] The processor is configured to call instructions from the memory and implement the above-mentioned question-and-answer method when executing the instructions.
[0023] A third aspect of the present application provides a machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the above-mentioned question-and-answer method.
[0024] Through the above technical solution, the prompt type of the query content can be determined based on the classification model, and the target prompt template can be determined according to the prompt type; the query content is rewritten according to the query vector corresponding to the query content, and then the target prompt template and the rewritten query content are spliced to obtain the target prompt, and finally the answer to the query content is determined according to the target prompt to improve the accuracy of the answer and the timeliness of the reply, so as to quickly and accurately answer user questions.
[0025] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0027] Figure 1 A schematic diagram of a process flow of a question-answering method according to an embodiment of the present application is schematically shown;
[0028] Figure 2 Another flowchart of a question-and-answer method according to an embodiment of the present application is schematically shown;
[0029] Figure 3 The internal structure diagram of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0031] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0032] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0033] Figure 1 The following schematically shows a flow chart of a question-answering method according to an embodiment of the present application. Figure 1 As shown, an embodiment of the present application provides a question-answering method, which may include the following steps.
[0034] Step 101: Obtain the user's query content.
[0035] Step 102: Input the query content into the classification model to obtain the prompt type corresponding to the query content.
[0036] Step 103: Determine the target prompt template according to the prompt type.
[0037] Prompt refers to the process of refining these prompts in the process of people inputting prompts to generative artificial intelligence (AI) services to generate text or images. It can be a question, a description, a set of keywords or contextual information, etc., which tells the generative artificial intelligence service the type and content of output that people want to get. The processor can obtain the user's query content, which can be some questions, needs, etc. of the user. The query content can be in text form or in voice form. Based on the query content in voice form, the voice can be converted into text by a voice conversion device. After obtaining the user's query content, the processor can input the query content into a classification model to obtain the prompt type corresponding to the query content. After obtaining the prompt type corresponding to the query content, the processor can determine the target prompt template according to the prompt type.
[0038] In an embodiment of the present application, determining the target prompt template according to the prompt type includes: inputting the prompt type into a prompt template library to determine the matching degree between the prompt type and each prompt template in the prompt template library; and determining the prompt template corresponding to the maximum matching degree as the target prompt template.
[0039] The processor may determine the target prompt template according to the prompt type. Specifically, the processor may input the prompt type into the prompt template library to determine the matching degree between the prompt type and each prompt template in the prompt template library. The prompt template library may include at least one prompt template. After obtaining the matching degree between the prompt type and each prompt template in the prompt template library, the processor may determine the prompt template with the maximum matching degree corresponding to the prompt type, and determine the prompt template corresponding to the maximum matching degree as the target prompt template.
[0040] In an optional embodiment, the processor may also input the prompt type into the matching model to output a target prompt template corresponding to the prompt type through the matching model, wherein the matching degree between the target prompt template and the prompt type is the greatest.
[0041] Step 104: Determine a query vector corresponding to the query content.
[0042] The processor may also determine a query vector corresponding to the query content.
[0043] In an embodiment of the present application, determining a query vector corresponding to the query content includes: determining an entity in the query content; and inputting the entity into an embedding model to obtain a query vector.
[0044] The processor may determine a query vector corresponding to the query content. Specifically, the processor may determine entities in the query content. In an embodiment of the present application, the processor may input the query content into an entity recognition model to obtain entities in the query content. After obtaining the entities in the query content, the processor may input the entities into an embedding model to obtain a query vector.
[0045] Step 105: rewrite the query content according to the query vector to obtain the rewritten query content.
[0046] After obtaining the query vector, the processor may rewrite the query content according to the query vector to obtain rewritten query content.
[0047] In an embodiment of the present application, rewriting the query content according to the query vector to obtain the rewritten query content includes: matching at least one field from a preset knowledge base according to the query vector; and generating the rewritten query content according to the at least one field.
[0048] The processor may rewrite the query content according to the query vector to obtain the rewritten query content. Specifically, the processor may match at least one field from a preset knowledge base according to the query vector, and generate the rewritten query content according to the at least one field to improve the accuracy of the query content expression, so that the subsequent large language model can better understand the query content. The preset knowledge base may include data fields in various fields.
[0049] In an embodiment of the present application, rewriting the query content according to the query vector to obtain the rewritten query content includes: determining the similarity between the query vector and each text vector in a preset knowledge base; selecting a text vector whose similarity is greater than a preset value, and generating the rewritten query content according to the selected text vector.
[0050] The processor can determine the similarity between the query vector and each text vector in the preset knowledge base. After determining the similarity between the query vector and each text vector, the processor can select a text vector whose similarity is greater than a preset value, and generate a rewritten query content based on the selected text vector, so that the rewritten query content is more in line with the actual needs of the user and is convenient for subsequent processing of the large language model. The preset knowledge base can be multiple text vectors generated based on text data in multiple fields. The preset value can be determined by the user according to the query requirements.
[0051] Step 106: Concatenate the target prompt template and the rewritten query content to obtain the target prompt.
[0052] Step 107: Determine the answer to the query content according to the target prompt.
[0053] After obtaining the rewritten query content, the processor can concatenate the target prompt template and the rewritten query content to obtain the target prompt. After obtaining the target prompt, the processor can determine the answer to the query content according to the target prompt.
[0054] In an embodiment of the present application, determining the answer to the query content according to the target prompt includes: inputting the target prompt into a large language model to determine a target function corresponding to the target prompt through the large language model, and outputting a first calling parameter for calling the target function; calling the target function based on the first calling parameter to perform a query operation in a database to obtain a query result; and inputting the query result into the large language model to obtain an answer.
[0055] The processor can determine the answer to the query content according to the target prompt. Specifically, the processor can input the target prompt into the large language model to determine the target function corresponding to the target prompt through the large language model, and output the first call parameter for calling the target function. The first call parameter can be a SQL (Structured Query Language) code. After obtaining the first call parameter, the processor can call the target function based on the first call parameter to perform a query operation in the database to obtain a query result. After obtaining the query result, the processor can input the query result into the large language model to obtain an answer, and can obtain natural language based on the large language model to communicate with the user conveniently and quickly, thereby improving the user experience.
[0056] In an optional embodiment, the processor may define a function library, and the function library may contain multiple functions, such as query functions, calculation functions, etc. The large language model may interact with the function library and obtain the required functions from the function library in real time.
[0057] In an embodiment of the present application, determining the answer to the query content according to the target prompt includes: defining a function according to the rewritten query content; inputting the target prompt and the function definition into a large language model to obtain a second call parameter of the defined function; calling the defined function based on the second call parameter to perform a query operation in a database to obtain a query result; and inputting the query result into the large language model to obtain an answer.
[0058] The processor can determine the answer to the query content according to the target prompt. Specifically, the processor can define a function according to the rewritten query content. And input the target prompt and the function definition into the large language model to obtain the second call parameter of the defined function. The second call parameter can be a SQL (Structured Query Language) code. After obtaining the second call parameter, the processor can call the defined function based on the second call parameter to perform a query operation in the database to obtain a query result. After obtaining the query result, the processor can input the query result into the large language model to obtain an answer, thereby answering the user's query content.
[0059] In the embodiments of the present application, Figure 2As shown, the processor can obtain the user input string (corresponding to the query content above). After obtaining the user input string, the processor can input the user input string into the pump truck prompt classification model to obtain the prompt type corresponding to the user input string. After obtaining the prompt type, the processor can match the best preset prompt (corresponding to the target prompt template above) in the pump truck prompt library according to the prompt type. For example, the best preset prompt is:
[0060] ##Role
[0061] - Your name is Xiaolu, you are a data analyst, and your position is customer data analysis assistant.
[0062] Responsibilities
[0063] - Answer user questions based on data from the database.
[0064] ##Answer style
[0065] - Be more colloquial and friendly.
[0066] - Don't say 'sorry', just give the answer directly.
[0067] - Don't add 'Xiaolu said:' in front.
[0068] - Analyze and answer step by step.
[0069] The processor can input the user input string into the pump truck entity recognition model for entity recognition to obtain the entity in the user input string. After obtaining the entity, the processor can convert the entity into a vector through Embedding. After obtaining the converted vector, the processor can match the relevant pump truck knowledge from the pump truck Vector knowledge base according to the vector. The processor can rewrite the user input string with the matched pump truck knowledge to obtain the final user query content, such as the final query content is "What is the volume of pump truck No. A in May 2024?".
[0070] After obtaining the best preset prompt and the final query content, the processor can concatenate the best preset prompt and the final query content to form a complete prompt (corresponding to the target prompt above). The complete prompt is:
[0071] ##Role
[0072] - Your name is Xiaolu, you are a data analyst, and your position is customer data analysis assistant.
[0073] Responsibilities
[0074] - Answer user questions based on data from the database.
[0075] ##Answer style
[0076] - Be more colloquial and friendly.
[0077] - Don't say 'sorry', just give the answer directly.
[0078] - Don't add 'Xiaolu said:' in front.
[0079] - Analyze and answer step by step.
[0080] ##question
[0081] -What is the volume of A-number pump truck in May 2024?
[0082] After getting the complete prompt, the processor can define the Function. For example, the Function definition is:
[0083] tools=[{
[0084]
[0085] After obtaining the Function definition, the processor can call the application to input the complete prompt and Function definition into the large language model to obtain the function call parameters returned by the large language model, so that the information fed back by the large language model is more accurate and the "illusion" of the model is reduced. The function call parameter can be a piece of SQL code, such as "SELECT host_id, pump_acc, mounth FROM idl_pump_mounth where mounth=202405and host_id='A' ORDER_BY pump_acc DESC LIMIT 1". After obtaining the function call parameters, the processor can call the application to call the function Function based on the function call parameters to obtain the function call result. That is, the SQL code is injected into the database to execute the query task to obtain the query result. After obtaining the function call result, the processor can input the function call result into the large language model to generate a natural language answer through the large language model and pass it to the application to inform the user of the answer to the query content, so that the user can get a reply conveniently and quickly, improving the user experience.
[0086] Through the above technical solution, the accuracy of answers is improved, and the timeliness of responses is improved, so that user questions can be answered quickly and accurately.
[0087] Figure 1 and Figure 2FIG. 1 is a flow chart of a question-answering method in one embodiment. It should be understood that although Figure 1 and Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 and Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0088] The present application also provides a question-and-answer device, including:
[0089] a memory configured to store instructions;
[0090] The processor is configured to call instructions from the memory and implement the above-mentioned question-and-answer method when executing the instructions.
[0091] An embodiment of the present application also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned question-and-answer method.
[0092] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected via a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The database of the computer device is used to store data such as query content, prompt type, target prompt template, query vector, target prompt and answer. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program B02 is executed by the processor A01, a question-and-answer method is implemented.
[0093] Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0094] An embodiment of the present application provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining a user's query content; inputting the query content into a classification model to obtain a prompt type corresponding to the query content; determining a target prompt template according to the prompt type; determining a query vector corresponding to the query content; rewriting the query content according to the query vector to obtain rewritten query content; concatenating the target prompt template and the rewritten query content to obtain a target prompt; and determining an answer to the query content according to the target prompt.
[0095] In one embodiment, determining the answer to the query content according to the target prompt includes: inputting the target prompt into a large language model to determine a target function corresponding to the target prompt through the large language model, and outputting a first calling parameter for calling the target function; calling the target function based on the first calling parameter to perform a query operation in a database to obtain a query result; and inputting the query result into the large language model to obtain an answer.
[0096] In one embodiment, determining the answer to the query content according to the target prompt includes: defining a function according to the rewritten query content; inputting the target prompt and the function definition into a large language model to obtain a second call parameter of the defined function; calling the defined function based on the second call parameter to perform a query operation in a database to obtain a query result; and inputting the query result into the large language model to obtain an answer.
[0097] In one embodiment, determining a query vector corresponding to the query content includes: determining an entity in the query content; and inputting the entity into an embedding model to obtain the query vector.
[0098] In one embodiment, determining entities in the query content includes: inputting the query content into an entity recognition model to obtain entities.
[0099] In one embodiment, determining the target prompt template according to the prompt type includes: inputting the prompt type into a prompt template library to determine the matching degree between the prompt type and each prompt template in the prompt template library; and determining the prompt template corresponding to the maximum matching degree as the target prompt template.
[0100] In one embodiment, rewriting the query content according to the query vector to obtain the rewritten query content includes: matching at least one field from a preset knowledge base according to the query vector; and generating the rewritten query content according to the at least one field.
[0101] In one embodiment, rewriting the query content according to the query vector to obtain the rewritten query content includes: determining the similarity between the query vector and each text vector in a preset knowledge base; selecting a text vector whose similarity is greater than a preset value, and generating the rewritten query content according to the selected text vector.
[0102] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program of the initialization question-answering method steps.
[0103] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0104] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0105] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0107] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0108] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0109] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0110] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0111] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A question-answering method, characterized in that: The method comprises: Get the user's query content; Inputting the query content into a classification model to obtain a prompt type corresponding to the query content; Determine the target prompt template according to the prompt type; Determining a query vector corresponding to the query content; Rewriting the query content according to the query vector to obtain rewritten query content; Concatenate the target prompt template and the rewritten query content to obtain the target prompt; An answer to the query content is determined according to the target prompt.
2. The question-answering method according to claim 1, characterized in that: Determining the answer to the query content according to the target prompt includes: Inputting the target prompt into a large language model to determine a target function corresponding to the target prompt through the large language model, and outputting a first calling parameter for calling the target function; Calling the target function based on the first calling parameter to perform a query operation in a database to obtain a query result; The query result is input into the large language model to obtain the answer.
3. The question-answering method according to claim 1, characterized in that: Determining the answer to the query content according to the target prompt includes: Define a function according to the rewritten query content; Inputting the target prompt and the function definition into the large language model to obtain a second calling parameter of the defined function; Calling the defined function based on the second calling parameter to perform a query operation in a database to obtain a query result; The query result is input into the large language model to obtain the answer.
4. The question-answering method according to claim 1, characterized in that: The determining a query vector corresponding to the query content comprises: Determining entities in the query content; The entity is input into the embedding model to obtain the query vector.
5. The question-answering method according to claim 4, characterized in that: Determining the entity in the query content includes: The query content is input into an entity recognition model to obtain the entity.
6. The question-answering method according to claim 1, characterized in that: Determining the target prompt template according to the prompt type includes: Inputting the prompt type into a prompt template library to determine a matching degree between the prompt type and each prompt template in the prompt template library; The prompt template corresponding to the maximum matching degree is determined as the target prompt template.
7. The question-answering method according to claim 1, characterized in that: The rewriting the query content according to the query vector to obtain the rewritten query content includes: Matching at least one field from a preset knowledge base according to the query vector; A rewritten query content is generated according to the at least one field.
8. The question-answering method according to claim 1, characterized in that: The rewriting the query content according to the query vector to obtain the rewritten query content includes: Determining the similarity between the query vector and each text vector in a preset knowledge base; Select text vectors whose similarity is greater than a preset value, and generate rewritten query content based on the selected text vectors.
9. A question-answering device, characterized in that: include: a memory configured to store instructions; A processor is configured to call the instructions from the memory and implement the question-answering method according to any one of claims 1 to 8 when executing the instructions.
10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores instructions for causing a machine to execute the question-answering method according to any one of claims 1 to 8.