CN-122019688-A - Method, device and equipment for converting natural language into data service call instruction
Abstract
The invention provides a method, a device and equipment for converting natural language into a data service call instruction, and belongs to the field of artificial intelligence. The method comprises the steps of obtaining a target data query request under a target scene, inputting the target data query request into a conversion model to obtain a target service calling instruction output by the conversion model, wherein the target service calling instruction comprises a target application programming interface API and target API parameters, the conversion model is generated based on a target large model supporting the data query service under the target scene and a target corpus corresponding to the target scene, and the target API parameters are used for obtaining a query result of the target data query request. Therefore, the dependence on a high-parameter general large model can be eliminated, the accuracy of conversion from natural language to API and API parameters is improved, the adaptive capacity to the target scene data query requirement is enhanced, and therefore accurate query results are obtained efficiently.
Inventors
- YANG DAN
- LI JUNYAN
- ZHU YIWU
- ZOU MINGHUA
- YU HEJIN
- ZHOU KANG
- LIU JIANPING
- WANG PINGXI
- MA SIWEI
- ZHOU ZHENWEI
- Shen Liuxin
- WANG HUANHUAN
Assignees
- 朗新科技集团股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260410
Claims (10)
- 1. A method for converting natural language into data service call instructions, comprising: acquiring a target data query request under a target scene; Inputting the target data query request into a conversion model to obtain a target service call instruction output by the conversion model, wherein the target service call instruction comprises a target Application Programming Interface (API) and target API parameters, the conversion model is generated based on a target large model supporting the data query service under the target scene and a target corpus corresponding to the target scene, and the target API parameters are used for acquiring a query result of the target data query request.
- 2. The method of claim 1, wherein the transformation model is generated based on: Acquiring a target large model supporting the data query service in the target scene; Acquiring a target corpus corresponding to the target scene; Inputting the target corpus in the target corpus into the target large model, and transferring the natural language data service capacity of the target large model to a base model through knowledge distillation to obtain a reference model; and fine tuning the reference model according to the target corpus to obtain the conversion model.
- 3. The method according to claim 2, wherein the obtaining the target corpus corresponding to the target scene includes: Determining a proprietary data type of the target scene; acquiring a special vocabulary corpus corresponding to the special data type; Acquiring a question-answer data set corresponding to a data query request in the target scene, wherein the question-answer data set comprises a plurality of initial question-answer pairs; performing problem disassembly on the data query requests in the middle target scene of the plurality of initial question answers to obtain a problem disassembly corpus; Acquiring APIs and API parameter corpus selected by a data query request in the target scene according to the plurality of initial question-answer pairs; obtaining a plurality of reference question-answer pairs according to the question-dismantling corpus and the API and API parameter corpus; and generating the target corpus according to the special vocabulary corpus and the plurality of reference question-answer pairs.
- 4. A method according to claim 3, wherein said fine-tuning the reference model according to the target corpus to obtain the conversion model comprises: Obtaining a reference question and answer pair generated in the knowledge distillation process; Checking the reference question-answer pair to obtain a target question-answer pair; And fine-tuning the reference model according to the special vocabulary corpus and the target question-answer pair in the target corpus to obtain the conversion model.
- 5. The method according to claim 2, wherein said fine-tuning the reference model according to the target corpus to obtain the conversion model comprises: fine tuning the reference model according to the target corpus to obtain a target model; and converting floating point parameters in the target model into integer representation to obtain a conversion model.
- 6. The method according to any one of claims 2-5, further comprising: constructing an intermediate layer supporting a plurality of query types, wherein the query types are used for indicating data types for requesting query in the target scene; acquiring a technical term corresponding to each preset type operation; writing the technical term into the middle layer, wherein the middle layer is used for assisting in determining the target API and the target API parameters.
- 7. An apparatus for converting natural language into data service call instructions, comprising: the acquisition unit is used for acquiring a target data query request in a target scene; The input unit is used for inputting the target data query request into a conversion model to obtain a target service call instruction output by the conversion model, wherein the target service call instruction comprises a target application programming interface API and target API parameters, the conversion model is generated based on a target large model supporting the data query service under the target scene and a target corpus corresponding to the target scene, and the target API parameters are used for obtaining a query result of the target data query request.
- 8. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the method of natural language to data service call instructions of any one of claims 1 to 6 when the computer program is executed.
- 9. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the method of natural language to data service call instructions of any one of claims 1 to 6.
- 10. A computer program product comprising a computer program which when executed by a processor implements a method of converting natural language into data service call instructions as claimed in any one of claims 1 to 6.
Description
Method, device and equipment for converting natural language into data service call instruction Technical Field The application belongs to the field of artificial intelligence, and particularly relates to a method, a device and equipment for converting natural language into a data service call instruction. Background When intelligent data is queried, the intelligent query system becomes an important tool for a user to quickly acquire service data, and the core of the intelligent query system is to realize conversion from a natural language query instruction to a data service call instruction, so that the requirement that the user can acquire index data without mastering a professional query grammar is met. At present, the conventional technical scheme aiming at the requirement in the industry relies on a large language model with high parameter scale, and related conversion is completed by assembling function call prompt words and adopting a feedback interaction mode. The method comprises the steps of firstly, transmitting a natural language counting request of a user into a large model, autonomously matching a callable data interface by the model, initiating interface call, observing a call result, and finally feeding back an integrated result to the user. But such solutions present obvious technical shortboards. On one hand, the high-parameter large model has strict requirements on hardware computing power, has extremely high deployment and operation and maintenance costs, and is difficult to apply in a resource-limited scene. On the other hand, in the face of irregular complex counting requests such as multiple units, multiple time periods, multiple dimensions and the like, the matching accuracy of a large model to a data interface and interface parameters is insufficient, the user requirements cannot be accurately disassembled, corresponding calling instructions are generated, and the accuracy of counting results is difficult to guarantee. Meanwhile, the interface matching logic of the large model is deeply coupled with the feedback interaction flow, the accurate output of interfaces and parameters cannot be independently completed, the whole flow is redundant and poor in flexibility, the service efficiency and the application range of the intelligent query system are severely restricted, and a plurality of inconveniences are brought to daily data query of a user. Disclosure of Invention The application provides a method, a device and equipment for converting natural language into a data service call instruction, which are used for getting rid of dependence on a high-parameter general large model, improving the accuracy of conversion from natural language to an application programming interface (Application Programming Interface, API) and API parameters, enhancing the adaptation capability to the target scene data query requirement, and further efficiently obtaining an accurate query result. The application provides a method for converting natural language into a data service call instruction, which comprises the following steps: acquiring a target data query request under a target scene; Inputting the target data query request into a conversion model to obtain a target service call instruction output by the conversion model, wherein the target service call instruction comprises a target Application Programming Interface (API) and target API parameters, the conversion model is generated based on a target large model supporting the data query service under the target scene and a target corpus corresponding to the target scene, and the target API parameters are used for acquiring a query result of the target data query request. The method for converting the natural language into the data service calling instruction comprises the steps of obtaining a target large model supporting data query service in a target scene, obtaining a target corpus corresponding to the target scene, inputting the target corpus in the target corpus into the target large model, transferring the natural language data service capability of the target large model to a base model through knowledge distillation to obtain a reference model, and fine-tuning the reference model according to the target corpus to obtain the conversion model. The method for acquiring the target corpus corresponding to the target scene comprises the steps of determining a special data type of the target scene, acquiring a special vocabulary corpus corresponding to the special data type, acquiring a question-answer data set corresponding to a data query request in the target scene, wherein the question-answer data set comprises a plurality of initial question-answer pairs, performing question disassembly on the data query request in the target scene in the plurality of initial question-answer pairs to obtain question-disassembly corpus, acquiring an API and an API parameter corpus selected by the data query request in the target scene according to the pluralit