Calling method and device of generative pre-training GPT model and storage medium

By using historical storage in the generative pre-trained GPT model for multi-dimensional search, the problem of inefficient model usage is solved and more efficient information response is achieved.

CN120256547APending Publication Date: 2025-07-04QINGDAO HAIER TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311852046.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

Generative pre-trained GPT models are less efficient in use, resulting in an increase in model interaction time.

Method used

By receiving the target call request, the historical query information and result data stored in the historical storage are used to search for the target query information according to multiple information dimensions, and the corresponding historical result data is extracted under the target information dimension to reduce direct interaction with the model.

Benefits of technology

It improves the efficiency of the use of generative pre-trained GPT model, reduces the number of model interactions, and improves the response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256547A_ABST
    Figure CN120256547A_ABST
Patent Text Reader

Abstract

The invention discloses a calling method and device of a generative pre-training GPT model and a storage medium, and relates to the technical field of smart home, the method comprises the following steps: receiving a target calling request, the target calling request being used for requesting to call the generative pre-training GPT model to query target query information; the target calling request is responded, target query information is searched from historical storage according to multiple information dimensions, and the historical storage is used for storing historical query information and historical result data which have the corresponding relation; and under the condition that the target query information is searched according to the target information dimension, extracting historical result data corresponding to the target query information under the target information dimension from historical storage as result data of the target query information. According to the method and the device, the problem that the use efficiency of the generative pre-training GPT model is relatively low is solved, and the effect of improving the use efficiency of the generative pre-training GPT model is further achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of smart homes. Specifically, it relates to a method, device, and storage medium for invoking a Generative Pre-trained Transformer (GPT) model. Background Art

[0002] With the release of GPT (Generative Pre-Trained Transformer), large models have become a research hotspot in the current field of AI (Artificial Intelligence). The more powerful the model, the larger the number of model parameters. As the number of model parameters increases, the interaction duration of the model also grows, resulting in a decrease in the interaction efficiency of the model.

[0003] Regarding the problem of the low usage efficiency of the Generative Pre-trained GPT model in related technologies, no effective solution has been proposed yet. Summary of the Invention

[0004] Embodiments of the present invention provide a method, device, and storage medium for invoking a Generative Pre-trained GPT model to at least solve the problem of the low usage efficiency of the Generative Pre-trained GPT model.

[0005] According to one aspect of the embodiments of the present invention, a method for invoking a Generative Pre-trained GPT model is provided, including:

[0006] Receiving a target invocation request, where the target invocation request is used to request to invoke the Generative Pre-trained GPT model to query target query information;

[0007] Responding to the target invocation request, searching for the target query information from historical storage according to multiple information dimensions, where the historical storage is used to store historical query information and historical result data with a corresponding relationship, and the historical result data is the data output by the Generative Pre-trained GPT model obtained by invoking the Generative Pre-trained GPT model to query the corresponding historical query information, and the multiple information dimensions are used to indicate various representation methods of query information;

[0008] When the target query information is found by searching according to the target information dimension, extracting the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information.

[0009] In an exemplary embodiment, searching for the target query information from the historical storage according to multiple information dimensions includes: searching for the target query information from the historical storage according to a first dimension, where the first dimension is a search dimension with complete hits; in the case where the target query information is not found by searching according to the first dimension, searching for the target query information from the historical storage according to a second dimension, where the second dimension is a search dimension with information parameter matching, and the multiple information dimensions include the first dimension and the second dimension.

[0010] In an exemplary embodiment, searching for the target query information from the historical storage according to the first dimension includes: constructing a first search instruction for the first dimension, where the first search instruction is used to indicate searching for search results that completely hit the target query information; executing the first search instruction in the historical storage to obtain a first search result of the first search instruction; in the case where the target query information is not found by searching according to the first dimension, searching for the target query information from the historical storage according to the second dimension includes: in the case where the first search result indicates that the target query information is not found, constructing a second search instruction for the second dimension, where the second search instruction is used to indicate searching for search results that match the information parameters of the target query information; executing the second search instruction in the historical storage to obtain a second search result of the second search instruction.

[0011] In an exemplary embodiment, executing the first search instruction in the historical storage to obtain a first search result of the first search instruction includes: executing the first search instruction in a first database using the target query information as a target key, where the historical storage includes the first database, and the first database stores historical query information and historical result data with a corresponding relationship in the form of key-value pairs, with historical query information as the key and historical result data as the value; obtaining the first search result returned by the first database in response to the first search instruction; in the case where the first search result indicates that the target key is found, determining the first dimension as the target information dimension.

[0012] In an exemplary embodiment, the second search instruction for constructing the second dimension includes: constructing a search instruction for a first sub-dimension corresponding to the target query information, where the search instruction for the first sub-dimension is used to indicate searching for query information with a similarity higher than a first threshold to the target query information; in the case where the search result corresponding to the search instruction for the first sub-dimension indicates that the target query information is not found, constructing a search instruction for a second sub-dimension corresponding to the target query information, where the search instruction for the second sub-dimension is used to indicate searching for information vectors with a similarity higher than a second threshold to the target information vector of the target query information.

