Data source configuration method and device, electronic equipment and storage medium
By vectorizing the data source information input by users and matching target knowledge fragments from the preset knowledge base, and generating target configuration information with a large language model, the automatic configuration of data sources is realized, solving the problems of large development workload and poor user experience in the existing technology, improving user experience and reducing development workload.
Patent Information
- Application Number
- CN202411887894.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-29
AI Technical Summary
The existing data source configuration method requires designing different pages according to different types of data sources, which increases the development workload, and users need to manually configure the data source, which has a poor user experience.
By obtaining the data source information input by the user, vectorize it, and matching the target knowledge fragments from the preset knowledge base, generating the target configuration information in combination with the large language model, and automatically completing the data source configuration.
It realizes automatic configuration of data sources, improves user experience, reduces development workload, and does not need to design different configuration pages according to different data source types.
Smart Images

Figure CN119903043A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data source configuration method, device, electronic device and storage medium. Background Art
[0002] In the big data platform, data sources are the most basic configuration modules and are widely used in data exchange, data development, data services and other fields. At present, the configuration process of data sources has generally adopted the front-end interface operation, which greatly simplifies the user's operation steps. When creating a data source, the user must first select the corresponding data source type in the interface, and then fill in or check a series of configuration items according to the characteristics of the selected data source type. After completing the configuration, the user needs to click the "Connectivity Test" button to verify the connectivity of the data source until the data source can be successfully connected.
[0003] However, the current data source configuration requires the design of a new page for each new data source, as each type of data source has different characteristics and different configuration items, which increases the development workload. In addition, users need to manually configure the data source, resulting in a poor user experience. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a method, device, electronic device and storage medium for configuring a data source that overcome the above problems or at least partially solve the above problems.
[0005] In order to solve the above problem, an embodiment of the present invention discloses a method for configuring a data source, the method comprising:
[0006] Acquire data source information input by a user, wherein the data source information includes a type of data source and configuration data of the data source;
[0007] Vectorizing the data source information to obtain a first vector, and determining a first target knowledge fragment matching the first vector from a preset knowledge base, wherein the preset knowledge base includes knowledge fragments from multiple data sources;
[0008] Acquire a configuration information template and reference data of the data source, wherein the reference data includes the first target knowledge fragment;
[0009] Inputting a configuration information template of the data source, a type of the data source, configuration data of the data source, and the reference data into a large language model, and obtaining target configuration information of the data source output by the large language model;
[0010] Connecting the data source according to the target configuration information of the data source;
[0011] If the data source is connected successfully, a first prompt message is sent to the user, where the first prompt message is used to indicate that the data source is configured successfully.
[0012] Optionally, performing vectorization according to the data source information to obtain a first vector includes:
[0013] Performing multiple queries on the large language model to determine a first preset number of approximate expressions of the data source information;
[0014] The approximate expression and the data source information are vectorized to obtain the first vector.
[0015] Optionally, determining a first target knowledge segment matching the first vector from a preset knowledge base includes:
[0016] For each first vector, according to the cosine similarity, determining from the preset knowledge base a second preset number of first candidate knowledge segments similar to the first vector, and the cosine similarities of the first candidate knowledge segments;
[0017] Determine the cosine similarity of the first candidate knowledge fragments for each of the first vectors, and a modified first target cosine similarity;
[0018] According to the first target cosine similarities of the first candidate knowledge fragments of the first vectors, the first candidate knowledge fragments of the first vectors are sorted in descending order according to the first target cosine similarities;
[0019] In said order, the second preset number of first candidate knowledge segments are selected from the first candidate knowledge segments of the respective first vectors as the first target knowledge segments.
[0020] Optionally, the inputting the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the large language model includes:
[0021] Get the data source configuration prompt word template;
[0022] Input the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the data source configuration prompt word template to obtain the data source configuration prompt word;
[0023] The data source configuration prompt words are input into the large language model.
[0024] Optionally, the method further includes:
[0025] If the connection to the data source fails, the reason for the failure to connect to the data source is obtained;
[0026] Vectorizing the cause to obtain a second vector, and determining a second target knowledge segment matching the second vector from the preset knowledge base;
[0027] determining whether additional configuration data is needed according to the second target knowledge fragment;
[0028] If the configuration data needs to be supplemented, a second prompt message is sent to the user, where the second prompt message is used to instruct the user to supplement the configuration data;
[0029] If supplementary configuration data is not needed, the second target knowledge fragment is added to the reference data.
[0030] Optionally, judging whether it is necessary to supplement configuration data according to the second target knowledge fragment includes:
[0031] Get configuration information to judge the prompt word template;
[0032] The prompt word template, the second target knowledge fragment, the reason and the target configuration information are determined according to the configuration information, and the large language model is queried to determine whether configuration data needs to be supplemented.
[0033] Optionally, the obtaining of data source information input by the user includes:
[0034] Obtain the demand information and demand judgment prompt word template input by the user;
[0035] Determining whether the requirement information is a requirement for configuring a data source according to the judgment prompt word template and the large language model;
[0036] If the requirement information is a requirement for configuring a data source, the requirement information is used as the data source information.
[0037] Accordingly, an embodiment of the present invention discloses a data source configuration device, the device comprising:
[0038] A data source information acquisition module, used to acquire data source information input by a user, wherein the data source information includes the type of data source and configuration data of the data source;
[0039] A first target knowledge fragment determination module is used to perform vectorization according to the data source information to obtain a first vector, and determine a first target knowledge fragment matching the first vector from a preset knowledge base, wherein the preset knowledge base includes knowledge fragments from multiple data sources;
[0040] A reference data acquisition module, used to acquire a configuration information template and reference data of the data source, wherein the reference data includes the first target knowledge fragment;
[0041] a target configuration information acquisition module, used to input the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the large language model, and acquire the target configuration information of the data source output by the large language model;
[0042] A data source connection module, used to connect the data source according to the target configuration information of the data source;
[0043] The first prompt information sending module is used to send a first prompt information to the user if the data source is successfully connected, wherein the first prompt information is used to indicate that the data source is successfully configured.
[0044] Optionally, the first target knowledge fragment determination module includes:
[0045] an approximate expression determination submodule, configured to perform multiple queries on the large language model to determine a first preset number of approximate expressions of the data source information;
[0046] The first vector determination submodule is used to vectorize the approximate expression and the data source information to obtain the first vector.
[0047] Optionally, the first target knowledge fragment determination module includes:
[0048] A first candidate knowledge segment determination submodule, configured to determine, for each first vector, a second preset number of first candidate knowledge segments similar to the first vector from the preset knowledge base according to the cosine similarity, and the cosine similarities of the first candidate knowledge segments;
[0049] A modified first target cosine similarity determination submodule, used to determine the cosine similarity of the first candidate knowledge fragments for each of the first vectors, and a modified first target cosine similarity;
[0050] A sorting submodule, configured to sort the first candidate knowledge fragments of each first vector in descending order according to the first target cosine similarity of the first candidate knowledge fragments of each first vector;
[0051] The first target knowledge segment determination submodule is configured to select, in the order, the second preset number of first candidate knowledge segments from the first candidate knowledge segments of the respective first vectors as the first target knowledge segments.
[0052] Optionally, the target configuration information acquisition module includes:
[0053] The data source configuration prompt word template acquisition submodule is used to obtain the data source configuration prompt word template;
[0054] A data source configuration prompt word determination submodule, used to input the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the data source configuration prompt word template to obtain a data source configuration prompt word;
[0055] The data source configuration prompt word input submodule is used to input the data source configuration prompt word into the large language model.
[0056] Optionally, the device further comprises:
[0057] A reason acquisition module, used for acquiring the reason for the failure to connect to the data source if the connection to the data source fails;
[0058] A second target knowledge fragment determination module, used for vectorizing the cause to obtain a second vector, and determining a second target knowledge fragment matching the second vector from the preset knowledge base;
[0059] A supplementary configuration data judgment module, used to judge whether supplementary configuration data is needed according to the second target knowledge fragment;
[0060] A second prompt information sending module, used for sending second prompt information to the user if supplementary configuration data is required, wherein the second prompt information is used for instructing the user to supplement the configuration data;
[0061] The second target knowledge fragment adding module is used to add the second target knowledge fragment to the reference data if the supplementary configuration data is not needed.
[0062] Optionally, the supplementary configuration data judgment module includes:
[0063] A configuration information judgment prompt word template acquisition submodule is used to acquire a configuration information judgment prompt word template;
[0064] The supplementary configuration data judgment submodule is used to judge the prompt word template, the second target knowledge fragment, the reason and the target configuration information according to the configuration information, query the large language model, and judge whether the supplementary configuration data is needed.
[0065] Optionally, the data source information acquisition module includes:
[0066] The demand information acquisition submodule is used to obtain the demand information and demand judgment prompt word template input by the user;
[0067] A demand information judgment submodule, used to judge whether the demand information is a data source configuration demand according to the judgment prompt word template and the large language model;
[0068] The data source information determination submodule is used to use the demand information as the data source information if the demand information is a demand for configuring a data source.
[0069] Correspondingly, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the various steps of the above-mentioned data source configuration method embodiment when executed by the processor.
[0070] Accordingly, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each step of the above-mentioned data source configuration method embodiment is implemented.
[0071] The embodiments of the present invention include the following advantages:
[0072] A data source configuration method according to an embodiment of the present invention obtains data source information input by a user, the data source information includes the type of data source and configuration data of the data source; vectorization is performed according to the data source information to obtain a first vector, and a first target knowledge fragment matching the first vector is determined from a preset knowledge base, the preset knowledge base includes knowledge fragments of multiple data sources; a configuration information template and reference data of the data source are obtained, the reference data includes the first target knowledge fragment; the configuration information template, the type of data source, the configuration data of the data source and the reference data of the data source are input into a large language model, and the target configuration information of the data source output by the large language model is obtained; the data source is connected according to the target configuration information of the data source; if the data source is successfully connected, a first prompt information is sent to the user, and the first prompt information is used to indicate that the data source configuration is successful. By obtaining the data source information input by the user, determining the target configuration information of the data source information according to the large language model, and then connecting the data source according to the target configuration information, the automatic configuration of the data source is realized, the user experience is improved, and there is no need to design and develop different configuration pages according to different data sources, reducing the development workload. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 is a flowchart of a method for configuring a data source according to an embodiment of the present invention;
[0074] Figure 2 is a schematic diagram of a dialogue with a user according to an embodiment of the present invention;
[0075] Figure 3It is a structural block diagram of a data source configuration device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0076] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0077] In the big data platform, data sources are the most basic configuration modules and are widely used in data exchange, data development, data services and other fields. At present, the configuration process of data sources has generally adopted the front-end interface operation, which greatly simplifies the user's operation steps. When creating a data source, the user must first select the corresponding data source type in the interface, and then fill in or check a series of configuration items according to the characteristics of the selected data source type. After completing the configuration, the user needs to click the "Connectivity Test" button to verify the connectivity of the data source until the data source can be successfully connected.
[0078] However, the current data source configuration requires the design of a new page for each new data source, as each type of data source has different characteristics and different configuration items, which increases the development workload. In addition, users need to manually configure the data source, resulting in a poor user experience.
[0079] In addition, the user needs to click the "Connectivity Test" button to verify the connectivity of the data source. If connectivity fails, the user needs to query the user manual or information based on the error message to manually modify the configuration information. This requires the user to have sufficient professional knowledge of the data source and has high requirements for the user. In addition, due to 3. When encountering data source configuration problems, the user needs to manually modify the configuration, and it is impossible to automatically solve the configuration problem, resulting in a poor user experience.
[0080] One of the core concepts of the embodiments of the present invention is to obtain the data source information input by the user, determine the target configuration information of the data source information according to the large language model, and then connect the data source according to the target configuration information, thereby realizing automatic configuration of the data source and improving the user experience. Moreover, there is no need to design and develop different configuration pages according to different data sources, thereby reducing the development workload.
[0081] Reference Figure 1 , shows a flowchart of a method for configuring a data source according to an embodiment of the present invention, which may specifically include the following steps:
[0082] Step 101: Acquire data source information input by a user, wherein the data source information includes the type of data source and configuration data of the data source.
[0083] Specifically, an embodiment of the present invention can adopt a dialogue mode to interact with the user. The user can input the type of data source to be created and the configuration data necessary to create the data source through the front-end dialog box. The back-end service obtains the data source information input by the user in the front-end dialog box. The data source information includes the type of data source to be created and the configuration data necessary to create the data source.
[0084] Exemplarily, when the user enters the conversation mode, refer to Figure 2 The front-end dialog box can give the user a dialogue guide, and the user can enter the data source to be created according to the reference format in the guide, where the user's input content is the data source information.
[0085] Step 102, vectorization is performed according to the data source information to obtain a first vector, and a first target knowledge segment matching the first vector is determined from a preset knowledge base, wherein the preset knowledge base includes knowledge segments of multiple data sources.
[0086] Exemplarily, the preset knowledge base can be a Milvus vector database, which can convert professional knowledge documents related to multiple data sources into TXT format, then divide the documents into segments according to knowledge points, and then use the DistilBERT (distilled version of BERT) model to generate vectors, and import the vectors into the Milvus vector database to obtain the preset knowledge base. Among them, the professional knowledge document can include knowledge content such as the connection configuration of the data source and the solution to the connection error. The DistilBERT model is a lightweight pre-trained language model, which is a simplified version of the BERT (Bidirectional Encoder Representations from Transformers) model, which aims to reduce the demand for computing resources while maintaining high performance.
[0087] Vectorization is performed according to the data source information to obtain a first vector, and a first target knowledge fragment matching the first vector is retrieved from a preset knowledge base.
[0088] Step 103: Acquire the configuration information template and reference data of the data source, wherein the reference data includes the first target knowledge fragment.
[0089] Specifically, a configuration information template and reference data of a data source are obtained, where the reference data includes a first target knowledge fragment. Exemplarily, the data source is a Hive data source, and the configuration information template of the Hive data source may be:
[0090]
[0091]
[0092] Step 104: input the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the large language model, and obtain the target configuration information of the data source output by the large language model.
[0093] Specifically, the large language model is called, the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data are input to the large language model, and the target configuration information of the data source output by the large language model is obtained. The target configuration information of the data source output by the large language model is the target configuration information output according to the configuration information template of the data source. Exemplarily, the target configuration information can be the target configuration information of the JSON (JavaScript Object Notation) structure. Among them, the large language model refers to those deep learning models with a large number of parameters and complex structures, which are specially used to process natural language processing tasks.
[0094] Step 105: Connect to the data source according to the target configuration information of the data source.
[0095] Specifically, you can call the data source verification tool to connect to the data source to verify whether the target configuration information of the JSON structure can connect to the data source. The data source verification tool is a toolkit written in Python, which has built-in driver packages required for connecting to multiple data sources. When calling the toolkit, you need to pass in the target configuration information of the JSON structure. The toolkit first introduces the corresponding driver package according to the data source type in the target configuration information, and then uses the driver package and the target configuration information to connect to the data source.
[0096] Step 106: If the data source is connected successfully, a first prompt message is sent to the user, where the first prompt message is used to indicate that the data source is configured successfully.
[0097] Specifically, if the data source is connected successfully, a first prompt message is sent to the user in the front-end dialog box, and the first prompt message is used to indicate that the data source configuration is successful.
[0098] In the embodiment of the present invention, the vectorization is performed according to the data source information to obtain the first vector, which may specifically include the following sub-steps:
[0099] Sub-step S11, performing multiple queries on the large language model to determine a first preset number of approximate expressions of the data source information.
[0100] Exemplarily, through multiple queries, a large language model is used to query n approximate expressions of the data source information input by the user. Of course, the embodiment of the present invention does not limit the first preset number.
[0101] Sub-step S12, vectorizing the approximate expression and the data source information to obtain the first vector.
[0102] Exemplarily, n approximate expressions and data source information are vectorized to obtain n+1 first vectors.
[0103] In the embodiment of the present invention, the step of determining the first target knowledge segment matching the first vector from a preset knowledge base may specifically include the following sub-steps:
[0104] Sub-step S21, for each first vector, according to the cosine similarity, determining from the preset knowledge base a second preset number of first candidate knowledge segments similar to the first vector, and the cosine similarities of the first candidate knowledge segments.
[0105] Exemplarily, for each first vector, according to the cosine similarity, (n+1)*m first candidate knowledge fragments are retrieved from the preset knowledge base, and the score cos_source of each first candidate knowledge fragment is obtained, wherein one first vector corresponds to m first candidate knowledge fragments, and the score cos_source is the cosine similarity. The second preset number may be m, which is not limited in the embodiment of the present invention.
[0106] Sub-step S22, determining the cosine similarity of the first candidate knowledge fragments for each of the first vectors, and the corrected first target cosine similarity.
[0107] Specifically, the retrieved (n+1)*m first candidate knowledge fragments are rearranged to determine the rearrangement score, that is, the modified first target cosine similarity. The rearrangement score calculation formula is as follows:
[0108]
[0109] Among them, cos_source is the cosine similarity, and x is the number of times the knowledge fragment is retrieved.
[0110] Sub-step S23, according to the first target cosine similarities of the first candidate knowledge fragments of the first vectors, sorting the first candidate knowledge fragments of the first vectors in descending order according to the first target cosine similarities.
[0111] Specifically, after obtaining the rearrangement scores corresponding to the (n+1)*m first candidate knowledge fragments, the (n+1)*m first candidate knowledge fragments are sorted in descending order according to the rearrangement scores.
[0112] Sub-step S24, selecting the second preset number of first candidate knowledge segments as the first target knowledge segments from the first candidate knowledge segments of the respective first vectors in the order.
[0113] Specifically, after sorting the (n+1)*m first candidate knowledge segments in descending order according to the rearrangement scores, a second preset number of first candidate knowledge segments are selected as first target knowledge segments in descending order.
[0114] In the embodiment of the present invention, step 104 may specifically include the following sub-steps:
[0115] Sub-step S31, obtaining a data source configuration prompt word template.
[0116] For example, the data source configuration prompt template may be: "You are an expert in the field of big data, and you have extensive knowledge of {db_type} data sources. Please output JSON structured data source configuration information according to the template based on the information provided below.\n\nJSON structured data source configuration information template is:\n{db_json_config_template}\n\nThe following is data source related information:\n{user_input_text}\n\nThe following is reference information:\n{reference_info}"
[0117] Among them: db_type is the data source type extracted from the answer of the large language model, db_json_config_template is the configuration information template of the data source type, input_user_text is the user's input content, that is, the data source information, reference_info is the reference data, including the first target knowledge fragment obtained by retrieving the preset knowledge base according to the user input content.
[0118] Sub-step S32, inputting the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the data source configuration prompt word template to obtain the data source configuration prompt word.
[0119] Specifically, the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data are embedded into the data source configuration prompt word template to obtain the data source configuration prompt word.
[0120] Sub-step S33, inputting the data source configuration prompt word into the large language model.
[0121] Specifically, the data source configuration prompt words are input into the large language model, and the large language model data outputs the target configuration information of the data source.
[0122] In an embodiment of the present invention, the method further includes:
[0123] If the connection to the data source fails, the reason for the failure to connect to the data source is obtained.
[0124] Specifically, you can call the data source verification tool to connect to the data source to verify whether the target configuration information of the JSON structure can connect to the data source. If the connection to the data source fails, the data source verification tool returns the verification result as failure and gives the reason for the failure. If the connection to the data source fails, get the reason for the failure returned by the data source verification tool.
[0125] The reasons are vectorized to obtain a second vector, and a second target knowledge segment matching the second vector is determined from the preset knowledge base.
[0126] Specifically, the failure reason is text-vectorized to obtain a second vector, and a second target knowledge segment matching the second vector is determined from a preset knowledge base in the same manner as the first target knowledge segment matching the first vector.
[0127] Exemplarily, multiple queries are performed on the large language model to determine a third preset number of approximate expressions of the failure cause; the approximate expressions and the failure cause are vectorized to obtain a second vector; then for each second vector, based on the cosine similarity, a fourth preset number of second candidate knowledge segments similar to the second vector and the cosine similarity of the second candidate knowledge segments are determined from a preset knowledge base; then the cosine similarity of the second candidate knowledge segments for each second vector and a corrected second target cosine similarity are determined; based on the second target cosine similarity of the second candidate knowledge segments of each second vector, the second candidate knowledge segments of each second vector are sorted in descending order according to the second target cosine similarity; finally, from the second candidate knowledge segments of each second vector, a fourth preset number of second candidate knowledge segments are selected as second target knowledge segments in order.
[0128] According to the second target knowledge fragment, it is determined whether configuration data needs to be supplemented.
[0129] Specifically, after determining the second target knowledge segment that matches the failure cause, determine whether additional configuration data is needed based on the second target knowledge segment, that is, determine whether the failure cause is due to the lack of configuration data necessary for connecting to the data source in the data source information input by the user.
[0130] If the configuration data needs to be supplemented, a second prompt message is sent to the user, where the second prompt message is used to instruct the user to supplement the configuration data.
[0131] Specifically, if it is determined that the configuration data needs to be supplemented, a second prompt message is sent to the user, and the second prompt message is used to instruct the user to supplement the required configuration data.
[0132] If supplementary configuration data is not needed, the second target knowledge fragment is added to the reference data.
[0133] Specifically, if no additional configuration data is needed, the second target knowledge fragment is added to the reference data, and step 104 is returned to, and steps 104-106 are executed again until the data source is successfully connected. If the number of cycles exceeds the preset threshold, the user creation failure is returned and a verification error message is provided. The preset threshold can be 5 times, and this is not limited in the embodiment of the present invention.
[0134] In the embodiment of the present invention, judging whether it is necessary to supplement configuration data according to the second target knowledge fragment includes:
[0135] Get the configuration information judgment prompt word template.
[0136] Exemplarily, the configuration information judgment prompt word template can be: "You are an expert in the big data field. An error occurred when using the following information to connect to the {db_type} data source. Is the error caused by the lack of necessary configuration information? Please return to "Yes, the following information needs to be supplemented:" or No: \n\nThe following is the connection configuration: \n{db_json_config}\n\nThe following is the connection error information: \n{error_msg}\n\nThe following is the reference material: \n{error_reference_info}".
[0137] Among them, db_type is the data source type, which is Hive in this example; db_json_config is the target configuration information of the JSON structure generated by the large language model; error_msg is the reason why the verification failed; error_reference_info is the second target knowledge fragment retrieved from the preset knowledge base based on the reason for the verification failure.
[0138] The prompt word template, the second target knowledge fragment, the reason and the target configuration information are determined according to the configuration information, and the large language model is queried to determine whether configuration data needs to be supplemented.
[0139] Exemplarily, the data source type, the second target knowledge fragment, the reason and the target configuration information are embedded in a configuration information judgment prompt word template to obtain the configuration information judgment prompt word, and the configuration information judgment prompt word is input into the large language model to obtain the information output by the large language model on whether the configuration data needs to be supplemented.
[0140] In an embodiment of the present invention, obtaining the data source information input by the user includes:
[0141] Obtain the demand information and demand judgment prompt word template entered by the user.
[0142] For example, the user can input the demand information through the front-end dialog box, and the demand judgment prompt word template can be: "Please judge whether the user wants to create a data source based on the following content, and give the type of data source the user wants to create. The answer content can only be "Yes, the data source type is:" or "No":\n\n{user_input_text}". Among them, {user_input_text} is the demand information entered by the user.
[0143] According to the judgment prompt word template and the large language model, it is judged whether the requirement information is a requirement for configuring a data source.
[0144] Exemplarily, the demand information input by the user is embedded in a demand judgment prompt word template to obtain the demand judgment prompt word, the demand judgment prompt word is input into the large language model, and it is obtained whether the demand information output by the large language model is information for configuring the data source demand.
[0145] If the requirement information is a requirement for configuring a data source, the requirement information is used as the data source information.
[0146] Exemplarily, if the large language model outputs "yes", it is determined that the requirement of the requirement information is to create a data source, and the requirement information is used as the data source information.
[0147] If the large language model outputs 2.1. "No", the prompt word template is called, for example: "You are an expert in the field of big data. Please answer according to the following content: \n\n{user_input_text}". Among them, {user_input_text} needs to be replaced with the user's input demand information. The large model is called according to the prompt words generated by the prompt word template, and the response content is directly returned to the user.
[0148] The embodiment of the present invention adopts a dialog mode to create a data source, making the data source configuration simpler and easier to use; a large language model is used to identify the state of a process node, thereby controlling the branching order of the execution of the process; by enhancing the index generation technology, knowledge fragments retrieved from a preset knowledge base are embedded in prompt words, so that the large language model automatically generates target configuration information of the data source. This method replaces the original program method of generating configurations based on non-data source types, improves versatility, and reduces user difficulty; a professional solution is retrieved based on data source connection error information, and then the solution is embedded in the prompt word, and the data source configuration error is corrected by the large language model, and automatic error correction is realized, thereby reducing the difficulty of error troubleshooting.
[0149] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0150] Reference Figure 3 , shows a structural block diagram of a data source configuration device according to an embodiment of the present invention, which may specifically include the following modules:
[0151] The data source information acquisition module 201 is used to acquire the data source information input by the user, wherein the data source information includes the type of the data source and the configuration data of the data source;
[0152] A first target knowledge fragment determining module 202 is used to perform vectorization according to the data source information to obtain a first vector, and determine a first target knowledge fragment matching the first vector from a preset knowledge base, wherein the preset knowledge base includes knowledge fragments from multiple data sources;
[0153] A reference data acquisition module 203, configured to acquire a configuration information template and reference data of the data source, wherein the reference data includes the first target knowledge fragment;
[0154] A target configuration information acquisition module 204, used to input the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the large language model, and acquire the target configuration information of the data source output by the large language model;
[0155] A data source connection module 205, configured to connect the data source according to the target configuration information of the data source;
[0156] The first prompt information sending module 206 is used to send a first prompt information to the user if the data source is successfully connected, wherein the first prompt information is used to indicate that the data source configuration is successful.
[0157] A data source configuration device according to an embodiment of the present invention obtains data source information input by a user, the data source information includes the type of data source and configuration data of the data source; vectorizes the data source information to obtain a first vector, and determines a first target knowledge fragment matching the first vector from a preset knowledge base, the preset knowledge base includes knowledge fragments of multiple data sources; obtains a data source configuration information template and reference data, the reference data includes the first target knowledge fragment; inputs the data source configuration information template, the type of data source, the data source configuration data and reference data into a large language model, and obtains the target configuration information of the data source output by the large language model; connects the data source according to the target configuration information of the data source; if the data source is successfully connected, sends a first prompt information to the user, the first prompt information is used to indicate that the data source configuration is successful. By obtaining the data source information input by the user, determining the target configuration information of the data source information according to the large language model, and then connecting the data source according to the target configuration information, the automatic configuration of the data source is realized, the user experience is improved, and there is no need to design and develop different configuration pages according to different data sources, reducing the development workload.
[0158] In an embodiment of the present invention, the first target knowledge segment determination module includes:
[0159] an approximate expression determination submodule, configured to perform multiple queries on the large language model to determine a first preset number of approximate expressions of the data source information;
[0160] The first vector determination submodule is used to vectorize the approximate expression and the data source information to obtain the first vector.
[0161] In an embodiment of the present invention, the first target knowledge segment determination module includes:
[0162] A first candidate knowledge segment determination submodule, configured to determine, for each first vector, a second preset number of first candidate knowledge segments similar to the first vector from the preset knowledge base according to the cosine similarity, and the cosine similarities of the first candidate knowledge segments;
[0163] A modified first target cosine similarity determination submodule, used to determine the cosine similarity of the first candidate knowledge fragments for each of the first vectors, and a modified first target cosine similarity;
[0164] A sorting submodule, configured to sort the first candidate knowledge fragments of each first vector in descending order according to the first target cosine similarity of the first candidate knowledge fragments of each first vector;
[0165] The first target knowledge segment determination submodule is configured to select, in the order, the second preset number of first candidate knowledge segments from the first candidate knowledge segments of the respective first vectors as the first target knowledge segments.
[0166] In an embodiment of the present invention, the target configuration information acquisition module includes:
[0167] The data source configuration prompt word template acquisition submodule is used to obtain the data source configuration prompt word template;
[0168] A data source configuration prompt word determination submodule, used to input the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the data source configuration prompt word template to obtain a data source configuration prompt word;
[0169] The data source configuration prompt word input submodule is used to input the data source configuration prompt word into the large language model.
[0170] In an embodiment of the present invention, the device further includes:
[0171] A reason acquisition module, used for acquiring the reason for the failure to connect to the data source if the connection to the data source fails;
[0172] A second target knowledge fragment determination module, used for vectorizing the cause to obtain a second vector, and determining a second target knowledge fragment matching the second vector from the preset knowledge base;
[0173] A supplementary configuration data judgment module, used to judge whether supplementary configuration data is needed according to the second target knowledge fragment;
[0174] A second prompt information sending module, used for sending second prompt information to the user if supplementary configuration data is required, wherein the second prompt information is used for instructing the user to supplement the configuration data;
[0175] The second target knowledge fragment adding module is used to add the second target knowledge fragment to the reference data if the supplementary configuration data is not needed.
[0176] In an embodiment of the present invention, the supplementary configuration data determination module includes:
[0177] A configuration information judgment prompt word template acquisition submodule is used to acquire a configuration information judgment prompt word template;
[0178] The supplementary configuration data judgment submodule is used to judge the prompt word template, the second target knowledge fragment, the reason and the target configuration information according to the configuration information, query the large language model, and judge whether the supplementary configuration data is needed.
[0179] In an embodiment of the present invention, the data source information acquisition module includes:
[0180] The demand information acquisition submodule is used to obtain the demand information and demand judgment prompt word template input by the user;
[0181] A demand information judgment submodule, used to judge whether the demand information is a data source configuration demand according to the judgment prompt word template and the large language model;
[0182] The data source information determination submodule is used to use the demand information as the data source information if the demand information is a demand for configuring a data source.
[0183] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0184] An embodiment of the present invention further provides an electronic device, including:
[0185] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned data source configuration method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0186] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned data source configuration method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0187] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0188] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0189] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0190] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0191] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0192] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0193] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0194] The above is a detailed introduction to the configuration method, device, electronic device and storage medium of a data source provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for configuring a data source, characterized in that: The method comprises: Acquire data source information input by a user, wherein the data source information includes a type of data source and configuration data of the data source; Vectorizing the data source information to obtain a first vector, and determining a first target knowledge fragment matching the first vector from a preset knowledge base, wherein the preset knowledge base includes knowledge fragments from multiple data sources; Acquire a configuration information template and reference data of the data source, wherein the reference data includes the first target knowledge fragment; Inputting the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the large language model, and obtaining the target configuration information of the data source output by the large language model; Connecting the data source according to the target configuration information of the data source; If the data source is connected successfully, a first prompt message is sent to the user, where the first prompt message is used to indicate that the data source is configured successfully.
2. The method according to claim 1, characterized in that: The vectorizing according to the data source information to obtain a first vector includes: Performing multiple queries on the large language model to determine a first preset number of approximate expressions of the data source information; The approximate expression and the data source information are vectorized to obtain the first vector.
3. The method according to claim 1, characterized in that The step of determining a first target knowledge segment matching the first vector from a preset knowledge base includes: For each first vector, according to the cosine similarity, determining from the preset knowledge base a second preset number of first candidate knowledge segments similar to the first vector, and the cosine similarities of the first candidate knowledge segments; Determine the cosine similarity of the first candidate knowledge fragments for each of the first vectors, and a modified first target cosine similarity; According to the first target cosine similarities of the first candidate knowledge fragments of the first vectors, the first candidate knowledge fragments of the first vectors are sorted in descending order according to the first target cosine similarities; In said order, the second preset number of first candidate knowledge segments are selected from the first candidate knowledge segments of the respective first vectors as the first target knowledge segments.
4. The method according to claim 1, characterized in that: The inputting of the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the large language model comprises: Get the data source configuration prompt word template; Inputting the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the data source configuration prompt word template to obtain the data source configuration prompt word; The data source configuration prompt words are input into the large language model.
5. The method according to claim 1, characterized in that: The method further comprises: If the connection to the data source fails, the reason for the failure to connect to the data source is obtained; Vectorizing the cause to obtain a second vector, and determining a second target knowledge segment matching the second vector from the preset knowledge base; determining whether additional configuration data is needed according to the second target knowledge fragment; If the configuration data needs to be supplemented, a second prompt message is sent to the user, where the second prompt message is used to instruct the user to supplement the configuration data; If supplementary configuration data is not needed, the second target knowledge fragment is added to the reference data.
6. The method according to claim 5, characterized in that The determining, according to the second target knowledge fragment, whether it is necessary to supplement configuration data includes: Get configuration information to judge the prompt word template; The prompt word template, the second target knowledge fragment, the reason and the target configuration information are determined according to the configuration information, and the large language model is queried to determine whether configuration data needs to be supplemented.
7. The method according to claim 1, characterized in that The step of obtaining the data source information input by the user includes: Obtain the demand information and demand judgment prompt word template input by the user; Determining whether the requirement information is a requirement for configuring a data source according to the judgment prompt word template and the large language model; If the requirement information is a requirement for configuring a data source, the requirement information is used as the data source information.
8. A data source configuration device, characterized in that: The device comprises: A data source information acquisition module, used to acquire data source information input by a user, wherein the data source information includes the type of data source and configuration data of the data source; A first target knowledge fragment determination module is used to perform vectorization according to the data source information to obtain a first vector, and determine a first target knowledge fragment matching the first vector from a preset knowledge base, wherein the preset knowledge base includes knowledge fragments from multiple data sources; A reference data acquisition module, used to acquire a configuration information template and reference data of the data source, wherein the reference data includes the first target knowledge fragment; a target configuration information acquisition module, used to input the configuration information template of the data source, the type of the data source, the configuration data of the data source and the reference data into the large language model, and acquire the target configuration information of the data source output by the large language model; A data source connection module, used to connect the data source according to the target configuration information of the data source; The first prompt information sending module is used to send a first prompt information to the user if the data source is successfully connected, wherein the first prompt information is used to indicate that the data source is successfully configured.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the method for configuring a data source according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for configuring a data source according to any one of claims 1 to 7 are implemented.