Code retrieval question and answer method and device, equipment and storage medium

By determining the user's request intention and expected code language categories, obtaining code search routing and recall results, and combining code analysis to output search results, the problem of accurate matching of enterprise code search Q&A systems in massive codes is solved, and the accuracy of code search is improved.

CN119599128APending Publication Date: 2025-03-11CLP JINXIN SOFTWARE (SHANGHAI CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411646654.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the prior art, the enterprise code search question and answer system cannot accurately match the business code queried by users in a massive amount of enterprise code accumulation, resulting in low code search accuracy.

Method used

By determining the user's request intent and expected code language category, the corresponding code search route is determined, and the code recall result is obtained through the route. The target code information is determined based on the recall results and the expected code language category, and the preset code analysis model is used to interpret the output code search results based on the original code text and/or code Chinese.

Benefits of technology

It realizes the accurate identification of user request intentions in a massive enterprise code, and obtains relevant code recall results through code search routes, improving the accuracy of code search.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599128A_ABST
    Figure CN119599128A_ABST
Patent Text Reader

Abstract

The invention discloses a code retrieval question and answer method, device and equipment and a storage medium, and relates to the technical field of retrieval question and answer, and the method comprises the following steps: determining a user request intention and an expected code language category according to a code retrieval question and answer request input by a user; a code retrieval route corresponding to the user request intention is determined, a code recall result is obtained through the code retrieval route, and the code recall result is a result with the correlation with the user request intention exceeding a preset correlation threshold value in a code library; determining target code information based on the code recall result and the expected code language category, wherein the target code information comprises at least one of a code original text and code Chinese interpretation; and explaining and outputting a code retrieval result based on the code original text and / or code Chinese through the preset code analysis large model. By applying the technical scheme, the technical problem that in the prior art, an enterprise code retrieval question-answering system cannot accurately match business codes queried by a user in massive enterprise code accumulation is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of search and answering technology, and in particular to a code search and answering method, device, equipment and storage medium. Background Art

[0002] Since the advent of the big language model, the big model retrieval question-answering system, which combines the summarization and induction of the big model, the language generation ability and the precise retrieval characteristics of the retrieval knowledge base, has been increasingly used in multiple vertical fields such as finance, medical care, and energy. In an enterprise, business personnel and system developers will accumulate a large amount of business codes written in different code languages. When optimizing these codes, iterating and upgrading versions, and fixing bugs, the amount of business code is usually large, so developers often cannot fully integrate the codes of all functional components in the system, and cannot accurately understand some old codes. As a result, the enterprise code retrieval question-answering system cannot accurately match the business code that users want to query in the massive accumulation of enterprise codes, and the code retrieval accuracy is not high.

[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of this application is to provide a code retrieval question and answer method, device, equipment and storage medium, aiming to solve the technical problem in the prior art that the enterprise code retrieval question and answer system cannot accurately match the business code queried by the user in the massive accumulation of enterprise codes.

[0005] To achieve the above purpose, the present application proposes a code retrieval question-answering method, wherein the method comprises:

[0006] Determine the user's request intent and expected code language category according to the code retrieval question and answer request input by the user;

[0007] Determine a code retrieval route corresponding to the user request intent, and obtain a code recall result through the code retrieval route, wherein the code recall result is a result in a code library whose relevance to the user request intent exceeds a preset relevance threshold;

[0008] Determine target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of the original code and the Chinese interpretation of the code;

[0009] The code retrieval result is output based on the original code text and / or the Chinese interpretation of the code through a preset code analysis model.

[0010] In one embodiment, the user request intention includes: code generation; the step of obtaining the code recall result through the code retrieval route includes:

[0011] When the user request is intended for code generation, determining the code retrieval route as a code generation route;

[0012] Performing vectorization processing on the user question based on the first embedding model through the code generation route to obtain a first question vectorization result;

[0013] Obtaining a first code recall result for the first problem vectorization result based on the code vector library, where the first code recall result is a result in the code vector library whose correlation with the first problem vectorization result exceeds a preset correlation threshold;

[0014] The step of determining target code information based on the code recall result and the expected code language category comprises:

[0015] Determine a first code vector quadruple from the first code recall result based on the expected code language category, the first code vector quadruple being a code vector quadruple in the first code recall result whose code language category is the same as the expected code language category;

[0016] The original code in the first code vector quadruple is determined as the target code information.

[0017] In one embodiment, the step of outputting the code search result based on the original code text and / or the Chinese interpretation of the code by using a preset code analysis model includes:

[0018] If the target code information is a code original, obtaining a target code fragment from the target code information;

[0019] Generate first text prompt information based on the target code fragment;

[0020] Determine a first task flow corresponding to the preset code analysis model according to the first text prompt information, wherein the first task flow includes: code summary generation, code transcription, and code direct generation;

[0021] The code retrieval result is output based on the first task flow through the preset code analysis model.

[0022] In one embodiment, the user request intention includes: code interpretation; the step of obtaining the code recall result through the code retrieval route includes:

[0023] When the user request intention is code interpretation, determining the code retrieval route as a code interpretation route;

[0024] Vectorizing the user question based on the second embedding model through the code interpretation routing to obtain a vectorization result of the second question;

[0025] Obtaining a second code recall result for the vectorization result of the second question based on the text vector library, where the second code recall result is a result in the text vector library whose correlation with the vectorization result of the second question exceeds a preset correlation threshold;

[0026] The step of determining target code information based on the code recall result and the expected code language category comprises:

[0027] Determine a second code vector quadruple from the second code recall result based on the expected code language category, the second code vector quadruple being a code vector quadruple in the second code recall result whose code language category is the same as the expected code language category;

[0028] The Chinese interpretation of the code in the second code vector quadruple is determined as the target code information.

[0029] In one embodiment, the step of outputting the code search result based on the original code text and / or the Chinese interpretation of the code by using a preset code analysis model includes:

[0030] If the target code information is a Chinese interpretation of the code, obtaining the Chinese interpretation of the target code from the target code information;

[0031] Generate second text prompt information based on the Chinese interpretation of the target code;

[0032] Determine a second task flow corresponding to the preset code analysis model according to the second text prompt information, wherein the second task flow includes: code summary explanation, code reference explanation and code direct explanation;

[0033] The code retrieval result is output based on the second task process through the preset code analysis model.

[0034] In one embodiment, before the step of determining the user's request intention and the expected code language category according to the code search question and answer request input by the user, the step further includes:

[0035] Analyze the user's stored code files at the function level through a preset code analysis model to obtain the Chinese code interpretation and code language category corresponding to each code snippet in the user's stored code files;

[0036] Encode the code snippet and the Chinese interpretation of the code to obtain a code embedding vector and a text embedding vector;

[0037] The code embedding vector, the code snippet, the Chinese interpretation of the code and the code language category are stored in a code vector library according to a first storage form;

[0038] The text embedding vector, the Chinese interpretation of the code, the code snippet and the code language category are stored in a text vector library according to a second storage form.

[0039] In one embodiment, before the step of determining the user's request intention and the expected code language category according to the code search question and answer request input by the user, the step further includes:

[0040] Determine the code processing tasks corresponding to the initial code analysis model, wherein the code processing tasks include: code interpretation tasks, code snippet generation tasks, and code type identification tasks;

[0041] Determine a first fine-tuning data sample corresponding to the code interpretation task, a second fine-tuning data sample corresponding to the code snippet generation task, and a third fine-tuning data sample corresponding to the code type determination task;

[0042] The initial code analysis large model is fine-tuned based on the first fine-tuning data sample, the second fine-tuning data sample and the third fine-tuning data sample to obtain a preset code analysis large model.

[0043] In addition, to achieve the above purpose, the present application also proposes a code retrieval question-answering device, the device comprising:

[0044] A question-answering request analysis module is used to determine the user's request intent and expected code language category based on the code retrieval question-answering request input by the user;

[0045] A recall result acquisition module, used to determine a code retrieval route corresponding to the user request intent, and acquire a code recall result through the code retrieval route, wherein the code recall result is a result in the code library whose relevance to the user request intent exceeds a preset relevance threshold;

[0046] A code information determination module, configured to determine target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of the original code text and the Chinese interpretation of the code;

[0047] The retrieval result generating module is used to output the code retrieval result based on the original code and / or the Chinese interpretation of the code through a preset code analysis model.

[0048] In addition, to achieve the above-mentioned purpose, the present application also proposes a code retrieval question and answer device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the code retrieval question and answer method as described above.

[0049] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the code retrieval question and answer method described above are implemented.

[0050] The present application provides a code retrieval question and answer method, which discloses determining a user request intent and an expected code language category according to a code retrieval question and answer request input by a user; determining a code retrieval route corresponding to the user request intent, and obtaining a code recall result through the code retrieval route, wherein the code recall result is a result in a code library whose relevance to the user request intent exceeds a preset relevance threshold; determining target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of a code original and a code Chinese interpretation; outputting a code retrieval result based on the code original and / or the code Chinese interpretation through a preset code analysis macro model; since the present invention can accurately identify the user request intent according to the code retrieval question and answer request, and divide the user request intent into different code retrieval routes to obtain code recall results, and determine the target code information based on the code recall result and the expected code language category, the preset code analysis macro model can perform accurate code retrieval based on the target code information to obtain a code retrieval result, thereby solving the technical problem in the prior art that the enterprise code retrieval question and answer system cannot accurately match the business code queried by the user in the massive accumulation of enterprise codes, thereby improving the accuracy of code retrieval. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0052] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0053] Figure 1 A flowchart diagram of the first embodiment of the application code retrieval question and answer method is provided;