[0013] In an exemplary embodiment, the executing the second search instruction in the historical storage to obtain a second search result of the second search instruction includes: executing the search instruction for the first sub-dimension in a second database, where the historical storage includes the second database, and the second database stores historical query information; obtaining a first sub-result returned by the second database in response to the search instruction for the first sub-dimension; in the case where the first sub-result indicates that reference query information with a similarity higher than the first threshold to the target query information is found, determining the first sub-dimension as the target information dimension; in the case where the first sub-result indicates that no query information with a similarity higher than the first threshold to the target query information is found, executing the search instruction for the second sub-dimension in the second database, where the second database also stores historical information vectors and historical query information with a corresponding relationship; obtaining a second sub-result returned by the second database in response to the search instruction for the second sub-dimension; in the case where the second sub-result indicates that a reference information vector with a similarity higher than the second threshold to the target information vector is found, determining the second sub-dimension as the target information dimension.

[0014] In an exemplary embodiment, when the target query information is searched according to the target information dimension, extracting the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information includes: when the target information dimension is the first sub-dimension, extracting the historical result data corresponding to the reference query information from the first database as the result data of the target query information, where the historical storage includes the first database, and the first database stores the historical query information and the historical result data with a corresponding relationship in the form of key-value pairs with the historical query information as the key and the historical result data as the value; when the target information dimension is the second sub-dimension, extracting the candidate query information corresponding to the reference information vector from the second database; extracting the historical result data corresponding to the candidate query information from the first database as the result data of the target query information, where the historical storage includes the first database, and the first database stores the historical query information and the historical result data with a corresponding relationship in the form of key-value pairs with the historical query information as the key and the historical result data as the value.

[0015] In an exemplary embodiment, searching the target query information from the historical storage according to multiple information dimensions includes: detecting the target channel identifier corresponding to the target call request; fusing the target query information with the target channel identifier into target query data; searching the target query data from the historical query data and the historical result data with a corresponding relationship stored in the historical storage according to the multiple information dimensions, where the historical query data is obtained by fusing the historical query information with the corresponding channel identifier.

[0016] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the above-mentioned calling method of the generative pre-trained GPT model when running.

[0017] According to still another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the above-mentioned processor executes the above-mentioned calling method of the generative pre-trained GPT model through the computer program.

[0018] Through this application, a target call request is received, where the target call request is used to request to call the generative pre-trained GPT model to query target query information; in response to the target call request, the target query information is searched from the historical storage according to multiple information dimensions, where the historical storage is used to store historical query information and historical result data with a corresponding relationship, the historical result data is the data output by the generative pre-trained GPT model obtained by querying the corresponding historical query information, and the multiple information dimensions are used to indicate various representation methods of the query information; in the case where the target query information is searched according to the target information dimension, the historical result data corresponding to the target query information in the target information dimension is extracted from the historical storage as the result data of the target query information. Since the data output by the generative pre-trained GPT model obtained by storing historical query information is stored in the historical storage, when the target call request is received, it is possible to first check in the historical storage whether there is result data that can reply to the current target query information, reducing the interaction with the model and solving the problem of low usage efficiency of the generative pre-trained GPT model. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application and, together with the specification, are used to explain the principles of the present application.

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0021] Figure 1 is a schematic diagram of the hardware environment of a method for calling a generative pre-trained GPT model according to an embodiment of the present application;

[0022] Figure 2 is a flowchart of a method for calling a generative pre-trained GPT model according to an embodiment of the present invention;

[0023] Figure 3 is a schematic diagram of a method for searching for target query information according to multiple information dimensions according to an embodiment of the present application;

[0024] Figure 4 is a flowchart of a process for searching for target query information in historical storage according to an embodiment of the present application;

[0025] Figure 5 is a block diagram of the structure of a device for calling a generative pre-trained GPT model according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0026] To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.

[0027] It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0028] According to one aspect of the embodiments of this application, a method for invoking a generative pre-trained GPT model is provided. The method for invoking the generative pre-trained GPT model is widely applied to whole-house intelligent digital control application scenarios such as Smart Home, smart home, smart home appliance ecosystem, IntelligenceHouse ecosystem, etc. Optionally, in this embodiment, the method for invoking the generative pre-trained GPT model can be applied to, for example Figure 1 the hardware environment composed of a terminal device 102 and a server 104 as shown. As Figure 1 shown, the server 104 is connected to the terminal device 102 through a network, and can be used to provide services (such as application services, etc.) for the terminal or the client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data operation services for the server 104.

[0029] The above network may include, but is not limited to, at least one of the following: a wired network, a wireless network. The above wired network may include, but is not limited to, at least one of the following: a wide area network, a metropolitan area network, a local area network. The above wireless network may include, but is not limited to, at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart drying rack, a smart curtain, smart audio and video, a smart socket, a smart speaker, a smart sound box, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart floor sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steam box, a smart microwave oven, a smart kitchen water heater, a smart purifier, a smart water dispenser, a smart door lock, etc.

[0030] To solve the above problems, in this embodiment, a method for invoking a generative pre-trained GPT model is provided, including but not limited to being applied in a gateway. Figure 2 FIG. is a flowchart of a method for invoking a generative pre-trained GPT model according to an embodiment of the present invention. The process includes the following steps:

[0031] Step S202, receiving a target invocation request, where the target invocation request is used to request to invoke the generative pre-trained GPT model to query target query information.

