Model invocation method and apparatus, medium, device and computer program product
By obtaining the configuration information of the target model and generating a call request, the problem of complexity in managing and calling different models is solved, and unified management and efficient calling of the model access platform are achieved.
Patent Information
- Application Number
- PCT/CN2024/132701
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-28
- Filing Date
- 2024-11-18
- Publication Date
- 2025-10-02
AI Technical Summary
The management and calling of different models requires complex processes, making it difficult to achieve unified management and quick calling.
Provided are a model calling method and device, which obtains configuration information of a target model, generates a target calling request, and calls the target model based on the request, thereby achieving model access and unified management.
It simplifies the model calling process, improves the management efficiency and calling efficiency in the model access platform, and ensures the security and consistency of the calling process.
Smart Images

Figure CN2024132701_02102025_PF_FP_ABST
Abstract
Description
Model calling method, device, medium, equipment and computer program product
[0001] This application claims priority to Chinese Patent Application No. 202410370990.1 filed on March 28, 2024, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] The present disclosure relates to a model calling method, apparatus, medium, device and computer program product. Background Art
[0003] Currently, there are many large models in the industry, through which users can interact or create corresponding text. However, different models are usually implemented by different interfaces, and managing and calling multiple models often requires complex processes. Summary of the Invention
[0004] This summary is provided to briefly introduce concepts that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, the present disclosure provides a model calling method, the method comprising:
[0006] In response to receiving an interaction request for a target model in a model access platform, obtaining configuration information of the target model, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information;
[0007] generating a target call request for calling the target model according to the configuration information, the interaction information and the call request template of the target model;
[0008] The target model is called based on the target call request to obtain response data corresponding to the interaction request.
[0009] In a second aspect, the present disclosure provides a model calling device, the device comprising:
[0010] an acquisition module, configured to, in response to receiving an interaction request for a target model in a model access platform, acquire configuration information of the target model, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information;
[0011] A generating module, configured to generate a target calling request for calling the target model according to the configuration information, the interaction information and the calling request template of the target model;
[0012] The calling module is used to call the target model based on the target calling request to obtain response data corresponding to the interaction request.
[0013] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when executed by a processing device.
[0014] In a fourth aspect, the present disclosure provides an electronic device, comprising:
[0015] a storage device having a computer program stored thereon;
[0016] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect.
[0017] In a fifth aspect, the present disclosure provides a computer program product, comprising a computer program, which implements the steps of the method described in the first aspect when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale. In the drawings:
[0019] FIG1 is a flowchart of a model calling method provided according to some embodiments of the present disclosure.
[0020] FIG2 is a schematic diagram of configuration information of a target model provided according to some embodiments of the present disclosure.
[0021] FIG3 is a block diagram of a model calling device according to some embodiments of the present disclosure.
[0022] FIG4 shows a schematic structural diagram of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0023] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0024] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0025] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Definitions of other terms are provided in the following description.
[0026] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0027] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0028] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0029] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0030] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0031] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0032] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0033] At the same time, it is understood that the data involved in the technical solution of the present disclosure (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of relevant laws, regulations and relevant provisions.
[0034] FIG1 is a flowchart of a model calling method according to some embodiments of the present disclosure. As shown in FIG1 , the method may include:
[0035] In step 11, in response to receiving an interaction request for a target model in a model access platform, configuration information of the target model is obtained, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information.
[0036] The model access platform can connect to a variety of models, including large models. Large models generally refer to machine learning models with many parameters, and can be categorized as large language models, computer vision (including images and video), audio, and multimodal large models. The model access platform can include multiple large models, allowing users to select the appropriate model for interaction based on their needs.
[0037] As an example, the user can interact through the front-end interactive interface, which may include a dialog area and a model selection area. The user can enter the corresponding interactive information in the dialog area and select the corresponding model in the model selection area. When the user submits the interactive information, the corresponding interactive request can be triggered, such as when the user enters "Where can I go to play in XX City on the weekend?" in the dialog area. As an example, the model selection area can display the models that have been connected to the model access platform through a drop-down menu or a display list. The user can select according to their needs, and the model selected by the user in the model selection area can be used as the target model. If the user does not make a selection, the default configuration model can be used as the target model.
[0038] Among them, the configuration information of the target model can include the data mapping relationship between the target model and the model access platform, so that the data in the model access platform can be mapped to different models, realizing the adaptation of the calling interface of different models and realizing model access.
[0039] As an example, the configuration information of the target model includes the authorization verification information, input configuration information and output configuration information corresponding to the target model, as shown in Figure 2. For the provider Family of each model, there will be different authorization authentication methods or data input and output rules, but many most models are more different in command methods, and the overall mechanism is basically the same. Based on this, the configuration information of the model can be abstracted in the present disclosure, and the access of related models can be quickly realized through configuration. Among them, the authorization verification information is used to represent the authentication information for calling the target model. If the authorization verification information can be pre-configured according to the authorization verification method of each access model, it can be added to the target call request so that the target model responds to the target call request to perform back-end interface verification to ensure the security and effectiveness of the target model call. The input configuration information is used to represent the mapping relationship between the fields corresponding to the input data of the target model and the configuration fields in the model access platform. Among them, in order to ensure the adaptability of the model access platform to multiple models, standard fields can be defined in the model access platform. When a model is accessed in the model access platform, the fields corresponding to the input data in the model can be mapped to which standard fields in the general model access platform correspond, so that the access model can be called based on the mapped standard fields, and a universal access method between the model access platform and the model can be realized. Accordingly, the output configuration information is used to represent the mapping relationship between the fields corresponding to the output data of the target model and the configuration fields in the model access platform. Similarly, the fields corresponding to the output data corresponding to the model can be mapped to which standard fields in the general model access platform correspond, so as to obtain the required output data from the return data obtained by calling the model, and realize the call of the model by the model access platform.
[0040] In step 12, a target call request for calling the target model is generated according to the configuration information, the interaction information and the call request template of the target model.
[0041] Among them, the calling request template of the target model can be based on the calling method of the target model. The calling request template can include the names of various fields required to call the target model, so that the field values of each field in the calling request can be determined based on the configuration information and interaction information, and then the field values can be added to the corresponding fields in the calling request to construct the target calling request.
[0042] In step 13, the target model is called based on the target call request to obtain response data corresponding to the interaction request.
[0043] Thus, a target call request for calling the target model can be constructed through the above steps, thereby realizing the call of the target model and obtaining the return data after the target model is called. Furthermore, the data used to respond to the front-end interaction request can be determined from the return data, such as the response data can be output in the front-end interaction interface. For example, the response data can be "XX City is a city full of vitality and cultural atmosphere, with many places suitable for weekend trips. The following are several places worth recommending:
[0044] XX1 Museum: XX1 Museum is a museum integrating art, history and culture. It has many exquisite works of art and cultural relics, which can allow you to gain an in-depth understanding of the cultural history of China and the world.
[0045] YY1 Scenic Spot: YY1 is one of the iconic attractions in XX City. It has many high-rise buildings and a bustling commercial district, making it a great place to enjoy the beautiful scenery of the ZZ River and the cityscape. ", thereby achieving human-computer interaction.
[0046] Through the above technical solution, multiple models can be uniformly connected to the model access platform, so that multiple models can be uniformly managed based on the model access platform. In addition, each model corresponds to configuration information and a call request template. Therefore, when calling the target model, based on the above information and interaction information, a corresponding target call request can be generated to call the target model and obtain the response data corresponding to the interaction request. In this way, models implemented by different interfaces can be connected to the same model access platform for management and configuration, so that different models can be quickly called and uniformly managed, effectively simplifying the model call process, and also improving the efficiency of model access in the model access platform.
[0047] Accordingly, the configuration information of the target model can be obtained in the following ways:
[0048] In response to receiving an access request of a target model, a configuration interface is displayed, wherein the configuration interface carries fields to be configured corresponding to the target model.
[0049] The access request can be triggered by the model provider. For example, if the model provider wants to access its model M1 to the model access platform, they can click the access control to trigger the access request, which then displays the corresponding configuration interface. The fields to be configured for the target model can be predetermined based on its actual application scenario.
[0050] For example, for model M1, the corresponding field to be configured is M11-M1n If there are n fields, the n fields can be displayed in the configuration interface to facilitate field mapping configuration.
[0051] Afterwards, in response to receiving a configuration operation for each of the fields to be configured, a mapping relationship between the information indicated by the configuration operation and the fields to be configured is generated to obtain the configuration information.
[0052] The configuration operation can be an input operation, a selection operation, etc. For example, for authorization and authentication information, the corresponding Key and Value fields can be displayed, and the access personnel can perform corresponding input operations on it, and the input data can be mapped with the Key and Value fields. For input configuration information, the input fields corresponding to the target model can be displayed, and the access personnel can select the fields corresponding to each input field from the standard fields defined by the model access platform, so that the selected fields can be mapped one by one with the fields in the target model. The following is an example:
[0053] "messgae":"input"
[0054] "messgae" represents the standard field defined by the model access platform, and "input" represents the field in the target model that is mapped to this standard field, thereby implementing the mapping between the target model and the model access platform. The mapping process for other fields is similar and will not be repeated here.
[0055] Therefore, through the above technical solution, the model can be quickly and accurately connected to the model access platform by configuring the fields and information of the model, without the need to write interface call logic and code for each model, thereby improving the efficiency of model access and calling.
[0056] After the model configuration is complete, the corresponding configuration information of the model can be stored in the database to achieve configuration information storage. Afterwards, the model configuration information can be loaded into the memory in the model access platform, and the configuration information of each model can be indexed to enable rapid matching based on the model configuration information and realize model calling.
[0057] In some possible embodiments, the interaction request also carries an identifier of the target model. Accordingly, in response to receiving an interaction request for a target model in the model access platform, obtaining configuration information of the target model may include:
[0058] Based on the identifier of the target model, querying from the configuration information corresponding to the model access platform;
[0059] The queried configuration information is determined as the configuration information of the target model.
[0060] When the backend service in the model access platform is started, the configuration information of the models already connected to the model access platform can be loaded to load each configuration information into the memory. Accordingly, the configuration information loaded into the memory can be indexed by the model identifier. As an example, the identifier of the target model can be its corresponding ID or model name, as long as it can uniquely identify the target model, and this disclosure is not limited to this.
[0061] In this embodiment, when it is determined that the target model is to be called, a query can be made from the index using its identifier, and the configuration information found can be determined as the configuration information of the target model. Thus, the front-end data of the model access platform can be converted based on the configuration information to realize the call of the target model, thereby improving the consistency and efficiency of the target model call. In addition, by connecting the model to the model access platform through configuration information, the influence between different models in the model access platform can be effectively decoupled, avoiding the impact of the access of new models in the model access platform on existing models, and ensuring the effectiveness of model calls and the versatility of model access.
[0062] In some possible embodiments, the authorization verification information is stored in a key-value pair structure, such as a Key-Value structure. In actual applications, authorization verification is basically performed through HTTP requests, and the HTTP request header contains information used for authorization verification. Therefore, in this disclosure, the configuration of the authorization verification information can be defined as an authenticated array, and its corresponding JSON structure can be expressed as: Key: Value. An example of the authorization verification information in the configuration information is as follows:
[0063] Accordingly, generating a target call request for calling the target model according to the configuration information, the interaction information, and the call request template of the target model may include:
[0064] According to the Key value and the Value value in the key-value pair, the field value of the authorization verification field in the call request template is generated and added to the call request template to generate the target call request.
[0065] For example, when calling the target model, the authorization verification field in the corresponding call request template may carry the information corresponding to the target model for authorization verification, which may be pre-configured based on different models. Accordingly, the Key value can be determined based on the authorization verification field in the call request template, and a query can be performed from the authorization verification information based on the determined Key value, and the queried Value value is used as the authorization verification information of the target call request corresponding to the target model, and added to the corresponding position in the call request template to obtain the target call request, so that when the target model is called based on the target call request, the target model can be verified based on the authorization verification information carried in the target call request to determine whether the target model can be called.
[0066] Therefore, through the above technical solution, the authorization verification information corresponding to the model can be pre-configured in the model access platform, and then when the target model is called subsequently, the corresponding authorization verification information can be added to the corresponding target call request, so as to quickly and directly realize the verification when calling the target model, thereby improving the security and efficiency of the target model call.
[0067] In some possible embodiments, the input configuration information includes message field mapping information Message, and the message field mapping information can be used to represent a mapping relationship between fields corresponding to messages generated by front-end interaction and fields in a target model.
[0068] The model access platform allows you to define messages to store historical chat content. By default, personalized messages are supported. Personalized messages can differentiate between message sources such as system, assistant, and human. Messages can be stored in an array structure, with each array containing a single message.
[0069] As an example, the defined Message is as follows:
[0070] Accordingly, generating a target call request for calling the target model according to the configuration information, the interaction information, and the call request template of the target model may include:
[0071] According to the message field mapping information, the platform definition field corresponding to the message field in the call request template in the model access platform is determined. The platform definition field is the standard field applied in the model access platform as mentioned above.
[0072] As an example, the message field mapping information corresponding to the target model is shown as follows:
[0073] Based on the message field mapping information, it is determined that the message field "input" in the call request template corresponding to the target model corresponds to the platform-defined field "message" in the model access platform. Other mapping relationships are similar and will not be repeated here.
[0074] Afterwards, the field value of the platform definition field is obtained, that is, the field value of the model access platform "messgae" is obtained, such as "Where can I go to play in XX city on the weekend?".
[0075] The field value is used as the field value of the message field in the call request template to obtain the target call request.
[0076] Accordingly, you can replace the "input" field value in the call request template with this field value, adding the question "Where can I go this weekend in XX City?" to the call request template. Replacing the field values of other message fields is similar and will not be repeated here. After determining the field values for each message field, you can construct a target call request based on the information obtained from the model access platform to call the target model.
[0077] Therefore, through the above technical solution, the mapping relationship between the input fields of the target model and the fields in the model access platform can be pre-configured, so that the actual parameter values in the call request template of the target model can be accurately determined based on the data in the model access platform, thereby realizing the construction of the target call request and improving the efficiency of the target model call.
[0078] When configuring the target model, the mapping method may be determined based on whether the target model supports personalized messages. For example, the message field mapping information may include the following configuration:
[0079] "suppport_role":true
[0080] Among them, true means that personalized messages are supported, and false means that personalized messages are not supported. For models that fully support personalized messages, each message source can be mapped one by one. For models that do not support personalized messages, only the message content "content" field can be configured. Accordingly, only the message content is passed when the target call request is generated later. For models that support some personalized messages, the personalized source messages that are not supported by the target model can be discarded or converted into other personalized messages. It can be configured based on the actual application scenario requirements. For example, if the personalized messages supported by model M2 include assistant and human, then for the system message, if the field mapping configuration is not performed, the part of the message can be discarded when the target call request is generated. Accordingly, the system field and the assistant field can also be mapped to the same field in the target model. Then, when the target call request is generated, the content of the system field can be converted into the content of the assistant field and further added to the target call request.
[0081] In some possible embodiments, the input configuration information includes tool call configuration information Tools, and the tool call configuration information includes a name mapping field of a method name corresponding to a method to be called and a parameter mapping field of input parameters of the method to be called.
[0082] In large language models, the large model tool call function_call is typically used to call predefined functions or subroutines. This allows the model to dynamically call defined functions and pass corresponding parameters at runtime, thereby increasing the model's flexibility and scalability and enabling the model to perform more complex tasks. For example, if the large language model wants to learn the latest news, it can use a function_call to obtain the news, allowing the large language model to obtain the latest news data.
[0083] Accordingly, in the embodiment of the present disclosure, tool call configuration may also be performed on the model supporting tool call to obtain tool call configuration information. For example, the tool call configuration information is represented as follows:
[0084] When connecting a model to the platform, if the model supports tool invocation, set "support_tools" to true; if the model does not support tool invocation, set "support_tools" to false. Accordingly, if "support_tools" is set to false, the other fields in "tools" do not need to be configured.
[0085] Accordingly, "parameters" contains the mapping between fields in the model access platform and the fields of the model's tool call input parameters. During configuration, the model's tool call input parameter fields can be used as the fields to be configured, allowing access personnel to select the corresponding field from the model access platform fields for each input parameter field. This process is similar to the field configuration method described above and will not be repeated here.
[0086] Among them, whether the target model supports tool calling can be determined through the "support_tools" field in the tool calling configuration information of the target model. If the value of the "support_tools" field is true, it means that the target model supports tool calling.
[0087] Accordingly, when making a tool call, it can be implemented based on a retrieval-augmented generation method (RAG). For example, a target call request can be constructed based on the interaction information and a list of methods supported by the target model for tool calls. This can be generated by constructing a target call request based on the message field mapping information as described above, and the method list can be added to the generated target call request. The target model can then respond to the target call request and determine whether a tool call is required based on the interaction information and the method list. If it is determined that a tool call is required, the target method to be called can be returned to the model access platform.
[0088] Accordingly, generating a target call request for calling the target model according to the configuration information, the interaction information, and the call request template of the target model may include:
[0089] If the target model supports tool calling, and a target method is determined from the methods to be called based on the interaction information and the target model, a target name mapping field and a target parameter mapping field corresponding to the target method are determined based on the tool calling configuration information.
[0090] Among them, based on the tool call configuration information described above, the fields required to call the target method in the target model and the corresponding fields in the model access platform can be determined. The determination method is similar to the method of determining the fields corresponding to the message fields described above, and will not be repeated here.
[0091] The field values of the target name mapping field and the target parameter mapping field are obtained, and the target method is called based on the field values to obtain a call return value.
[0092] For example, a call request for the target method can be constructed based on the target name mapping field and the field values of the target parameter mapping field. For example, the name of the target method to be called can be determined based on the target name mapping field, and the input parameter value when calling the target method can be determined based on the field value of the target parameter mapping field. Then, the target method is called based on the input parameter value of the target method to obtain the call return value of the target method.
[0093] Afterwards, the target model is called based on the call return value, the interaction information, and the call request template of the target model. Accordingly, the call return value and the interaction information can be used as new interaction information, and combined with the call request template to call the target model. The calling method is detailed above and will not be repeated here.
[0094] Therefore, through the above technical solution, parameter mapping can be achieved when calling the tool of the target model through the tool call configuration information, so that the model in the model access platform can support tool calling, expand the usage scenarios of the accessed model, and improve the efficiency and accuracy of model calling.
[0095] In some possible embodiments, the input configuration information also includes model configuration information ModelConfig, such as the name of the target model, the temperature coefficient Temperature, and the Stop word of the target model. Among them, the temperature coefficient Temperature is usually between 0 and 1, which is used to adjust the degree of random sampling from the target model. When the temperature coefficient is not 0, the same prompt may produce different outputs. A temperature coefficient of 0 will always produce the same output. The larger the temperature coefficient, the greater the randomness of the target model output result. The Stop word of the target model can be configured based on the actual application scenario. As an example, the model configuration information is expressed as follows:
[0096] When generating a target call request, model configuration information corresponding to the target model may be added to the target call request to constrain the output result of the target model.
[0097] In some possible embodiments, calling the target model based on the target call request and obtaining response data corresponding to the interaction request may include:
[0098] Acquire return data corresponding to calling the target model, wherein the return data is output data corresponding to the target model after calling the target model based on the target call request.
[0099] Based on the output configuration information of the target model, target data under the data acquisition path in the output configuration information is acquired from the returned data, and the target data is determined as the response data.
[0100] The returned data may include response data corresponding to the interactive request and other data. In this embodiment, the response data can be further obtained from the returned data by outputting the configuration information. As an example, the output configuration information is represented as follows:
[0101] Among them, the path of the content required to call the target model in its return data can be determined through the above process. After obtaining the return data, the content can be further extracted from the return data based on the path to respond to the interaction request. In addition, it can be determined based on the configuration of "function_call" whether to call function_call. If it is determined to be called, the corresponding data can be obtained from the return data based on the path obtained by the content returned by function_call, and assembled to obtain the data required in the model access platform. Among them, the data assembly method can be pre-set based on the application scenario of the actual model, and this disclosure does not limit this.
[0102] Therefore, through the above technical solution, the data required by the model access platform can be quickly and accurately obtained from the return data obtained by calling the target model, so that the interactive request of the model access platform front end can be responded to, further improving the uniformity of the model access platform's management and calling of multiple models, and simplifying the process of model calling.
[0103] Based on the same inventive concept, the present disclosure further provides a model calling device, as shown in FIG3 , wherein the device 10 includes:
[0104] An acquisition module 100 is configured to, in response to receiving an interaction request for a target model in a model access platform, acquire configuration information of the target model, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information;
[0105] A generating module 200, configured to generate a target call request for calling the target model according to the configuration information, the interaction information and the call request template of the target model;
[0106] The calling module 300 is configured to call the target model based on the target calling request and obtain response data corresponding to the interaction request.
[0107] Optionally, the configuration information of the target model includes authorization verification information, input configuration information and output configuration information corresponding to the target model, the authorization verification information is used to represent the authentication information for calling the target model, the input configuration information is used to represent the mapping relationship between the fields corresponding to the input data of the target model and the configuration fields in the model access platform, and the output configuration information is used to represent the mapping relationship between the fields corresponding to the output data of the target model and the configuration fields in the model access platform.
[0108] Optionally, the authorization verification information is stored in a key-value pair structure; the generation module includes:
[0109] The first determination submodule is used to generate a field value of the authorization verification field in the call request template according to the Key value and the Value value in the key-value pair and add the field value to the call request template to generate the target call request.
[0110] Optionally, the input configuration information includes message field mapping information;
[0111] The generation module includes:
[0112] A second determining submodule is configured to determine, based on the message field mapping information, the platform definition field corresponding to the message field in the call request template in the model access platform;
[0113] A first acquisition submodule is used to obtain the field value of the platform-defined field;
[0114] The first generating submodule is configured to use the field value as the field value of the message field in the calling request template to obtain the target calling request.
[0115] Optionally, the input configuration information includes tool call configuration information, the tool call configuration information includes a name mapping field for a method name corresponding to a to-be-called method and a parameter mapping field for input parameters of the to-be-called method, and the generation module includes:
[0116] a third determination submodule, configured to determine a target name mapping field and a target parameter mapping field corresponding to the target method based on the tool call configuration information if the target model supports tool call and a target method is determined from the to-be-called methods based on the interaction information and the target model;
[0117] A second acquisition submodule is used to obtain the field values of the target name mapping field and the target parameter mapping field, and call the target method based on the field values to obtain a call return value;
[0118] The second generating submodule is configured to call the target model based on the call return value, the interaction information and the call request template of the target model.
[0119] Optionally, the calling module includes:
[0120] The third acquisition submodule is used to obtain the return data corresponding to calling the target model;
[0121] The fourth determining submodule is configured to obtain target data under a data acquisition path in the output configuration information from the returned data based on the output configuration information of the target model, and determine the target data as the response data.
[0122] Optionally, the configuration information of the target model is obtained in the following manner:
[0123] In response to receiving an access request from a target model, displaying a configuration interface, wherein the configuration interface carries fields to be configured corresponding to the target model;
[0124] In response to receiving a configuration operation for each of the fields to be configured, a mapping relationship between the information indicated by the configuration operation and the fields to be configured is generated to obtain the configuration information.
[0125] Optionally, the interaction request further carries an identifier of the target model;
[0126] The step of obtaining configuration information of the target model in response to receiving an interaction request for the target model in the model access platform includes:
[0127] A query submodule, configured to query the configuration information corresponding to the model access platform based on the identifier of the target model;
[0128] The fifth determining submodule is configured to determine the queried configuration information as the configuration information of the target model.
[0129] Reference is now made to FIG4 , which illustrates a schematic diagram of the structure of an electronic device (e.g., a terminal device or server) 600 suitable for implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device illustrated in FIG4 is merely an example and should not limit the functionality or scope of use of the embodiments of the present disclosure.
[0130] As shown in Figure 4, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the electronic device 600 are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0131] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although FIG4 shows the electronic device 600 with various devices, it should be understood that not all of the devices shown are required to be implemented or present. More or fewer devices may alternatively be implemented or present.
[0132] According to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0133] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0134] In some embodiments, the client and server can communicate using any currently known or later developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or later developed network.
[0135] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0136] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: in response to receiving an interaction request for a target model in a model access platform, obtains the configuration information of the target model, wherein the interaction request carries the interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information; generates a target call request for calling the target model according to the configuration information, the interaction information and the call request template of the target model; calls the target model based on the target call request, and obtains response data corresponding to the interaction request.
[0137] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0139] The modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of a module does not, in some cases, limit the module itself. For example, an acquisition module may also be described as "a module that, in response to receiving an interaction request for a target model in a model access platform, acquires configuration information of the target model."
[0140] The functions described above in the present disclosure may be performed at least in part by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0141] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0142] According to one or more embodiments of the present disclosure, Example 1 provides a model calling method, wherein the method includes:
[0143] In response to receiving an interaction request for a target model in a model access platform, obtaining configuration information of the target model, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information;
[0144] generating a target call request for calling the target model according to the configuration information, the interaction information and the call request template of the target model;
[0145] The target model is called based on the target call request to obtain response data corresponding to the interaction request.
[0146] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the configuration information of the target model includes authorization verification information, input configuration information and output configuration information corresponding to the target model, the authorization verification information is used to represent the authentication information for calling the target model, the input configuration information is used to represent the mapping relationship between the fields corresponding to the input data of the target model and the configuration fields in the model access platform, and the output configuration information is used to represent the mapping relationship between the fields corresponding to the output data of the target model and the configuration fields in the model access platform.
[0147] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, wherein the authorization verification information is stored in a key-value pair structure; and generating a target call request for calling the target model based on the configuration information, the interaction information, and the call request template of the target model includes:
[0148] According to the Key value and the Value value in the key-value pair, the field value of the authorization verification field in the call request template is generated and added to the call request template to generate the target call request.
[0149] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 2, wherein the input configuration information includes message field mapping information;
[0150] The generating, according to the configuration information, the interaction information and the call request template of the target model, a target call request for calling the target model includes:
[0151] Determine, according to the message field mapping information, the platform definition field corresponding to the message field in the call request template in the model access platform;
[0152] Obtain the field value of the platform-defined field;
[0153] The field value is used as the field value of the message field in the call request template to obtain the target call request.
[0154] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 2, wherein the input configuration information includes tool call configuration information, the tool call configuration information includes a name mapping field for a method name corresponding to a to-be-called method and a parameter mapping field for input parameters of the to-be-called method, and generating a target call request for calling the target model based on the configuration information, the interaction information, and the call request template of the target model includes:
[0155] If the target model supports tool calling, and a target method is determined from the methods to be called based on the interaction information and the target model, a target name mapping field and a target parameter mapping field corresponding to the target method are determined based on the tool calling configuration information;
[0156] Obtaining the field values of the target name mapping field and the target parameter mapping field, and calling the target method based on the field values to obtain a call return value;
[0157] The target model is called based on the call return value, the interaction information and the call request template of the target model.
[0158] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 2, wherein calling the target model based on the target call request and obtaining response data corresponding to the interaction request includes:
[0159] Obtain the return data corresponding to calling the target model;
[0160] Based on the output configuration information of the target model, target data under the data acquisition path in the output configuration information is acquired from the returned data, and the target data is determined as the response data.
[0161] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 1, wherein the configuration information of the target model is obtained in the following manner:
[0162] In response to receiving an access request from a target model, displaying a configuration interface, wherein the configuration interface carries fields to be configured corresponding to the target model;
[0163] In response to receiving a configuration operation for each of the fields to be configured, a mapping relationship between the information indicated by the configuration operation and the fields to be configured is generated to obtain the configuration information.
[0164] According to one or more embodiments of the present disclosure, Example 8 provides the method of Example 1, wherein the interaction request further carries an identifier of the target model;
[0165] The step of obtaining configuration information of the target model in response to receiving an interaction request for the target model in the model access platform includes:
[0166] Based on the identifier of the target model, querying from the configuration information corresponding to the model access platform;
[0167] The queried configuration information is determined as the configuration information of the target model.
[0168] According to one or more embodiments of the present disclosure, Example 9 provides a model calling device, the device comprising:
[0169] an acquisition module, configured to, in response to receiving an interaction request for a target model in a model access platform, acquire configuration information of the target model, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information;
[0170] A generating module, configured to generate a target calling request for calling the target model according to the configuration information, the interaction information and the calling request template of the target model;
[0171] The calling module is used to call the target model based on the target calling request to obtain response data corresponding to the interaction request.
[0172] According to one or more embodiments of the present disclosure, Example 10 provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in any one of Examples 1-8 when executed by a processing device.
[0173] According to one or more embodiments of the present disclosure, Example 11 provides an electronic device, including:
[0174] a storage device having a computer program stored thereon;
[0175] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in any one of Examples 1-8.
[0176] According to one or more embodiments of the present disclosure, Example 12 provides a computer program product, including a computer program, which implements the steps of any one of the methods of Examples 1-8 when executed by a processor.
[0177] The above description is merely an example of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0178] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0179] Although the present disclosure has been described using language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. Regarding the apparatus in the above-described embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method and will not be elaborated upon here.
Claims
1. A model calling method, comprising: In response to receiving an interaction request for a target model in a model access platform, obtaining configuration information of the target model, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information; generating a target call request for calling the target model according to the configuration information, the interaction information and the call request template of the target model; The target model is called based on the target call request to obtain response data corresponding to the interaction request.
2. The method according to claim 1, wherein The configuration information of the target model includes authorization verification information, input configuration information and output configuration information corresponding to the target model. The authorization verification information is used to represent the authentication information for calling the target model. The input configuration information is used to represent the mapping relationship between the fields corresponding to the input data of the target model and the configuration fields in the model access platform. The output configuration information is used to represent the mapping relationship between the fields corresponding to the output data of the target model and the configuration fields in the model access platform.
3. The method according to claim 2, wherein: The authorization verification information is stored in a key-value pair structure; generating a target call request for calling the target model according to the configuration information, the interaction information and the call request template of the target model, including: According to the Key value and the Value value in the key-value pair, the field value of the authorization verification field in the call request template is generated and added to the call request template to generate the target call request.
4. The method according to claim 2, wherein: The input configuration information includes message field mapping information; The generating, according to the configuration information, the interaction information and the call request template of the target model, a target call request for calling the target model includes: Determine, according to the message field mapping information, the platform definition field corresponding to the message field in the call request template in the model access platform; Obtain the field value of the platform-defined field; The field value is used as the field value of the message field in the call request template to obtain the target call request.
5. The method according to claim 2, wherein: The input configuration information includes tool call configuration information, wherein the tool call configuration information includes a name mapping field for a method name corresponding to a to-be-called method and a parameter mapping field for input parameters of the to-be-called method. Generating a target call request for calling the target model based on the configuration information, the interaction information, and a call request template of the target model includes: If the target model supports tool calling, and a target method is determined from the methods to be called based on the interaction information and the target model, a target name mapping field and a target parameter mapping field corresponding to the target method are determined based on the tool calling configuration information; Obtaining the field values of the target name mapping field and the target parameter mapping field, and calling the target method based on the field values to obtain a call return value; The target model is called based on the call return value, the interaction information and the call request template of the target model.
6. The method according to any one of claims 2 to 5, wherein: The calling the target model based on the target call request to obtain response data corresponding to the interaction request includes: Obtain the return data corresponding to calling the target model; Based on the output configuration information of the target model, target data under the data acquisition path in the output configuration information is acquired from the returned data, and the target data is determined as the response data.
7. The method according to any one of claims 1 to 6, wherein: The configuration information of the target model is obtained in the following way: In response to receiving an access request from a target model, displaying a configuration interface, wherein the configuration interface carries fields to be configured corresponding to the target model; In response to receiving a configuration operation for each of the fields to be configured, a mapping relationship between the information indicated by the configuration operation and the fields to be configured is generated to obtain the configuration information.
8. The method according to any one of claims 1 to 7, wherein: The interaction request also carries the identifier of the target model; The step of obtaining configuration information of the target model in response to receiving an interaction request for the target model in the model access platform includes: Based on the identifier of the target model, querying from the configuration information corresponding to the model access platform; The queried configuration information is determined as the configuration information of the target model.
9. A model calling device, comprising: an acquisition module configured to, in response to receiving an interaction request for a target model in a model access platform, acquire configuration information of the target model, wherein the interaction request carries interaction information corresponding to the target model, and the target model is accessed to the model access platform based on the configuration information; a generating module configured to generate a target calling request for calling the target model according to the configuration information, the interaction information and the calling request template of the target model; The calling module is configured to call the target model based on the target calling request and obtain response data corresponding to the interaction request.
10. A computer-readable medium storing a computer program, wherein: When the computer program is executed by a processing device, the model calling method according to any one of claims 1 to 8 is implemented.
11. An electronic device comprising: a storage device storing a computer program; A processing device is configured to execute the computer program in the storage device to implement the model calling method according to any one of claims 1 to 8.
12. A computer program product comprising a computer program, wherein When the computer program is executed by a processor, the model calling method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Artificial intelligence product generation method and device and server
CN111427677A
AGI platform calling management method and device, storage medium and electronic equipment
CN116560857A
Large model information processing method and device, electronic equipment and storage medium
CN117692447A
Model calling method and device, medium, equipment and computer program product
CN118295827A
Dynamic cross-platform ask interface and natural language processing model
US20230021797A1