[0054] Figure 2A flowchart diagram of the second embodiment of the application code retrieval question and answer method is provided;

[0055] Figure 3 This is a schematic diagram of the overall process of the application code retrieval question and answer method;

[0056] Figure 4 A flowchart diagram of the third embodiment of the application code retrieval question and answer method is provided;

[0057] Figure 5 An overview diagram of the model training method in the code retrieval question-answering method for this application;

[0058] Figure 6 This is a schematic diagram of the module structure of the code retrieval question-and-answer device in the embodiment of the present application;

[0059] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the code retrieval question and answer method in the embodiment of the present application.

[0060] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0061] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0062] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0063] The main solution of the embodiment of the present application is: determine the user's request intent and the expected code language category based on the code retrieval question and answer request input by the user; determine the code retrieval route corresponding to the user's request intent, and obtain the code recall result through the code retrieval route, the code recall result is the result in the code library whose correlation with the user's request intent exceeds a preset correlation threshold; determine the target code information based on the code recall result and the expected code language category, the target code information includes at least one of the original code and the Chinese interpretation of the code; output the code retrieval result based on the original code and / or the Chinese interpretation of the code through a preset code analysis large model.

[0064] In the prior art, due to the large amount of business code, developers are often unable to fully integrate the code of all functional components in the system, and are unable to accurately understand some old codes. As a result, the enterprise code retrieval question and answer system cannot accurately match the business code that the user wants to query from the massive amount of accumulated enterprise codes, and the code retrieval accuracy is not high.

[0065] The present application provides a solution that can accurately identify the user's request intent based on the code retrieval question and answer request, and divide the user's request intent into different code retrieval routes to obtain code recall results, and determine the target code information based on the code recall results and the expected code language category, so that the preset code analysis large model can perform accurate code retrieval based on the target code information to obtain code retrieval results, thereby solving the technical problem in the prior art that the enterprise code retrieval question and answer system cannot accurately match the business code queried by the user in the massive accumulation of enterprise codes, thereby improving the accuracy of code retrieval.

