A large model question and answer method, device, equipment, storage medium and product

By generating target code from a list of candidate functions and task hints, and then executing the target function in the code interpreter, the problem of long generation time and high error rate in generating detailed code from large code models is solved, resulting in faster and more accurate question-and-answer results.

CN122111391APending Publication Date: 2026-05-29BEIJING CO WHEELS TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING CO WHEELS TECH CO LTD
Filing Date
2024-11-27
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Generating detailed code from existing large code models is time-consuming and prone to errors, reducing execution speed and accuracy.

Method used

By obtaining the questions to be answered, the list of candidate functions, and task prompts, target code is generated, and the code implementation of the target function is executed in the code interpreter, reducing the amount of code to be written and improving execution speed and accuracy.

Benefits of technology

By reducing the amount of code written manually, the execution speed and accuracy of the large code model were improved, and the possibility of generating error code was reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122111391A_ABST
    Figure CN122111391A_ABST
Patent Text Reader

Abstract

The application discloses a large model question and answer method and device, equipment, storage medium and product, and the method comprises the steps that a question to be answered and a first input prompt are acquired, the question to be answered and the first input prompt are input into a target large model, and a target code output by the target large model is obtained; wherein the first input prompt comprises a candidate function list and first task prompt information, and the first task prompt information is used for instructing the target large model to generate a code according to the question to be answered and the candidate function list; the target code is executed to obtain a code execution result; and a target question and answer result is generated according to the question to be answered, the target code and the code execution result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a large-scale question-answering method, apparatus, device, storage medium, and product. Background Technology

[0002] The code big model is a model that can understand a user's question and generate code to solve the question.

[0003] In existing technologies, large code models generate detailed code based on user questions. However, generating and executing detailed code snippets is time-consuming, thus slowing down the execution speed of large code models. Furthermore, the code generated by large models may contain errors, thereby reducing the accuracy of the large code model's answers to the questions. Summary of the Invention

[0004] This invention provides a method, apparatus, device, storage medium, and product for large-scale question answering, in order to improve the execution speed and accuracy of large-scale models.

[0005] According to one aspect of the present invention, a large-model question answering method is provided, comprising:

[0006] Obtain the question to be answered and the first input prompt, input the question to be answered and the first input prompt into the target large model, and obtain the target code output by the target large model; wherein, the first input prompt contains a candidate function list and a first task prompt information, the first task prompt information being used to instruct the target large model to generate code based on the question to be answered and the candidate function list;

[0007] Execute the target code to obtain the code execution result;

[0008] The target question and answer result is generated based on the question to be answered, the target code, and the execution result of the code.

[0009] Furthermore, the method for generating the target code from the target large model includes:

[0010] Based on the question to be answered and the candidate function list, the target function to be called is determined; wherein, the candidate function list includes at least one candidate function and its corresponding function description;

[0011] The target function is called from the target function library, and the target code containing the target function is generated based on the first task prompt information.

[0012] Further, based on the question to be answered and the candidate function list, the target function to be called is determined, including:

[0013] The question to be answered is matched sequentially with the function descriptions corresponding to each of the candidate functions in the candidate function list;

[0014] The candidate function that successfully matches is determined as the target function.

[0015] Further, executing the target code includes:

[0016] Extract the target function from the target code;

[0017] The code implementation of the target function is obtained in the code interpreter, and the target code is executed according to the code implementation of the target function.

[0018] Furthermore, before obtaining the question to be answered and the first input prompt, the process also includes:

[0019] The target code is obtained and encapsulated into at least one of the candidate functions, and the code implementations of each of the candidate functions are added to the code interpreter.

[0020] Further, generating a target question-and-answer result based on the question to be answered, the target code, and the code execution result includes:

[0021] Obtain a second input prompt; wherein the second input prompt contains a second task prompt information, the second task prompt information being used to instruct the target large model to answer based on the question to be answered, the target code, and the code execution result;

[0022] The unanswered question, the target code, the code execution result, and the second input prompt are input into the target large model to obtain the target question-answering result.

[0023] Further, the question to be answered, the target code, the code execution result, and the second input prompt are input into the target large model to obtain the target question-answering result, including:

[0024] The question to be answered, the target code, and the code execution result are concatenated sequentially to obtain the concatenated information;

[0025] The concatenated information and the second input prompt are input into the target large model, and the natural language text output by the target large model is used as the target question answering result.

[0026] According to another aspect of the present invention, a large-scale question-and-answer device is provided, comprising:

[0027] The target code output module is used to obtain the question to be answered and the first input prompt, input the question to be answered and the first input prompt into the target large model, and obtain the target code output by the target large model; wherein, the first input prompt contains a candidate function list and a first task prompt information, and the first task prompt information is used to instruct the target large model to generate code according to the question to be answered and the candidate function list;

[0028] The target code execution module is used to execute the target code and obtain the code execution result;

[0029] The target question-and-answer result output module is used to generate target question-and-answer results based on the question to be answered, the target code, and the code execution result.

[0030] Optionally, the device also includes a large target model for:

[0031] Based on the question to be answered and the candidate function list, the target function to be called is determined; wherein, the candidate function list includes at least one candidate function and its corresponding function description;

[0032] The target function is called from the target function library, and the target code containing the target function is generated based on the first task prompt information.

[0033] Optionally, the target large model is also used for:

[0034] The question to be answered is matched sequentially with the function descriptions corresponding to each of the candidate functions in the candidate function list;

[0035] The candidate function that successfully matches is determined as the target function.

[0036] Optionally, the target code execution module is also used for:

[0037] Extract the target function from the target code;

[0038] The code implementation of the target function is obtained in the code interpreter, and the target code is executed according to the code implementation of the target function.

[0039] Optionally, the apparatus further includes a candidate function encapsulation module for acquiring the target code and encapsulating it into at least one of the candidate functions, and adding the code implementation of each of the candidate functions into the code interpreter.

[0040] Optionally, the target question-answering result output module is also used for:

[0041] Obtain a second input prompt; wherein the second input prompt contains a second task prompt information, the second task prompt information being used to instruct the target large model to answer based on the question to be answered, the target code, and the code execution result;

[0042] The unanswered question, the target code, the code execution result, and the second input prompt are input into the target large model to obtain the target question-answering result.

[0043] Optionally, the target question-answering result output module is also used for:

[0044] The question to be answered, the target code, and the code execution result are concatenated sequentially to obtain the concatenated information;

[0045] The concatenated information and the second input prompt are input into the target large model, and the natural language text output by the target large model is used as the target question answering result.

[0046] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0047] At least one processor; and

[0048] A memory communicatively connected to the at least one processor; wherein,

[0049] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the large model question answering method according to any embodiment of the present invention.

[0050] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the large model question-answering method according to any embodiment of the present invention.

[0051] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program / instructions, which, when executed by a processor, implement the steps of the large model question-answering method described in any embodiment of the present invention.

[0052] The large-scale model question answering method disclosed in this invention first obtains the question to be answered and a first input prompt. The question to be answered and the first input prompt are then input into a target large-scale model to obtain the target code output by the target large-scale model. The first input prompt includes a candidate function list and first task prompt information, which instructs the target large-scale model to generate code based on the question to be answered and the candidate function list. Then, the target code is executed to obtain the code execution result. Finally, a target question answering result is generated based on the question to be answered, the target code, and the code execution result. This large-scale model question answering method, by inputting a candidate function list into the target large-scale model, enables the large-scale model to generate code based on the candidate function list, eliminating the need to write the code implementation of the functions in the candidate function list. This reduces the amount of code that the large-scale model needs to write, thereby improving the execution speed and accuracy of the large-scale model.

[0053] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0054] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 This is a flowchart of a large-scale question-answering method provided in Embodiment 1 of the present invention;

[0056] Figure 2 This is a flowchart of a large-scale question-answering method provided in Embodiment 2 of the present invention;

[0057] Figure 3 This is a schematic diagram of the structure of a large-scale question-and-answer device according to Embodiment 3 of the present invention;

[0058] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the large-scale question-and-answer method of Embodiment 4 of the present invention. Detailed Implementation

[0059] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0060] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0061] Example 1

[0062] Figure 1 This is a flowchart of a large-model question-answering method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where large-scale artificial intelligence models are used to generate code to answer questions. This method can be executed by a large-model question-answering device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0063] S110. Obtain the question to be answered and the first input prompt, input the question to be answered and the first input prompt into the target large model, and obtain the target code output by the target large model.

[0064] In this embodiment, the question to be answered can be a question that the target large model needs to answer, such as a question input by a user using the target large model. The target large model is an artificial intelligence large model that can understand the question to be answered and can generate code to solve the question. The input information of the target large model is the question to be answered and a first input prompt, and the output information is the target code generated in response to the question.

[0065] The first input prompt includes a list of candidate functions and a first task prompt, which instructs the target large model to generate code based on the question to be answered and the list of candidate functions.