[0032] Step S204, in response to the target invocation request, searching for the target query information from the historical storage according to multiple information dimensions, where the historical storage is used to store historical query information and historical result data with a corresponding relationship, the historical result data is the data output by the generative pre-trained GPT model obtained by invoking the generative pre-trained GPT model to query the corresponding historical query information, and the multiple information dimensions are used to indicate various representation methods of the query information.

[0033] Step S206, in the case where the target query information is found by searching according to the target information dimension, extracting the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information.

[0034] Through the above steps, a target call request is received, where the target call request is used to request to call the generative pre-trained GPT model to query target query information; in response to the target call request, the target query information is searched from the historical storage according to multiple information dimensions, where the historical storage is used to store historical query information and historical result data with a corresponding relationship, and the historical result data is the data output by the generative pre-trained GPT model obtained by calling the generative pre-trained GPT model to query the corresponding historical query information, and the multiple information dimensions are used to indicate various representation methods of the query information; in the case where the target query information is searched according to the target information dimension, the historical result data corresponding to the target query information in the target information dimension is extracted from the historical storage as the result data of the target query information. Since the data output by the generative pre-trained GPT model obtained by storing the historical query information is stored in the historical storage, in the case where the target call request is received, it is possible to first check in the historical storage whether there is result data that can reply to the current target query information, reducing the interaction with the model and solving the problem of low usage efficiency of the generative pre-trained GPT model.

[0035] In the technical solution provided in step S202 above, it is possible but not limited to calling the generative pre-trained GPT model in response to the target call request, and it is possible but not limited to triggering the target call request according to an instruction issued by the user. For example: in the case where a voice message sent by the user indicating the query of the target query information is received, the target call request is triggered to call the generative pre-trained GPT model to respond to the voice message; in the case where text information input by the user indicating the query of the target query information is received, the target call request is triggered to call the generative pre-trained GPT model to respond to the text information, etc. Alternatively, the target call request can also be issued by an electronic device capable of requesting to call the generative pre-trained GPT model.

[0036] Optionally, in this embodiment, the generative pre-trained GPT model can be but is not limited to a model trained using artificial intelligence technology and having the function of accepting questions and giving answers. For example: Chat GPT (Chat Generative Pre-trained Transformer, generative pre-trained dialogue conversion model). Chat GPT is a deep learning model for text generation trained based on available data on the Internet. Chat GPT is a natural language processing tool driven by artificial intelligence technology. It can conduct conversations by understanding and learning human language and can also interact according to the context.

[0037] Optionally, in this embodiment, the generative pre-trained GPT model can be but is not limited to being used to respond to the target call request and return the result data of the target query information.

[0038] In the technical solution provided in step S204 above, the historical storage is used to store historical query information and historical result data with a corresponding relationship. The historical storage can be, but is not limited to, a database with a storage function, such as: a key-value storage database, a column storage database, a document database, a graph database, etc.

[0039] Optionally, in this embodiment, during the historical process, the historical query information can be, but is not limited to, input into the generative pre-trained GPT model to obtain the historical result data output by the generative pre-trained GPT model, and the corresponding relationship between the historical query information and the historical result data is established and stored in the historical storage.

[0040] Optionally, in this embodiment, the generative pre-trained GPT model can be, but is not limited to, used to respond to a call request and return the result data of the query information. Further, in the case where the historical storage stores the result data of the generative pre-trained GPT model in the historical conversation, the result data corresponding to the target query information can be, but is not limited to, searched from the historical storage to respond to the target call request.

[0041] Optionally, in this embodiment, information of the same query information in different information dimensions can be, but is not limited to, stored in the historical storage. The information dimensions can be, but are not limited to, including: vectors, images, symbols, etc. In other words, taking the query information as text information as an example, the query information can be, but is not limited to, converted into different forms of information and stored in the historical storage, such as: storing the text information using vectors in the historical storage, storing the text information using images in the historical storage, storing the text information using symbols in the historical storage, etc.

[0042] In an exemplary embodiment, the following method can be, but is not limited to, adopted to search for the target query information from the historical storage according to multiple information dimensions: searching for the target query information from the historical storage according to the first dimension, where the first dimension is the search dimension with complete hit; in the case where the target query information is not searched according to the first dimension, searching for the target query information from the historical storage according to the second dimension, where the second dimension is the search dimension with information parameter matching, and the multiple information dimensions include the first dimension and the second dimension.

[0043] Optionally, in this embodiment, the historical storage can be, but is not limited to, storing the target query information, or the historical result data that can respond to the target query information. It can be, but is not limited to, directly searching for the target query information with complete hit, or the historical query information relevant to the target query information in the historical storage, and using the relevant historical query information to respond to the target query information.

[0044] Optionally, in this embodiment, the above first dimension may but is not limited to searching for the target query information in the historical storage. If the target query information is found in the historical storage, it is considered that the target query information is fully hit.

[0045] Optionally, in this embodiment, the above second dimension may but is not limited to searching for historical query information similar to the target query information in the historical storage. If similar historical query information is found, it is considered that the information parameters match. It may but is not limited to calculating the similarity between the target query information and each historical query information in the historical storage. If the similarity between the historical query information and the target query information is greater than the threshold, it is considered that the information parameters of the historical query information and the target query information match.