[0066] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a code search and answering device, etc. The following takes the code search and answering device as an example (hereinafter referred to as the device) to illustrate this embodiment and the following embodiments.

[0067] Based on this, the embodiment of the present application provides a code retrieval question and answer method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the application code retrieval question and answer method.

[0068] In this embodiment, the code search question and answer method includes steps S10 to S40:

[0069] Step S10: Determine the user's request intention and expected code language category according to the code retrieval question and answer request input by the user.

[0070] It should be understood that the above-mentioned code retrieval question and answer request can be used to instruct the code analysis big model to make a request for business code query.

[0071] It is understandable that the user request intent can be an operation that the user wants the device to perform on the current code snippet. In this embodiment, the user request intent can include code generation and code interpretation, wherein code generation can be an operation that provides a code generation requirement for the user so that the model generates a piece of code that meets the conditions; code interpretation can be an operation that provides a piece of code for the user and requires the model to analyze the meaning of the code.

[0072] It should be understood that the above-mentioned expected code language category can be the language category of the code that the user expects the model to generate, such as: python code, java code, etc., and this embodiment does not limit this. In this embodiment, the pre-trained code language classification model can be used to determine what language the user wants to analyze and generate code, thereby determining the above-mentioned expected code language category.

[0073] Furthermore, before step S10, the method further includes:

[0074] Step S101: determine the code processing tasks corresponding to the initial code analysis large model, the code processing tasks include: code interpretation tasks, code snippet generation tasks and code type identification tasks.

[0075] It can be understood that the above-mentioned initial code analysis large model can be an untrained code analysis large model. The function of this model is to analyze the stored enterprise code. In this embodiment, the code analyzed by the model can be a project folder containing multiple scripts or a separate script. The code analysis content mainly analyzes the meaning of the code fragment (including a separate script or a project folder of multiple scripts).

[0076] It should be noted that the above-mentioned code processing tasks can be tasks that are currently required to be performed by the initial code analysis large model, including: code interpretation tasks, code snippet generation tasks and code type determination tasks, among which the code interpretation task can be a task of explaining the meaning of the code; the code snippet generation task can be a task of generating qualified code snippets; the code type determination task can be a task of determining the type of programming language used by the current code.

[0077] Step S102: Determine a first fine-tuning data sample corresponding to the code interpretation task, a second fine-tuning data sample corresponding to the code snippet generation task, and a third fine-tuning data sample corresponding to the code type determination task.

[0078] It should be noted that the sft data (Supervised Fine-Tun-ing) used for fine-tuning the large code analysis model can be divided into three categories of tasks, namely, code interpretation tasks, code snippet generation tasks, and code type discrimination tasks. Correspondingly, the above-mentioned first fine-tuning data sample can be an example of supervised fine-tuning data corresponding to the code interpretation task of the code analysis large model. In the present embodiment, the first fine-tuning data sample can be {"instruction":"Please analyze the meaning of the following code","input":"[Here is a code snippet]","output":"This code is used to..."}; the above-mentioned second fine-tuning data sample can be an example of supervised fine-tuning data corresponding to the code generation task of the code analysis large model. In the present embodiment, the second fine-tuning data sample can be {"instruction":"Please generate the corresponding code snippet according to my requirements","input":"Generate a piece of code in XX programming language that implements XX function","output":"[Here is a code snippet]"}; the above-mentioned third fine-tuning data sample can be an example of supervised fine-tuning data corresponding to the code type discrimination task of the code analysis large model. In the present embodiment, the third fine-tuning data sample can be {"instruction":"Please determine the type of programming language used in this code","input":"[Here is a code snippet]","output":"python"}.

[0079] Step S103: fine-tune the initial code analysis large model based on the first fine-tune data sample, the second fine-tune data sample and the third fine-tune data sample to obtain a preset code analysis large model.

[0080] In this embodiment, after determining the fine-tuning data samples corresponding to each processing task of the code analysis big model, the device can fine-tune the code analysis big model based on these fine-tuning data samples and using a variety of big model training methods and training frameworks, thereby obtaining a fine-tuned code analysis big model. That is, the device can fine-tune the initial code analysis big model based on the first fine-tuning data sample, the second fine-tuning data sample, and the third fine-tuning data sample to obtain a preset code analysis big model.

[0081] Step S20: determine the code retrieval route corresponding to the user request intent, and obtain the code recall result through the code retrieval route, wherein the code recall result is a result in the code library whose correlation with the user request intent exceeds a preset correlation threshold.

[0082] It should be noted that the above code retrieval route can be a route for processing code retrieval question and answer requests of different user intentions, for example: code generation route and code explanation route. In this embodiment, if the user request intention is code generation, the corresponding code retrieval route can be the code generation route route_generate; if the user request intention is code explanation, the corresponding code retrieval route can be the code explanation route route_explain.

[0083] It should be understood that the above-mentioned code recall result can be a result in the code library that has a high correlation with the user's intention (exceeding the above-mentioned preset correlation threshold), wherein the code library can be a database for storing the analysis result text or code after the preset code analysis model analyzes the code in the code file input by the user.

[0084] In this embodiment, an intention recognition module can be built in the device. When the user is performing a specific search for questions and answers, the question and answer request can be retrieved based on the code input by the user to identify the user's question intention, and the user's intention can be assigned to different search routes to recall relevant results, so as to obtain more accurate search results.

[0085] Step S30: Determine target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of the original code and the Chinese interpretation of the code.

[0086] It should be noted that the target code information may be result information in the code recall result that is consistent with the expected code language type. In this embodiment, the target code information may include at least one of the original code and the Chinese interpretation of the code.

[0087] Step S40: Outputting code retrieval results based on the original code text and / or the Chinese interpretation of the code through a preset code analysis model.