[0066] Optionally, the candidate function list contains at least one candidate function, which is a wrapper around specific code. This specific code is a pre-defined portion of the code implementation based on code generation requirements; for example, it could be frequently used code or code with high correctness requirements. According to the instructions in the first task prompt, when the candidate function list contains candidate functions that the target large model can call, the target large model can generate target code for the question to be answered by using the candidate functions in the candidate function list. When the candidate function list does not contain candidate functions that the target large model can call, the target large model can write its own code. Here, "large model" refers to a machine learning model with a large number of parameters and a complex computational structure. In this embodiment, the target large model can understand the input question and generate code to solve it. When training the target large model, training data is first collected, and an appropriate model structure, loss function, and other parameters are selected according to the task requirements. Then, the training data is input into the model, and the parameters of the target large model are adjusted based on the output results until the model achieves the expected results.

[0067] For example, the specific content of the first input prompt could be:

[0068] #Role: Code Assistant

[0069] #List of candidate functions:

[0070] - Function 1: reverse_string. This function reverses a string. The input parameter is a string named input_str, and the return value is the reversed string of the string named input_str.

[0071] #Task Hint:

[0072] - You can use functions from the function list or write your own code to solve the user's problem.

[0073] #User input issue:”

[0074] In the example, the first input prompt includes a list of candidate functions, which contains one candidate function, function 1. The first input prompt also includes the first task prompt: "You can use the functions in the function list or write your own code to solve the user's problem." After the question to be answered and the first input prompt are input into the target model, the target model can determine whether a candidate function in the list can solve the question. If the candidate function can solve the question, it can directly call the candidate function to generate the target code. If the candidate function cannot solve the question, the target model can write its own code to implement the solution.

[0075] S120. Execute the target code and obtain the code execution result.

[0076] In this embodiment, after the target large model outputs the target code, the target code can be executed in a preset code execution environment, and the corresponding code execution results can be obtained.

[0077] Optionally, a code interpreter can be used to execute the target code. The code interpreter is a tool for executing source code in real time and does not need to be pre-compiled into an executable file. Preferably, the code interpreter can pre-inject the code implementations of each candidate function in the candidate function list. If the target code is generated by calling candidate functions, the code interpreter can obtain and execute the code implementations corresponding to the candidate functions in the target code, thereby obtaining the code execution result.

[0078] S130. Generate target question and answer results based on the questions to be answered, target code, and code execution results.

[0079] In this embodiment, the target question-answering result is natural language information that conforms to normal grammatical rules and is generated based on the question to be answered, the target code, and the code execution result. Since the code execution result obtained by directly executing the target code may be characters, which are not easy for users to understand, the question to be answered, the target code, and the code execution result can be input into the target big model again, so that the target big model can generate the target question-answering result based on the question to be answered, the target code, and the code execution result, so that users can better understand it.

[0080] The large-scale model question answering method disclosed in this invention first obtains the question to be answered and a first input prompt, then inputs the question to be answered and the first input prompt into a target large-scale model to obtain the target code output by the target large-scale model. The first input prompt includes a candidate function list and a first task prompt, which instructs the target large-scale model to generate code based on the question to be answered and the candidate function list. Then, the target code is executed to obtain the code execution result. Finally, a target question answering result is generated based on the question to be answered, the target code, and the code execution result. This large-scale model question answering method, by inputting the candidate function list into the target large-scale model, enables the large-scale model to generate code based on the candidate function list, eliminating the need to write the code implementation of the functions in the candidate function list, thus reducing the amount of code written by the large-scale model and improving its execution speed and accuracy.

[0081] Example 2

[0082] Figure 2 This is a flowchart of a large-scale question-answering method provided in Embodiment 2 of the present invention. This embodiment is a refinement of the above embodiment, such as... Figure 2 As shown, the method includes:

[0083] S210. Obtain the question to be answered and the first input prompt, input the question to be answered and the first input prompt into the target large model, and obtain the target code output by the target large model.

[0084] The first input prompt includes a list of candidate functions and a first task prompt, which instructs the target large model to generate code based on the question to be answered and the list of candidate functions.

[0085] In this embodiment, the candidate function list contains at least one candidate function, which is obtained by encapsulating specific code. The first task prompt information can instruct the target large model to generate target code for the question to be answered by using the candidate function in the candidate function list or by writing its own code.