[0046] In an exemplary embodiment, the following method may but is not limited to be used to search for the target query information from the historical storage according to the first dimension: constructing a first search instruction for the first dimension, where the first search instruction is used to indicate searching for search results that fully hit the target query information; executing the first search instruction in the historical storage to obtain the first search result of the first search instruction. The following method may but is not limited to be used to search for the target query information from the historical storage according to the second dimension when the target query information is not found according to the first dimension: when the first search result is used to indicate that the target query information is not found, constructing a second search instruction for the second dimension, where the second search instruction is used to indicate searching for search results whose information parameters match the target query information; executing the second search instruction in the historical storage to obtain the second search result of the second search instruction.

[0047] Optionally, in this embodiment, a first search instruction may but is not limited to be constructed, and the first search instruction is used to search for the target query information that is fully hit in the first dimension from the historical storage. For example, taking the first dimension as the text form, searching for the target query information stored in text form in the historical storage. The above full hit may but is not limited to indicating that the query information stored in the historical storage is exactly the same as the target query information requested by the target call request. Or, it is used to indicate that the query information stored in the historical storage has the same meaning as the target query information requested by the target call request.

[0048] Optionally, in this embodiment, the first search result is used to indicate whether the target query information that is fully hit is obtained from the historical storage. For example, the target query information that is fully hit is obtained from the historical storage. Or, the target query information that is fully hit is not found from the historical storage.

[0049] Optionally, in this embodiment, when the first search result indicates that the target query information is found, the first dimension is determined as the target information dimension, and the historical result data corresponding to the target query information in the target information dimension is extracted from the historical storage as the result data of the target query information.

[0050] Optionally, in this embodiment, when the first search result indicates that the target query information is not found, a second search instruction for the second dimension corresponding to the target query information is constructed, and the second search instruction is used to search in the historical storage for search results that match the information parameters of the target query information in the second dimension. The above information parameter matching may, but is not limited to, be used to indicate that the target query information obtained by the search has a certain correlation with the query information requested by the target call request.

[0051] Optionally, in this embodiment, the second dimension may, but is not limited to, be different from the first dimension. For example, if the first search instruction is to search in the historical storage for the target query information with exactly the same text, and the second search instruction is to use vector search in the historical storage for the target query information with a certain correlation.

[0052] In an exemplary embodiment, the first search instruction may, but is not limited to, be executed in the historical storage in the following manner to obtain the first search result of the first search instruction: The target query information is used as the target key to execute the first search instruction in the first database, where the historical storage includes the first database, and the first database stores historical query information and historical result data with a corresponding relationship in the form of key-value pairs, with the historical query information as the key and the historical result data as the value; the first search result returned by the first database in response to the first search instruction is obtained; when the first search result is used to indicate that the target key is found, the first dimension is determined as the target information dimension.

[0053] Optionally, in this embodiment, the historical storage may, but is not limited to, include one or more databases, and each database may, but is not limited to, have its corresponding storage method. A non-relational database in the (key, value) format may be used as the first database, such as Redis, Voldemort, Riak, etc.

[0054] Optionally, in this embodiment, the first database is a database that stores historical query information and historical result data with a corresponding relationship in the form of key-value pairs, with the historical query information as the key and the historical result data as the value. For example, the historical query information is the key key, and the historical result data is the value value, and the historical query information key and the historical result data value with a corresponding relationship are stored in the form of the key-value pair (key, value).

[0055] Optionally, in this embodiment, using the target query information as the target key, it is possible but not limited to search for the target query information from all the keys included in the first database. When the target query information is stored in the first database, the first database responds to the first search instruction and returns a first search result indicating that the target key has been found. Alternatively, the first database responds to the first search instruction and returns a first search result indicating that the target key has not been found.

[0056] In an exemplary embodiment, the second search instruction for the second dimension can be constructed in the following manner but is not limited thereto: constructing a search instruction for the first sub-dimension corresponding to the target query information, where the search instruction for the first sub-dimension is used to indicate searching for query information with a similarity higher than the first threshold to the target query information; when the search result corresponding to the search instruction for the first sub-dimension indicates that the target query information has not been found, constructing a search instruction for the second sub-dimension corresponding to the target query information, where the search instruction for the second sub-dimension is used to indicate searching for information vectors with a similarity higher than the second threshold to the target information vector of the target query information.

[0057] Optionally, in this embodiment, when the first database responds to the first search instruction and returns a first search result indicating that the target key has not been found, a second search instruction for the second dimension is constructed. Constructing the second search instruction for the second dimension can include but is not limited to: constructing a search instruction for the first sub-dimension corresponding to the target query information; when the search result corresponding to the search instruction for the first sub-dimension indicates that the target query information has not been found, constructing a search instruction for the second sub-dimension corresponding to the target query information.

[0058] Optionally, in this embodiment, the query process in the second dimension can include but is not limited to the query process in the first sub-dimension and the query process in the second sub-dimension. The query process in the first sub-dimension includes searching for query information with a similarity higher than the first threshold to the target query information, and the query process in the second sub-dimension includes indicating searching for information vectors with a similarity higher than the second threshold to the target information vector of the target query information.

[0059] Optionally, in this embodiment, the first threshold can be but is not limited to a preset fixed value or a variable value that can adaptively change. The second threshold can be but is not limited to a preset fixed value or a variable value that can adaptively change.