[0088] It should be noted that the above-mentioned preset code analysis model can be a model for analyzing the code stored in the enterprise code library. In addition, when the user performs code search questions and answers, the preset code analysis model can summarize the search results and give the user a complete answer. In this embodiment, the preset code analysis model can select general dialogue models such as chatglm, llama, baichuan, etc., or can use code models such as starcoder and starchat. During model training, the selection of model parameters and model fine-tuning data can be appropriately fine-tuned by the user in the vertical field according to his own business scenario so that the large language model can obtain the best learning ability for the scenario.

[0089] In actual applications, the original code and the Chinese interpretation of the code can be input into the preset code analysis model, and different prompts can be set to allow the preset code analysis model to interpret the original code and / or generate code based on the Chinese interpretation of the code, and finally output the code retrieval results.

[0090] The present embodiment provides a code retrieval question and answer method, which discloses determining a user request intent and an expected code language category according to a code retrieval question and answer request input by a user; determining a code retrieval route corresponding to the user request intent, and obtaining a code recall result through the code retrieval route, wherein the code recall result is a result in a code library whose relevance to the user request intent exceeds a preset relevance threshold; determining target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of the code original text and the code Chinese interpretation; outputting a code retrieval result based on the code original text and / or the code Chinese interpretation through a preset code analysis macro model; since the present embodiment can accurately identify the user request intent according to the code retrieval question and answer request, and divide the user request intent into different code retrieval routes to obtain code recall results, and determine the target code information based on the code recall result and the expected code language category, the preset code analysis macro model can perform accurate code retrieval based on the target code information to obtain a code retrieval result, thereby solving the technical problem in the prior art that the enterprise code retrieval question and answer system cannot accurately match the business code queried by the user in the massive accumulation of enterprise codes, thereby improving the accuracy of code retrieval.

[0091] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 , Figure 2 A flowchart diagram is provided for the second embodiment of the application code retrieval question and answer method.

[0092] In this embodiment, the user request intention includes: code generation; the step of obtaining the code recall result through the code retrieval route includes:

[0093] Step S201: when the user request is intended for code generation, the code retrieval route is determined as a code generation route.

[0094] It can be understood that the above-mentioned code generation route can be a route for processing a user intention request for code generation.

[0095] Step S202: vectorizing the user question based on the first embedding model through the code generation route to obtain a first question vectorization result.

[0096] It should be understood that the above-mentioned first embedding vector model can be a model for vectorizing user questions, wherein the first embedding vector model can also be used to vectorize the Chinese interpretation of the code in the analysis results of the code by the preset code analysis model; accordingly, the above-mentioned first question vectorization result is the result obtained after vectorizing the user question.

[0097] Step S203: Obtain a first code recall result for the first problem vectorization result based on the code vector library, where the first code recall result is a result in the code vector library whose correlation with the first problem vectorization result exceeds a preset correlation threshold.

[0098] It should be noted that the above code vector library can be a database for storing the original code. In practical applications, when building a code knowledge base, for the stored code snippets, a large code analysis model can be used to perform pairing analysis, and the code analysis text and the original code can be stored in the text vector library text-vector and the code vector library code-vector respectively.

[0099] In actual applications, if the device determines that the request intention of the code retrieval question and answer request input by the user is code generation, the request can be distributed to the code generation route for processing. Specifically, the code generation route can use the first embedding model to vectorize the user question, obtain the first question vectorization result, and input the first question vectorization result into the code vector library for similarity calculation, and then recall the results with correlation higher than the threshold P (i.e., the above-mentioned preset correlation threshold) according to the calculation result to obtain the first code recall result.

[0100] Accordingly, the step S30 includes:

[0101] Step S301: determining a first code vector quadruple from the first code recall result based on the expected code language category, wherein the first code vector quadruple is a code vector quadruple in the first code recall result whose code language category is the same as the expected code language category.

[0102] It should be noted that the storage format of the content stored in the code vector library code-vector can be {"embedding":"[here is the embedding vector code_embedding of a certain code snippet]","raw_code":"[here is the original text of the code snippet]","explain":"[here is the Chinese explanation of the code snippet]","code_type":"[here is the category of the programming language]"}, that is, the first code recall result is composed of several code vector quadruples (embedding, raw_code, explain, code_type), wherein the above-mentioned first code vector quadruplet can be a quadruplet whose code_type value in these code vector quadruples is the same as the language category of the code that the user expects to generate.

[0103] Step S302: Determine the original code in the first code vector quadruple as target code information.

[0104] It should be understood that after determining the first code vector quadruple, the device can input the value corresponding to the raw_code key in the first code vector quadruple (i.e., the original code) as the target code fragment (i.e., the above-mentioned target code information) that is likely to meet the user's code generation requirements into the code analysis model for summary, and finally return the result.

[0105] In actual applications, the device can input the vectorization result of the first problem into the code vector library code-vector for similarity calculation, and recall the results with correlation higher than the threshold P, retain the results whose code_type value in the (embedding, raw_code, explain, code_type) quadruple is consistent with the user's expected code type, and input the value corresponding to the raw_code key of these results, that is, the original code, as the target code fragment with a high probability that meets the user's code generation requirements into the code-analysis-model large model for summary, and finally return the result.

[0106] Furthermore, the step S40 includes: if the target code information is the original code, obtaining a target code fragment from the target code information; generating a first text prompt information based on the target code fragment; determining a first task flow corresponding to the preset code analysis model according to the first text prompt information, the first task flow including: code summary generation, code transcription and direct code generation; outputting code retrieval results based on the first task flow through the preset code analysis model.