[0086] Optionally, the method for generating target code from the target large model can be as follows: determine the target function to be called based on the question to be answered and the candidate function list; wherein the candidate function list includes at least one candidate function and its corresponding function description; call the target function from the target function library, and generate target code containing the target function based on the first task prompt information.

[0087] Specifically, the function description of a candidate function may include: (1) the functionality that the function can achieve; (2) the input parameters of the function; and (3) the return value of the function. The target function determines the candidate functions that need to be called for the target big model. When generating target code, the target big model can determine whether there are any callable candidate functions in the candidate function list based on the question to be answered and the function descriptions of each candidate function. If so, it determines the target function to be called and calls the target function from the target function library, thereby generating target code containing the target function.

[0088] For example, if the first input prompt is:

[0089] #Role: Code Assistant

[0090] #List of candidate functions:

[0091] - Function 1: reverse_string. This function reverses the string. The input parameter is a string named input_str, and the return value is the reversed string of the string named input_str.

[0092] - Function 2: len, this function calculates the length of a string. The input parameter is a string named input_str, and the return value is the length of the string named input_str.

[0093] #Task Hint:

[0094] - You can use the functions in the function list or write your own code to solve the user's problem.

[0095] # User input question: "

[0096] Among the candidate function lists included, there are two candidate functions, namely function 1 (reverse_string) and function 2 (len). The function description of function 1 is "reverse_string, the function's function is to reverse the string. The input parameter is a string with the variable name input_str, and the return value is the string after reversing the string with the variable name input_str". The function description of function 2 is "len, the function's function is to calculate the length of the string. The input parameter is a string with the variable name input_str, and the return value is the length of the string with the variable name input_str".

[0097] For the question to be answered "How to read this string 'The weather is nice today' from right to left? How many Chinese characters are there in total?", function 1 and function 2 are determined as the target functions. The target code generated by the code large model after calling the target functions from the target function library is:

[0098] "str1 = "The weather is nice today"

[0099] print(reverse_string(str1))

[0100] print(len(str1))"

[0101] The target code contains the target functions reverse_string and len, but does not contain the specific code implementation of these two functions.

[0102] Optionally, according to the question to be answered and the candidate function list, the method for determining the target function to be called can be: match the question to be answered with the function descriptions corresponding to each candidate function in the candidate function list in turn; determine the candidate function with a successful match as the target function.

[0103] Specifically, since the function descriptions of the candidate functions specify the function functions, input parameters and return values, the target large model can traverse each candidate function in the candidate function list and judge whether each function description matches the question to be answered. For example, for the question to be answered "How to read this string 'The weather is nice today' from right to left", the function description of the candidate function reverse_string indicates that the function's function is to reverse the string, which can match the question to be answered, so reverse_string is determined as the target function.

[0104] S220. Extract the target function from the target code.

[0105] In this embodiment, after the target code is generated, it needs to be executed in a preset code execution environment to obtain the corresponding code execution results. If the target code calls a target function, since the target code does not contain the specific code implementation of the target function, it is necessary to extract the target function from the target code before executing it in order to obtain the code implementation of the target function.

[0106] S230. Obtain the code implementation of the target function in the code interpreter, execute the target code according to the code implementation of the target function, and obtain the code execution result.

[0107] In this embodiment, a code interpreter can be used to execute the target code, and the code implementations of each candidate function in the candidate function list are pre-injected into the code interpreter. After extracting the target function from the target code, since the specific code implementation has been injected into the code interpreter, the code implementation of the target function can be obtained in the code interpreter and executed correctly.

[0108] For example, if the target code generated by the large code model is:

[0109] str1 = "The weather is really nice today"

[0110] print(reverse_string(str1))

[0111] print(len(str1))”

[0112] After extracting the target function `reverse_string` and `len`, and obtaining the corresponding code implementation, the execution result of the target code is:

[0113] "Good true qi every day"

[0114] 6".

[0115] Furthermore, before obtaining the question to be answered and the first input prompt, you can also:

[0116] Obtain the target code and encapsulate it into at least one candidate function, then add the code implementation of each candidate function to the code interpreter.

[0117] Specifically, the target code can be code that implements a specific function, determined according to requirements. For example, frequently used code and / or code with high correctness requirements can be encapsulated into candidate functions. After encapsulation, the code implementation of each candidate function is injected into the code interpreter.

[0118] For example, the Python implementation of the string reversal function "reverse_string" is as follows:

[0119] "def reverse_string(input_str):

[0120] return input_str[::-1]”