[0060] In an exemplary embodiment, the second search instruction may be executed in the historical storage in the following manner, but not limited thereto, to obtain a second search result of the second search instruction: execute the search instruction of the first sub-dimension in the second database, where the historical storage includes the second database, and historical query information is stored in the second database; obtain a first sub-result returned by the second database in response to the search instruction of the first sub-dimension; in the case where the first sub-result is used to indicate that reference query information with a similarity higher than the first threshold to the target query information is found, determine the first sub-dimension as the target information dimension; in the case where the first sub-result is used to indicate that no query information with a similarity higher than the first threshold to the target query information is found, execute the search instruction of the second sub-dimension in the second database, where historical information vectors and historical query information with a corresponding relationship are also stored in the second database; obtain a second sub-result returned by the second database in response to the search instruction of the second sub-dimension; in the case where the second sub-result is used to indicate that a reference information vector with a similarity higher than the second threshold to the target information vector is found, determine the second sub-dimension as the target information dimension.

[0061] Optionally, in this embodiment, the historical storage may include, but not be limited to, a first database and a second database. The second database may be, but not limited to, a doc (file)-type non-relational search database, such as: MongoDB, CouchDB, ElasticSearch, etc. The second database may store historical query information in a key-based manner, such as: doc{key:query,……}, where key is used to indicate historical query information.

[0062] Optionally, in this embodiment, SimBert may be used, but not limited to, to calculate the similarity between the target query information and the historical query information in the second database.

[0063] Optionally, in this embodiment, when executing the search instruction of the first sub-dimension in the second database, the first sub-result may be obtained by, but not limited to, finding historical query information with a similarity higher than the first threshold to the target query information from the second database.

[0064] Optionally, in this embodiment, when the first sub-result indicates that no query information with a similarity higher than the first threshold to the target query information is found, a search instruction for the second sub-dimension is executed in the second database. The second database can also but is not limited to storing historical information vectors and historical query information with corresponding relationships, and can but is not limited to converting the target query information into a corresponding vector and calculating the distance from the historical information vectors, so as to determine whether the similarity between the historical query information corresponding to the historical information vector and the target query information is higher than the second threshold. When the second sub-result is used to indicate that a reference information vector with a similarity higher than the second threshold to the target information vector is found, the second sub-dimension is determined as the target information dimension.

[0065] In an exemplary embodiment, when the target query information is searched according to the target information dimension, the historical result data corresponding to the target query information in the target information dimension can be extracted from the historical storage as the result data of the target query information in the following way but is not limited to this: when the target information dimension is the first sub-dimension, the historical result data corresponding to the reference query information is extracted from the first database as the result data of the target query information, where the historical storage includes the first database, and the first database stores historical query information and historical result data with corresponding relationships in the form of key-value pairs with the historical query information as the key and the historical result data as the value; when the target information dimension is the second sub-dimension, the candidate query information corresponding to the reference information vector is extracted from the second database; and the historical result data corresponding to the candidate query information is extracted from the first database as the result data of the target query information, where the historical storage includes the first database, and the first database stores historical query information and historical result data with corresponding relationships in the form of key-value pairs with the historical query information as the key and the historical result data as the value.

[0066] Optionally, in this embodiment, when the target information dimension is the first sub-dimension, the historical result data corresponding to the reference query information is extracted from the first database as the result data of the target query information; or when the target information dimension is the second sub-dimension, the candidate query information corresponding to the reference information vector is extracted from the second database; and the historical result data corresponding to the candidate query information is extracted from the first database as the result data of the target query information.

[0067] In an exemplary embodiment, an example of a method for searching for target query information according to multiple information dimensions is provided. Figure 3 It is a schematic diagram of a method for searching for target query information according to multiple information dimensions according to an embodiment of the present application, as Figure 3As shown, taking the first database as redis and the second database as Elasticsearch, and taking the target call request to request to call the generative pre-trained GPT model to query "What's the English translation of How's the weather today" as an example, it is possible but not limited to respond to the target call request and search for the target query information according to multiple information dimensions as follows:

[0068] Query whether there is historical query information of "What's the English translation of How's the weather today" in the key of the redis database. If the target key "What's the English translation of How's the weather today" is included in the redis database, extract the target value (historical result data) corresponding to the target key, "What's the English translation of How's the weather today is How is the weather today", as the result data of the target query information.

[0069] If the target key is not included in the redis database, calculate the similarity between each key in the Elasticsearch database and "What's the English translation of How's the weather today", obtain the reference query information "What's the English for How's the weather today" with a similarity higher than the first threshold, and extract the historical result data corresponding to the reference query information in the redis database as the result data of the target query information, "What's the English translation of How's the weather today is How is the weather today".

[0070] If there is no reference query information in the Elasticsearch database with a similarity higher than the first threshold to "What's the English translation of How's the weather today", calculate the vector value of "What's the English translation of How's the weather today", and calculate the distance between it and the historical information vectors stored in the Elasticsearch database to obtain the information vectors with a similarity higher than the second threshold of the target information vector of the target query information. Take the historical query information corresponding to the information vectors as the target query information, and obtain the historical result data corresponding to the target query information from the redis database as the result data of the target query information.

[0071] In the technical solution provided in step S206 above, when the target query information is searched, it is possible but not limited to extract the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information.