[0107] In this embodiment, for the target code information in the recall results, the device can set a prompt to allow the code analysis model to summarize and rewrite across code languages. Specifically, if the user intends to generate code, the target code information is several code originals, and these code originals (i.e., the above-mentioned target code snippets) can be obtained from the target code information. At the same time, the prompt in the code analysis model (i.e., the above-mentioned first text prompt information) can be set to {"prompt": "Please answer the user's code generation requirements based on the following search results. The user's question is: [Here is the user's code generation requirements], and the reference search results are [Here are the raw_code results in several first code recall results]"}. In addition, if several results with a correlation with the user requirements higher than the threshold P are retrieved from the vectorized results of the first question, but the code_type of these results is inconsistent with the code type required by the user, these results will also be returned and the following prompt will be used to hand them over to the preset code analysis model for processing: {"prompt": "Please rewrite the code according to the following search results to meet the code generation requirements proposed by the user. The user question is: [here is the user's code generation requirement], and the reference search results are [here are the raw_code results in several first code recall results], you need to rewrite these reference results from [here is the code_type of these results] to [here is the code type of the user's code generation requirement]"}. If the vectorization results of the first question do not retrieve several results with a correlation higher than the threshold P with the user's requirements, it means that the user's code generation requirements may not exist in the code knowledge base. In this case, no search results are returned, and the generation is entirely dependent on the ability of the code analysis large model. The prompt is as follows: {"prompt": "Please generate code to meet the code generation requirements proposed by the user: [Here is the user's code generation requirement].}. Based on these text prompts, it can be determined that the task flow in the code analysis large model is to generate code by summarizing the content in the code base that is consistent with the code type expected by the user, or to generate code by transcribing the code, or to directly generate code, so that the code analysis large model can execute the corresponding task flow and output the code retrieval results.

[0108] Further, the user request intention includes: code interpretation; the step of obtaining the code recall result through the code retrieval route includes:

[0109] Step S211: when the user request intends to interpret the code, the code retrieval route is determined as the code interpretation route.

[0110] It can be understood that the above-mentioned code interpretation route can be a route for processing user intention requests for code interpretation.

[0111] Step S212: vectorizing the user question based on the second embedding model through the code interpretation routing to obtain a vectorization result of the second question.

[0112] It should be understood that the above-mentioned second embedding vector model can be a model for vectorizing user questions, wherein the second embedding vector model can also be used to vectorize code fragments in the analysis results of the code by the preset code analysis large model; accordingly, the above-mentioned second problem vectorization result is the result obtained after vectorizing the user question.

[0113] Step S213: Obtain a second code recall result for the second question vectorization result based on the text vector library, where the second code recall result is a result in the text vector library whose correlation with the second question vectorization result exceeds a preset correlation threshold.

[0114] It should be understood that the above-mentioned text vector library may be a database for storing code analysis texts.

[0115] In actual applications, if the device determines that the request intention of the code retrieval question and answer request input by the user is code interpretation, the request can be distributed to the code interpretation route for processing. Specifically, the code interpretation route can use the second embedding model to vectorize the user question, obtain the second question vectorization result, and input the second question vectorization result into the text vector library for similarity calculation, and then recall the results with correlation higher than the threshold P (i.e., the above-mentioned preset correlation threshold) according to the calculation result to obtain the second code recall result.

[0116] Accordingly, the step S30 includes:

[0117] Step S311: determining a second code vector quadruple from the second code recall result based on the expected code language category, wherein the second code vector quadruple is a code vector quadruple in the second code recall result whose code language category is the same as the expected code language category.

[0118] It should be noted that the storage format of the content stored in the text vector library text-vector can be {"embedding":"[here is the embedding vector text_embedding of the Chinese code explanation code_explain of a code snippet]","raw_text":"[here is the original text of the Chinese code explanation code_explain of a code snippet]","code":"[here is the original text of the code snippet]","code_type":"[here is the category of the programming language]"}, that is, the second code recall result is composed of several code vector quadruples (embedding, raw_text, explain, code_type), wherein the above-mentioned second code vector quadruples can be quadruples whose code_type values ​​in these code vector quadruples are the same as the language category of the code that the user expects to generate.

[0119] Step S312: Determine the Chinese interpretation of the code in the second code vector quadruple as the target code information.

[0120] It should be understood that after determining the second code vector quadruple, the device can input the value corresponding to the raw_text key in the second code vector quadruple (i.e., the Chinese interpretation of the code) as the target Chinese interpretation fragment (i.e., the above-mentioned target code information) that is most likely to meet the user's code interpretation requirements into the code analysis model for summary, and finally return the result.

[0121] In actual applications, the device can input the vectorized results of the second question into the text vector library text-vector for similarity calculation, and recall the results with correlation higher than the threshold P, retain the results whose code_type values ​​in the (embedding, raw_text, explain, code_type) quadruple are consistent with the user's expected code type, and input the values ​​corresponding to the raw_text keys of these results, that is, the Chinese explanation of the code, as the target Chinese interpretation fragments that are likely to meet the user's code generation requirements into the code-analysis-model large model for summary, and finally return the results.

[0122] Further, the step S40 includes: if the target code information is a Chinese interpretation of the code, obtaining the Chinese interpretation of the target code from the target code information; generating a second text prompt information based on the Chinese interpretation of the target code; determining a second task flow corresponding to the preset code analysis model according to the second text prompt information, the second task flow including: code summary interpretation, code reference interpretation and code direct interpretation; outputting the code retrieval result based on the second task flow through the preset code analysis model.

[0123] In this embodiment, if the user intends to interpret the code, the target code information is several Chinese code interpretations. At this time, the prompt in the code analysis model (i.e., the second text prompt information mentioned above) can be set to {"prompt": "Please interpret the code given by the user based on the following search results. The user's question is: [Here is the user's code interpretation requirement], and the search results for reference are [Here are the raw_text results of several second code recall results]"}. In addition, if several results with a correlation with the user's requirements higher than the threshold P are retrieved from the vectorized results of the second question, but the code_type of these results is inconsistent with the code type required by the user, these results will also be returned, and the following prompt will be used to hand them over to the preset code analysis model for processing: {"prompt": "Please interpret the user's [here is the type of code required by the user's code generation] code in accordance with the code retrieval results implemented as follows [here is the code_type of these results] to meet the code generation requirements proposed by the user. The user's question is: [Here is the user's code interpretation requirement], and the search results for reference are [here are the raw_text results of several second code recall results]"}; In addition, if the second question The quantization results of the question do not retrieve any results with a correlation higher than the threshold P with the user's requirements, indicating that the user's code explanation requirements may not exist in the code knowledge base. In this case, no search results are returned, and the generation is completely dependent on the ability of the preset code analysis model. The prompt is as follows: {"prompt": "Please explain the following code given by the user: [Here is the user's code explanation requirement].}. Based on these text prompts, it can be determined that the task flow in the code analysis model is to explain the code by summarizing the content in the code base that is consistent with the code type expected by the user, or to explain the code by referring to non-same category code, or to directly explain the code, so that the code analysis model can execute the corresponding task flow and output code retrieval results.

[0124] In the specific implementation, refer to Figure 3 , Figure 3 This is a schematic diagram of the overall process of the application code retrieval question and answer method. Figure 3As shown, after receiving the user input question, the device can determine the user request intent through the intent recognition module. If the user request intent is code generation, the device can distribute the request to the route route_generate for processing. The route can vectorize the user question through the first embedding model, and enter the vectorized result into the code-vector library for similarity calculation and recall the results with correlation higher than the threshold P, and retain the code_type value in the (embedding, raw_code, explain, code_type) quadruple of these results and the part of the code type corresponding to the user demand. The value corresponding to the raw_code key of these results, that is, the original code text, is input into the code-analysis-model large model as the target code fragment that is likely to meet the user's code generation requirements for summary, and finally return the result. For the several code snippets recalled here, the code-analysis-model model can directly summarize and generate and output code retrieval results; if a result with a correlation higher than a threshold value P is matched in the code-vector library, but it is inconsistent with the code type expected by the user, the code-analysis-model model can perform code transcription based on the corresponding prompt; in addition, if a result with a correlation higher than a threshold value P is not matched in the code-vector library, it means that the user's code generation requirements may not exist in the code knowledge base. At this time, no retrieval results are returned, and the generation depends entirely on the ability of the code-analysis-model model. If the user request intends to explain the code, the device can distribute the request to the route_explain for processing. The route can vectorize the user question through the second embedding model, and enter the vectorized result into the text-vector library for similarity calculation and recall the results with correlation higher than the threshold P, and retain the code_type value in the (embedding, raw_text, explain, code_type) quadruple of these results and the part of the code type corresponding to the user's needs. The value corresponding to the raw_text key of these results, that is, the Chinese code meaning explanation, is input into the code-analysis-model large model as the target Chinese interpretation fragment that is likely to meet the user's code interpretation requirements for summary, and finally the result is returned.For the Chinese explanations of several codes recalled here, the code-analysis-model model can directly summarize and generate and output code retrieval results; if a result with a correlation higher than a threshold value P is matched in the text-vector library, but it is inconsistent with the code type expected by the user, the code-analysis-model model can perform code transcription based on the corresponding prompt; in addition, if a result with a correlation higher than a threshold value P is not matched in the text-vector library, it means that the user's code generation requirements may not exist in the code knowledge base. At this time, no retrieval results are returned, and the generation depends entirely on the ability of the code-analysis-model model.

[0125] In this embodiment, it is disclosed that when the user request intention is code generation, the code retrieval route is determined as the code generation route; the user question is vectorized based on the first embedding model through the code generation route to obtain a first question vectorization result; a first code recall result is obtained for the first question vectorization result based on a code vector library, and the first code recall result is a result in which the correlation with the first question vectorization result in the code vector library exceeds a preset correlation threshold; a first code vector quadruple is determined from the first code recall result based on an expected code language category, and the first code vector quadruple is a code vector quadruple in which the code language category in the first code recall result is the same as the expected code language category; the code original in the first code vector quadruple is determined as the target code information, so that a recall result with a high similarity to the question vectorization result can be accurately matched from the code library, thereby accurately identifying the user's question intention, and further improving the accuracy of question retrieval by a subsequent preset code analysis large model.

[0126] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the above embodiments can be referred to the above introduction, and will not be described in detail later. Figure 4 , Figure 4 A flowchart diagram is provided for Example 3 of the application code retrieval question and answer method.

[0127] In this embodiment, before step S10, the method further includes steps S01 to S04:

[0128] Step S01: Analyze the user's stored code files at the function granularity through a preset code analysis model to obtain the Chinese code interpretation and code language category corresponding to each code snippet in the user's stored code files.

[0129] It should be understood that the above user-entered code may be a code in a project folder containing multiple code files uploaded by the user or a separate code file, and this embodiment does not limit this.

[0130] It can be understood that the Chinese interpretation of the above code can be the Chinese meaning interpretation of each code snippet in the user's stored code file; the above code language category can be the programming language category of each code snippet in the user's stored code file, such as python, java, etc., and this embodiment does not limit this.

[0131] Step S02: Encode the code snippet and the Chinese interpretation of the code to obtain a code embedding vector and a text embedding vector.

[0132] It should be understood that the above code embedding vector and text embedding vector can be encoding vectors corresponding to the code snippet and the Chinese interpretation of the code, respectively. In this embodiment, the code snippet can be encoded by the first embedding model to obtain the code embedding vector, and the code embedding vector is stored in the code vector library. At the same time, the Chinese interpretation of the code can also be encoded by the second embedding model to obtain the text embedding vector, and the text embedding vector is stored in the text vector library.

[0133] Step S03: storing the code embedding vector, the code snippet, the code Chinese interpretation and the code language category into a code vector library in a first storage format.

[0134] It should be noted that the above-mentioned first storage form, that is, the storage form of data in the code vector library, in this embodiment, can be stored in the code vector library according to the storage form of {"embedding":"[here is the embedding vector code_embedding of a certain code snippet]","raw_code":"[here is the original text of the code snippet]","explain":"[here is the Chinese explanation of the code snippet]","code_type":"[here is the category of the programming language]"} (that is, the above-mentioned first storage form).

[0135] Step S04: storing the text embedding vector, the Chinese interpretation of the code, the code snippet and the code language category into a text vector library according to a second storage format.

[0136] It should be noted that the above-mentioned second storage form, that is, the storage form of data in the text vector library, can be stored in the text vector library in this embodiment according to the storage form of {"embedding":"[here is the embedding vector text_embedding of the Chinese code explanation code_explain of a certain code snippet]","raw_text":"[here is the original text of the Chinese code explanation code_explain of a certain code snippet]","code":"[here is the original text of the code snippet]","code_type":"[here is the category of the programming language]"} (that is, the above-mentioned second storage form).

[0137] In this embodiment, the device can use the traditional NLP small model to parse the user's question through the intention recognition module. Figure 5 , Figure 5 This is an overview of the model training method in the code retrieval question answering method for this application. Figure 5As shown, in addition to training the code analysis model code-analysis-model (which includes code explanation tasks, code snippet generation tasks, and code type snippet tasks), this solution can also train a text classification model generate_or_explain, which is used to determine the user's intention, including: providing a code generation requirement, the system goal is to generate a piece of code that meets the conditions; providing a piece of code and requiring the system to analyze the meaning of the piece of code. Therefore, the text classification data used to train the generate_or_explain model can be in the form of: {"input": "Please analyze the meaning of the following code XXXXXX", "label": "explain"}, {"input": "Please generate a piece of XXXX code", "label": "generate"}. In addition, this solution can also train a code language classification model code_classification, which is used to determine what language the user wants to analyze and generate code. The text classification data used to train the code_type model can be in the form of: {"input": "Please analyze the meaning of the following python code XXXXXX", "label": "python"}, {"input": "Please generate a Java code of XXXX", "label": "java"}, so that when performing code detection questions and answers later, the text classification model generate_or_explain can be used to accurately determine the user's request intention, and the code language classification model code_classification can be used to accurately determine the language of the code that the user expects to analyze and generate, thereby improving the accuracy of code retrieval questions and answers.

[0138] In this embodiment, it is disclosed that a preset code analysis large model is used to analyze the user's stored code files at a function granularity to obtain the Chinese code interpretation and code language category corresponding to each code snippet in the user's stored code files; the code snippet and the Chinese code interpretation are encoded to obtain a code embedding vector and a text embedding vector; the code embedding vector, the code snippet, the Chinese code interpretation and the code language category are stored in a code vector library in a first storage form; the text embedding vector, the Chinese code interpretation, the code snippet and the code language category are stored in a text vector library in a second storage form, so that the recall results with high similarity to the question vectorization results can be matched from the vector library in the future to perform code retrieval questions and answers, thereby improving the accuracy of the retrieval results.

[0139] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the code retrieval question-and-answer method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0140] This application also provides a code retrieval question and answer device, please refer to Figure 6 , the code retrieval question-answering device comprises:

[0141] A question-answering request analysis module 10 is used to determine the user's request intention and expected code language category according to the code retrieval question-answering request input by the user;

[0142] A recall result acquisition module 20 is used to determine a code retrieval route corresponding to the user request intent, and obtain a code recall result through the code retrieval route, wherein the code recall result is a result in the code library whose relevance to the user request intent exceeds a preset relevance threshold;

[0143] A code information determination module 30, configured to determine target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of the original code text and the Chinese interpretation of the code;

[0144] The search result generation module 40 is used to output the code search result based on the original code and / or the Chinese interpretation of the code through a preset code analysis model.

[0145] The code search and question-answering device provided by the present application adopts the code search and question-answering method in the above embodiment, which can solve the technical problem that the enterprise code search and question-answering system in the prior art cannot accurately match the business code queried by the user in the massive accumulation of enterprise codes. Compared with the prior art, the beneficial effects of the code search and question-answering device provided by the present application are the same as the beneficial effects of the code search and question-answering method provided by the above embodiment, and the other technical features in the code search and question-answering device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0146] The present application provides a code retrieval question and answer device, which includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the code retrieval question and answer method in the above-mentioned embodiment 1.

[0147] Reference below Figure 7, which shows a schematic diagram of the structure of a code retrieval question-answering device suitable for implementing the embodiment of the present application. The code retrieval question-answering device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The code retrieval question-and-answer device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0148] like Figure 7 As shown, the code retrieval question-answering device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the code retrieval question-answering device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the code retrieval question-answering device to communicate wirelessly or wired with other devices to exchange data. Although the code retrieval question-answering device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0149] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0150] The code retrieval question and answer device provided by the present application adopts the code retrieval question and answer method in the above embodiment, which can solve the technical problems of code retrieval question and answer. Compared with the prior art, the beneficial effects of the code retrieval question and answer device provided by the present application are the same as the beneficial effects of the code retrieval question and answer method provided by the above embodiment, and other technical features in the code retrieval question and answer device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0151] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0152] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0153] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the code retrieval question-and-answer method in the above-mentioned embodiment.