[0121] The Python implementation code will be stored in the target function library and injected into the code interpreter. When the reverse_string(str1) function is called, it can be correctly executed by the code interpreter and output the reversed string of str1.

[0122] S240, Obtain the second input prompt.

[0123] The second input prompt includes a second task prompt, which instructs the target large model to answer based on the question to be answered, the target code, and the code execution result.

[0124] In this embodiment, the question to be answered, the target code, and the code execution result can be input into the target large model again. Under the guidance of the second input prompt, the target large model generates the target question and answer result based on the question to be answered, the target code, the code execution result, and the second input prompt, so that the user can better understand it.

[0125] For example, the second input prompt could be:

[0126] #Role: Code Assistant

[0127] #Task Hint:

[0128] - You need to reply to the user's question by combining the question to be answered, the target code used to solve the problem, and the execution result of the code.

[0129] In the example, the second input prompt includes the second task prompt message: "You need to reply to the question by combining the question to be answered, the target code used to solve the problem, and the execution result of the code."

[0130] S250. Input the question to be answered, the target code, the code execution result, and the second input prompt into the target large model to obtain the target question-answering result.

[0131] In this embodiment, after obtaining the user question, target code, and code execution result, the user question, target code, and code execution result can be concatenated and input into the target large model again along with the second input prompt.

[0132] Optionally, the method for obtaining the target Q&A result by inputting the question to be answered, the target code, the code execution result, and the second input prompt into the target large model can be as follows: concatenate the question to be answered, the target code, and the code execution result in sequence to obtain concatenated information; use the concatenated information and the second input prompt as input information to input into the target large model, and use the natural language text output by the target large model as the target Q&A result.

[0133] In this embodiment, the target Q&A result can be natural language text. Since the code execution result directly obtained by executing the target code may be characters and is not easily understood by the user, the question to be answered, the target code, and the code execution result can be concatenated and then input into the target large model again. Under the indication of the second input prompt, the target large model is made to generate natural language text that is easily understood by the user based on the question to be answered, the target code, and the code execution result. For example, in the example provided in S210, the concatenated information obtained by concatenating the question to be answered, the target code, and the code execution result in sequence can be:

[0134] "#Question to be answered:

[0135] How to read this string "The weather is nice today" from right to left? How many Chinese characters are there in total?

[0136] #Target code used to solve the problem:

[0137] str1 = "The weather is nice today"

[0138] print(reverse_string(str1))

[0139] print(len(str1))

[0140] #Code execution result

[0141] 今天天气好真

[0142] 6".

[0143] Use the concatenated information and the second input prompt as input information to input into the target large model. The target Q&A result output by the target large model can be:

[0144] "The weather is nice today" is read as "今天天气好真" from right to left, and there are 6 Chinese characters in total.

[0145] The large model question answering method disclosed in this invention inputs a list of candidate functions into the target large model and pre-injects the code implementation of the candidate functions into the code interpreter. This allows the large model to directly call the candidate functions in the candidate function list when generating code without generating specific code implementations. This reduces the amount of code generated by the large model, lowers the possibility of generating incorrect code by the large model and causing errors in the code interpreter, thereby improving the execution speed and accuracy of the large model.

[0146] Example 3

[0147] Figure 3 This is a schematic diagram of the structure of a large-scale question-and-answer device provided in Embodiment 3 of the present invention, as shown below. Figure 3 As shown, the device includes: a target code output module 310, a target code execution module 320, and a target question-and-answer result output module 330.

[0148] The target code output module 310 is used to obtain the question to be answered and the first input prompt, input the question to be answered and the first input prompt into the target large model, and obtain the target code output by the target large model.

[0149] The first input prompt includes a list of candidate functions and a first task prompt, which instructs the target large model to generate code based on the question to be answered and the list of candidate functions.

[0150] The target code execution module 320 is used to execute the target code and obtain the code execution result.

[0151] The target question and answer result output module 330 is used to generate target question and answer results based on the question to be answered, the target code, and the code execution result.

[0152] The second input prompt includes a second task prompt, which instructs the target large model to answer based on the question to be answered, the target code, and the code execution result.

[0153] Optionally, the device also includes a target large model 340 for:

[0154] Based on the questions to be answered and the list of candidate functions, determine the target function to be called; wherein the list of candidate functions includes at least one candidate function and its corresponding function description; call the target function from the target function library, and generate target code containing the target function based on the prompt information of the first task.

[0155] Optionally, the target large model 340 is also used for:

[0156] The question to be answered is matched sequentially with the function descriptions of each candidate function in the candidate function list; the candidate functions that are successfully matched are determined as the target functions.

[0157] Optionally, the target code execution module 320 is also used for:

[0158] Extract the target function from the target code; obtain the code implementation of the target function from the code interpreter; and execute the target code based on the code implementation of the target function.

[0159] Optionally, the apparatus further includes a candidate function encapsulation module 350, used to acquire the target code and encapsulate it into at least one candidate function, and add the code implementation of each candidate function into the code interpreter.

[0160] Optionally, the target question-and-answer result output module 330 is also used for:

[0161] Obtain a second input prompt; wherein the second input prompt contains a second task prompt information, which is used to instruct the target large model to answer based on the question to be answered, the target code, and the code execution result; input the question to be answered, the target code, the code execution result, and the second input prompt into the target large model to obtain the target question-answering result.

[0162] Optionally, the target question-and-answer result output module 330 is also used for:

[0163] The question to be answered, the target code, and the code execution result are concatenated sequentially to obtain the concatenated information. The concatenated information and the second input prompt are used as input information to the target large model, and the natural language text output by the target large model is used as the target question answering result.

[0164] The large model question-answering device provided in the embodiments of the present invention can execute the large model question-answering method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0165] Example 4

[0166] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0167] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0168] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0169] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as large model question answering methods.

[0170] In some embodiments, the large model question-answering method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the large model question-answering method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the large model question-answering method by any other suitable means (e.g., by means of firmware).

[0171] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0172] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0173] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0174] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0175] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0176] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0177] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0178] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A large-scale question-answering method, characterized in that, include: Obtain the question to be answered and the first input prompt, input the question to be answered and the first input prompt into the target large model, and obtain the target code output by the target large model; wherein, the first input prompt contains a candidate function list and a first task prompt information, the first task prompt information being used to instruct the target large model to generate code based on the question to be answered and the candidate function list; Execute the target code to obtain the code execution result; The target question and answer result is generated based on the question to be answered, the target code, and the execution result of the code.

2. The method according to claim 1, characterized in that, The method for generating the target code from the target large model includes: Based on the question to be answered and the candidate function list, the target function to be called is determined; wherein, the candidate function list includes at least one candidate function and its corresponding function description; The target function is called from the target function library, and the target code containing the target function is generated based on the first task prompt information.

3. The method according to claim 2, characterized in that, Based on the question to be answered and the list of candidate functions, the target function to be called is determined, including: The question to be answered is matched sequentially with the function descriptions corresponding to each of the candidate functions in the candidate function list; The candidate function that successfully matches is determined as the target function.

4. The method according to claim 2, characterized in that, Executing the target code includes: Extract the target function from the target code; The code implementation of the target function is obtained in the code interpreter, and the target code is executed according to the code implementation of the target function.

5. The method according to claim 4, characterized in that, Before obtaining the question to be answered and the first input prompt, it also includes: The target code is obtained and encapsulated into at least one of the candidate functions, and the code implementations of each of the candidate functions are added to the code interpreter.

6. The method according to claim 1, characterized in that, Generate a target question-and-answer result based on the question to be answered, the target code, and the execution result of the code, including: Obtain a second input prompt; wherein the second input prompt contains a second task prompt information, the second task prompt information being used to instruct the target large model to answer based on the question to be answered, the target code, and the code execution result; The unanswered question, the target code, the code execution result, and the second input prompt are input into the target large model to obtain the target question-answering result.

7. The method according to claim 6, characterized in that, The unanswered question, the target code, the code execution result, and the second input prompt are input into the target large model to obtain the target question-answering result, including: The question to be answered, the target code, and the code execution result are concatenated sequentially to obtain the concatenated information; The concatenated information and the second input prompt are input into the target large model, and the natural language text output by the target large model is used as the target question answering result.

8. A large-scale question-and-answer device, characterized in that, include: The target code output module is used to obtain the question to be answered and the first input prompt, input the question to be answered and the first input prompt into the target large model, and obtain the target code output by the target large model; wherein, the first input prompt contains a candidate function list and a first task prompt information, and the first task prompt information is used to instruct the target large model to generate code according to the question to be answered and the candidate function list; The target code execution module is used to execute the target code and obtain the code execution result; The target question-and-answer result output module is used to generate target question-and-answer results based on the question to be answered, the target code, and the code execution result.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the large model question answering method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the large model question-answering method of any one of claims 1-7.

11. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the large model question answering method as described in any one of claims 1-7.