[0072] In an exemplary embodiment, the target query information may be searched from the historical storage according to multiple information dimensions in the following ways, but not limited thereto: detecting the target channel identifier corresponding to the target call request; fusing the target query information with the target channel identifier into target query data; searching for the target query data from the historical query data and historical result data stored in the historical storage and having a corresponding relationship according to the multiple information dimensions, where the historical query data is obtained by fusing the historical query information with the corresponding channel identifier.

[0073] Optionally, in this embodiment, the target channel identifier may be marked for the target query information, but not limited thereto. The target channel identifier may be, but not limited to, the identification information indicating the target query information, and may include, but not limited to: user information, time information, location information, scenario information, etc.

[0074] Optionally, in this embodiment, fusing the target query information with the target channel identifier into target query data may include, but not limited to: splicing the target query information and the target channel identifier into target query data. Or, carrying the target channel identifier on the target query information to obtain the target query data.

[0075] In an exemplary embodiment, an example of a process for searching target query information in a historical storage is provided. Figure 4 It is a flowchart of a process for searching target query information in a historical storage according to an embodiment of the present application, as Figure 4 shown. Taking the query of the target query information Query and the target channel identifier as Channel as an example, the target query information may be searched from the historical storage through the following process, but not limited thereto:

[0076] Step S402: Fusing the target query information Query1 with the target channel identifier Channel to obtain target query data (Query1 + Channel);

[0077] Step S404: Querying whether there is a target key key that completely matches, key = Query1, or key = Query1 + Channel in the (key, value) in the first database;

[0078] Step S406: In the case where there is a target key key1 that completely matches in the first database, determining the value value1 corresponding to the target key key1 as the result data of the target query information;

[0079] Step S408: When the target key is not included in the first database, calculate the similarity between each historical query information stored in the second database and the target query information, where the second database is stored as doc1{key:Query,channel:Channel};

[0080] Step S410: Detect whether there is a reference query information in the second database whose similarity to the target query information is higher than the first threshold;

[0081] Step S412: When there is a reference query information key2:Query2 whose similarity to the target query information is higher than the first threshold, extract the historical result data value2 corresponding to the reference query information key2:Query2 from the first database as the result data of the target query information. Among them, {key2:Query2, channel:Channel} is stored in the second database, and (key2 + Channel, value2) is stored in the first database. The data in the second database and the data in the first database can be divided by the same Channel, or the first database can store all the keys and corresponding values in the second database.

[0082] Step S414: When there is no reference query information in the second database whose similarity to the target query information is higher than the first threshold, calculate the vector value of the target query information

[0083] Step S416: Calculate the vector value of the target query information The distance from the historical information vector stored in the second database;

[0084] Step S418: Whether there is a target information vector of the target query information Whose similarity to the information vector is higher than the second threshold;

[0085] Step S420: When obtaining the target information vector of the target query information Whose similarity to the information vector is higher than the second threshold key3: In this case, the information vector key3: The corresponding historical query information key3: As the target query information;

[0086] Step S422: Obtain the target query information key3: from the first database The corresponding historical result data value3 is used as the result data of the target query information. Among them, the second database stores {key3:Query3, channel:Channel}, and the first database stores (key3 + Channel, value3). The data in the second database and the data in the first database can be divided by the same Channel, for example, or the first database can store all the keys and corresponding values in the second database, etc.

[0087] Step S424: In the case where there is no information vector whose similarity to the target information vector of the target query information is higher than the second threshold, call the generative pre-trained GPT model to query the target query information.

[0088] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0089] In this embodiment, a calling device for a generative pre-trained GPT model is also provided. This device is used to implement the above embodiments and preferred embodiments, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that realizes a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0090] Figure 5 It is a structural block diagram of a calling device for a generative pre-trained GPT model according to an embodiment of the present invention. The device includes:

[0091] A receiving module 52, configured to receive a target calling request, where the target calling request is used to request to call the generative pre-trained GPT model to query target query information;

[0092] A search module 54, configured to respond to the target call request and search for the target query information from the historical storage according to multiple information dimensions. The historical storage is used to store historical query information and historical result data with a corresponding relationship. The historical result data is the data output by the generative pre-trained GPT model obtained by querying the corresponding historical query information using the generative pre-trained GPT model. The multiple information dimensions are used to indicate various representation methods of the query information;

[0093] An extraction module 56, configured to, when the target query information is searched according to the target information dimension, extract the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information.

[0094] Through the above device, a target call request is received, where the target call request is used to request to call the generative pre-trained GPT model to query the target query information; in response to the target call request, the target query information is searched from the historical storage according to multiple information dimensions. The historical storage is used to store historical query information and historical result data with a corresponding relationship. The historical result data is the data output by the generative pre-trained GPT model obtained by querying the corresponding historical query information using the generative pre-trained GPT model. The multiple information dimensions are used to indicate various representation methods of the query information; when the target query information is searched according to the target information dimension, the historical result data corresponding to the target query information in the target information dimension is extracted from the historical storage as the result data of the target query information. Since the data output by the generative pre-trained GPT model obtained by storing the historical query information is stored in the historical storage, when the target call request is received, it is possible to first check in the historical storage whether there is result data that can reply to the current target query information, reducing the interaction with the model and solving the problem of low usage efficiency of the generative pre-trained GPT model.

[0095] In an exemplary embodiment, the search module includes:

[0096] A first search unit, configured to search for the target query information from the historical storage according to the first dimension, where the first dimension is a search dimension with complete hit;