[0154] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0155] The computer-readable storage medium may be included in the code retrieval question-answering device; or may exist independently without being assembled into the code retrieval question-answering device.

[0156] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the code retrieval question and answer device, the code retrieval question and answer device: determines the user request intention and the expected code language category according to the code retrieval question and answer request input by the user; determines the code retrieval route corresponding to the user request intention, and obtains the code recall result through the code retrieval route; determines the target code information based on the code recall result and the expected code language category; and outputs the code retrieval result based on the code original text and / or the Chinese interpretation of the code through a preset code analysis large model.

[0157] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0158] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0159] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0160] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned code retrieval question-and-answer method, and can solve the technical problem that the enterprise code retrieval question-and-answer system in the prior art cannot accurately match the business code queried by the user in the massive accumulation of enterprise codes. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the code retrieval question-and-answer method provided by the above-mentioned embodiment, and will not be elaborated here.

[0161] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A code retrieval question-answering method, characterized in that: The method includes: Determine the user's request intent and expected code language category according to the code retrieval question and answer request input by the user; Determine a code retrieval route corresponding to the user request intent, and obtain a code recall result through the code retrieval route, wherein the code recall result is a result in a code library whose relevance to the user request intent exceeds a preset relevance threshold; Determine target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of the original code and the Chinese interpretation of the code; The code retrieval result is output based on the original code text and / or the Chinese interpretation of the code through a preset code analysis model.