[0097] A second search unit, configured to, when the target query information is not searched according to the first dimension, search for the target query information from the historical storage according to the second dimension, where the second dimension is a search dimension with information parameter matching, and the multiple information dimensions include the first dimension and the second dimension.

[0098] In an exemplary embodiment, the search module is configured to: construct a first search instruction in the first dimension, where the first search instruction is used to indicate searching for search results that exactly match the target query information; execute the first search instruction in the historical storage to obtain a first search result of the first search instruction; in a case where the first search result indicates that the target query information is not found, construct a second search instruction in the second dimension, where the second search instruction is used to indicate searching for search results that match the information parameters of the target query information; execute the second search instruction in the historical storage to obtain a second search result of the second search instruction.

[0099] In an exemplary embodiment, the search module is configured to: execute the first search instruction in the first database with the target query information as the target key, where the historical storage includes the first database, and the first database stores historical query information and historical result data with a corresponding relationship in the form of key-value pairs, with historical query information as the key and historical result data as the value; obtain the first search result returned by the first database in response to the first search instruction; in a case where the first search result indicates that the target key is found, determine that the first dimension is the target information dimension.

[0100] In an exemplary embodiment, the search module is configured to: construct a search instruction in the first sub-dimension corresponding to the target query information, where the search instruction in the first sub-dimension is used to indicate searching for query information with a similarity higher than a first threshold to the target query information; in a case where the search result corresponding to the search instruction in the first sub-dimension indicates that the target query information is not found, construct a search instruction in the second sub-dimension corresponding to the target query information, where the search instruction in the second sub-dimension is used to indicate searching for information vectors with a similarity higher than a second threshold to the target information vector of the target query information.

[0101] In an exemplary embodiment, the search module is configured to: execute a search instruction for the first sub-dimension in a second database, where the historical storage includes the second database, and historical query information is stored in the second database; obtain a first sub-result returned by the second database in response to the search instruction for the first sub-dimension; when the first sub-result is used to indicate that reference query information with a similarity higher than the first threshold to the target query information is found, determine that the first sub-dimension is the target information dimension; when the first sub-result is used to indicate that no query information with a similarity higher than the first threshold to the target query information is found, execute a search instruction for the second sub-dimension in the second database, where historical information vectors and historical query information with a corresponding relationship are also stored in the second database; obtain a second sub-result returned by the second database in response to the search instruction for the second sub-dimension; when the second sub-result is used to indicate that a reference information vector with a similarity higher than the second threshold to the target information vector is found, determine that the second sub-dimension is the target information dimension.

[0102] In an exemplary embodiment, the search module is configured to: when the target information dimension is the first sub-dimension, extract historical result data corresponding to the reference query information from a first database as result data for the target query information, where the historical storage includes the first database, and historical query information and historical result data with a corresponding relationship are stored in the first database in the form of key-value pairs with the historical query information as the key and the historical result data as the value; when the target information dimension is the second sub-dimension, extract candidate query information corresponding to the reference information vector from the second database; extract historical result data corresponding to the candidate query information from the first database as result data for the target query information, where the historical storage includes the first database, and historical query information and historical result data with a corresponding relationship are stored in the first database in the form of key-value pairs with the historical query information as the key and the historical result data as the value.

[0103] In an exemplary embodiment, the search module is configured to: detect a target channel identifier corresponding to the target call request; fuse the target query information and the target channel identifier into target query data; search for the target query data from historical query data and historical result data with a corresponding relationship stored in the historical storage according to the multiple information dimensions, where the historical query data is obtained by fusing the historical query information and the corresponding channel identifier.

[0104] Embodiments of the present application further provide a computer-readable storage medium storing a computer program, where the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0105] Optionally, in this embodiment, the above storage medium may be configured to store a computer program for executing the following steps:

[0106] S1. Receive a target call request, where the target call request is used to request to call the generative pre-trained GPT model to query target query information;

[0107] S2. Respond to the target call request, and search for the target query information from the historical storage according to multiple information dimensions, where the historical storage is used to store historical query information and historical result data with a corresponding relationship, the historical result data is the data output by the generative pre-trained GPT model obtained by calling the generative pre-trained GPT model to query the corresponding historical query information, and the multiple information dimensions are used to indicate various representation methods of query information;

[0108] S3. When the target query information is searched according to the target information dimension, extract the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information.

[0109] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as a USB flash drive, a read-only memory (ROM for short), a random access memory (RAM for short), a mobile hard disk, a magnetic disk, or an optical disc that can store a computer program.

[0110] Specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and will not be elaborated here.

[0111] Embodiments of the present invention further provide an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0112] Optionally, in this embodiment, the above processor may be configured to execute the following steps through a computer program:

[0113] S1. Receive a target call request, where the target call request is used to request to call the generative pre-trained GPT model to query target query information;

[0114] S2. In response to the target call request, search for the target query information from the historical storage according to multiple information dimensions, where the historical storage is used to store historical query information and historical result data with a corresponding relationship, the historical result data is the data output by the generative pre-trained GPT model obtained by calling the generative pre-trained GPT model to query the corresponding historical query information, and the multiple information dimensions are used to indicate various representation methods of query information;

[0115] S3. In the case where the target query information is searched according to the target information dimension, extract the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information.