2. The method according to claim 1, characterized in that The user request intention includes: code generation; the step of obtaining the code recall result through the code retrieval route includes: When the user request is intended for code generation, determining the code retrieval route as a code generation route; Performing vectorization processing on the user question based on the first embedding model through the code generation route to obtain a first question vectorization result; Obtaining a first code recall result for the first problem vectorization result based on the code vector library, where the first code recall result is a result in the code vector library whose correlation with the first problem vectorization result exceeds a preset correlation threshold; The step of determining target code information based on the code recall result and the expected code language category comprises: Determine a first code vector quadruple from the first code recall result based on the expected code language category, the first code vector quadruple being a code vector quadruple in the first code recall result whose code language category is the same as the expected code language category; The original code in the first code vector quadruple is determined as the target code information.

3. The method according to claim 2, characterized in that The step of outputting the code search result based on the original code text and / or the Chinese interpretation of the code by using the preset code analysis model comprises: If the target code information is a code original, obtaining a target code fragment from the target code information; Generate first text prompt information based on the target code fragment; Determine a first task flow corresponding to the preset code analysis model according to the first text prompt information, wherein the first task flow includes: code summary generation, code transcription, and code direct generation; The code retrieval result is output based on the first task flow through the preset code analysis model.

4. The method according to claim 1, characterized in that The user request intention includes: code interpretation; the step of obtaining the code recall result through the code retrieval route includes: When the user request intention is code interpretation, determining the code retrieval route as a code interpretation route; Vectorizing the user question based on the second embedding model through the code interpretation routing to obtain a vectorization result of the second question; Obtaining a second code recall result for the vectorization result of the second question based on the text vector library, where the second code recall result is a result in the text vector library whose correlation with the vectorization result of the second question exceeds a preset correlation threshold; The step of determining target code information based on the code recall result and the expected code language category comprises: Determine a second code vector quadruple from the second code recall result based on the expected code language category, the second code vector quadruple being a code vector quadruple in the second code recall result whose code language category is the same as the expected code language category; The Chinese interpretation of the code in the second code vector quadruple is determined as the target code information.

5. The method according to claim 4, characterized in that The step of outputting the code search result based on the original code text and / or the Chinese interpretation of the code by using the preset code analysis model comprises: If the target code information is a Chinese interpretation of the code, obtaining the Chinese interpretation of the target code from the target code information; Generate second text prompt information based on the Chinese interpretation of the target code; Determine a second task flow corresponding to the preset code analysis model according to the second text prompt information, wherein the second task flow includes: code summary explanation, code reference explanation and code direct explanation; The code retrieval result is output based on the second task process through the preset code analysis model.

6. The method according to any one of claims 1 to 5, characterized in that Before the step of determining the user's request intention and the expected code language category according to the code retrieval question and answer request input by the user, the method further includes: Analyze the user's stored code files at the function level through a preset code analysis model to obtain the Chinese code interpretation and code language category corresponding to each code snippet in the user's stored code files; Encode the code snippet and the Chinese interpretation of the code to obtain a code embedding vector and a text embedding vector; The code embedding vector, the code snippet, the Chinese interpretation of the code and the code language category are stored in a code vector library according to a first storage form; The text embedding vector, the Chinese interpretation of the code, the code snippet and the code language category are stored in a text vector library according to a second storage form.

7. The method according to any one of claims 1 to 5, characterized in that Before the step of determining the user's request intention and the expected code language category according to the code retrieval question and answer request input by the user, the method further includes: Determine the code processing tasks corresponding to the initial code analysis model, wherein the code processing tasks include: code interpretation tasks, code snippet generation tasks, and code type identification tasks; Determine a first fine-tuning data sample corresponding to the code interpretation task, a second fine-tuning data sample corresponding to the code snippet generation task, and a third fine-tuning data sample corresponding to the code type determination task; The initial code analysis large model is fine-tuned based on the first fine-tuning data sample, the second fine-tuning data sample and the third fine-tuning data sample to obtain a preset code analysis large model.

8. A code search question and answer device, characterized in that: The device comprises: A question-answering request analysis module is used to determine the user's request intent and expected code language category based on the code retrieval question-answering request input by the user; A recall result acquisition module, used to determine a code retrieval route corresponding to the user request intent, and acquire a code recall result through the code retrieval route, wherein the code recall result is a result in the code library whose relevance to the user request intent exceeds a preset relevance threshold; A code information determination module, configured to determine target code information based on the code recall result and the expected code language category, wherein the target code information includes at least one of the original code text and the Chinese interpretation of the code; The retrieval result generating module is used to output the code retrieval result based on the original code and / or the Chinese interpretation of the code through a preset code analysis model.

9. A code retrieval question-answering device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the code retrieval question-answering method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the code retrieval question-and-answer method according to any one of claims 1 to 7 are implemented.