[0116] In an exemplary embodiment, the above electronic device may further include a transmission device and an input / output device, where the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0117] Specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and will not be elaborated here.

[0118] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the present invention is not limited to any specific combination of hardware and software.

[0119] The above are only the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.

Claims

1. A method for invoking a generative pre-trained GPT model, characterized in that, Including: Receiving a target call request, where the target call request is used to request to call a generative pre-trained GPT model to query target query information; Responding to the target call request, searching for the target query information from historical storage according to multiple information dimensions, where the historical storage is used to store historical query information and historical result data with a corresponding relationship, and the historical result data is the data output by the generative pre-trained GPT model obtained by calling the generative pre-trained GPT model to query the corresponding historical query information, and the multiple information dimensions are used to indicate various representation methods of query information; In the case where the target query information is searched according to the target information dimension, extracting the historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information.

2. The method according to claim 1, characterized in that, The searching for the target query information from historical storage according to multiple information dimensions includes: Searching for the target query information from the historical storage according to a first dimension, where the first dimension is a search dimension for complete hit; In the case where the target query information is not searched according to the first dimension, searching for the target query information from the historical storage according to a second dimension, where the second dimension is a search dimension for information parameter matching, and the multiple information dimensions include the first dimension and the second dimension.

3. The method according to claim 2, wherein The searching for the target query information from the historical storage according to the first dimension includes: constructing a first search instruction for the first dimension, where the first search instruction is used to indicate searching for a search result that completely hits the target query information; executing the first search instruction in the historical storage to obtain a first search result of the first search instruction; In the case where the target query information is not searched according to the first dimension, the searching for the target query information from the historical storage according to the second dimension includes: in the case where the first search result is used to indicate that the target query information is not searched, constructing a second search instruction for the second dimension, where the second search instruction is used to indicate searching for a search result that matches the information parameters of the target query information; executing the second search instruction in the historical storage to obtain a second search result of the second search instruction.

4. The method according to claim 3, wherein The executing the first search instruction in the historical storage to obtain a first search result of the first search instruction includes: Executing the first search instruction in a first database with the target query information as a target key, where the historical storage includes the first database, and the first database stores historical query information and historical result data with a corresponding relationship in a key-value pair form with historical query information as the key and historical result data as the value; Obtaining the first search result returned by the first database in response to the first search instruction; In the case where the first search result is used to indicate that the target key is searched, determining the first dimension as the target information dimension.

5. The method according to claim 3, characterized in that, The second search instruction for constructing the second dimension includes: Constructing a search instruction for a first sub-dimension corresponding to the target query information, where the search instruction for the first sub-dimension is used to indicate searching for query information with a similarity higher than a first threshold to the target query information; In the case where the search results corresponding to the search instruction for the first sub-dimension are used to indicate that the target query information is not found, constructing a search instruction for a second sub-dimension corresponding to the target query information, where the search instruction for the second sub-dimension is used to indicate searching for information vectors with a similarity higher than a second threshold to the target information vector of the target query information.

6. The method according to claim 5, characterized in that, The executing the second search instruction in the historical storage to obtain a second search result of the second search instruction includes: Executing the search instruction for the first sub-dimension in a second database, where the historical storage includes the second database, and the second database stores historical query information; Obtaining a first sub-result returned by the second database in response to the search instruction for the first sub-dimension; in the case where the first sub-result is used to indicate that a reference query information with a similarity higher than the first threshold to the target query information is found, determining the first sub-dimension as the target information dimension; In the case where the first sub-result is used to indicate that no query information with a similarity higher than the first threshold to the target query information is found, executing the search instruction for the second sub-dimension in the second database, where the second database also stores historical information vectors and historical query information with a corresponding relationship; Obtaining a second sub-result returned by the second database in response to the search instruction for the second sub-dimension; in the case where the second sub-result is used to indicate that a reference information vector with a similarity higher than the second threshold to the target information vector is found, determining the second sub-dimension as the target information dimension.

7. The method according to claim 6, characterized in that, The extracting, in the case of searching for the target query information according to the target information dimension, historical result data corresponding to the target query information in the target information dimension from the historical storage as the result data of the target query information includes: In the case where the target information dimension is the first sub-dimension, extracting historical result data corresponding to the reference query information from a first database as the result data of the target query information, where the historical storage includes the first database, and the first database stores historical query information and historical result data with a corresponding relationship in the form of key-value pairs with the historical query information as the key and the historical result data as the value; When the target information dimension is the second sub-dimension, extract the candidate query information corresponding to the reference information vector from the second database; extract the historical result data corresponding to the candidate query information from the first database as the result data of the target query information, where the historical storage includes the first database, and the first database stores the historical query information and the historical result data with a corresponding relationship in the form of key-value pairs, with the historical query information as the key and the historical result data as the value.

8. The method according to any one of claims 1 to 7, characterized in that The searching for the target query information from the historical storage according to multiple information dimensions includes: Detect the target channel identifier corresponding to the target call request; Fuse the target query information with the target channel identifier into target query data; Search for the target query data from the historical query data and historical result data with a corresponding relationship stored in the historical storage according to the multiple information dimensions, where the historical query data is obtained by fusing the historical query information with the corresponding channel identifier.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, where the program, when running, executes the method according to any one of claims 1 to 8.

10. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 8 through the computer program.