Implementation method and device for unified interface of large model and electronic equipment
By implementing a unified interface for large models, the problem of business systems needing to adapt to repeated interfaces for different large models is solved, enabling efficient and flexible multi-model calls and improving system development efficiency and maintainability.
Patent Information
- Application Number
- CN202511524453.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2026-02-27
AI Technical Summary
In existing technologies, when a business system calls large model services provided by multiple different vendors, it needs to repeatedly adapt the interface for each model, resulting in high development and maintenance costs, as well as limited flexibility and iteration speed.
This paper provides a method for implementing a unified interface for large models. By converting the business parameters received by the intermediate layer into the standard format required by the target large model, and converting the response data into the unified format required by the business system, a unified interface call is achieved, including interface authentication, parameter validation, dynamic completion, response data unpacking, and differential compression.
It significantly reduces the development complexity of business systems when integrating and using multiple models, improves flexibility and scalability, shortens the business implementation cycle of model switching or upgrades, and improves system maintainability and response speed.
Smart Images

Figure CN121579569A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus and electronic device for implementing a unified interface for large models. Background Technology
[0002] With the rapid development of artificial intelligence technology, large-scale models, such as large language models, have become a core driving force for the intelligent transformation of various industries. In practical business applications, in order to balance performance, cost, and effectiveness, enterprises typically need to integrate and call large-scale model services provided by multiple different vendors. These large-scale model services are developed and maintained by different organizations, and their application programming interfaces (APIs) differ significantly in terms of parameter formats, request construction, authentication methods, and response data structures.
[0003] Currently, when business systems call these heterogeneous large models, the common approach is to write separate interface call code for each specific large model. This "one-point-one-adaptation" model is manageable when the number of models connected is small in the early stages of business.
[0004] However, as business needs continue to evolve and the number of available models increases, this model has revealed obvious limitations: First, the business system needs to repeatedly develop, test, and deploy each newly integrated model, resulting in high development and maintenance costs; second, when it is necessary to replace or add a model, it is often necessary to make a lot of modifications to the business code, which seriously affects the flexibility and iteration speed of the business and prolongs the business implementation cycle. Summary of the Invention
[0005] This application provides a method, apparatus, and electronic device for implementing a unified interface for large models, which solves the problem in the prior art that business systems need to repeatedly adapt interfaces for different large models, and realizes flexible invocation of heterogeneous large model services in a unified and standardized manner.
[0006] This application provides a method for implementing a unified interface for large models, applied to a conversion intermediate layer. The conversion intermediate layer provides a communication connection between a business system and multiple target large models. The method includes: Receive a call request from the business system; wherein the call request includes business parameters; The business parameters are converted into standard format parameters required by the selected target large model, and the standard format parameters are sent to the target large model; Receive the response data returned by the target large model based on the standard format parameters, and convert the response data into a unified format required by the business system; The converted response data is returned to the business system.
[0007] According to the implementation method of the unified interface for large models provided in this application, receiving a call request from the business system includes: authenticating the received call request, wherein the authentication includes verifying the application programming interface key and access permission level of the business system; performing parameter validity verification on the call request that passes the authentication, wherein the verification includes detecting whether the data type, field integrity, and numerical range of the business parameters conform to predefined rules; and distributing the call request that passes the verification to the corresponding target large model processing queue according to the model type identifier in the business parameters.
[0008] According to the implementation method of the unified interface for large models provided in this application, business parameters are converted into standard format parameters required by the selected target large model, including: mapping the business parameters according to the structured description file pre-bound to the selected target large model to obtain initial standard parameters; for the missing required nodes in the initial standard parameters, performing dynamic completion on the missing required nodes according to the template library corresponding to the business scenario to generate completed standard parameters; and packaging the completed standard parameters according to the serialization protocol specified by the target large model to form standard format parameters.
[0009] According to the implementation method of the unified interface of a large model provided in this application, the step of performing dynamic completion of missing required nodes based on a template library corresponding to a business scenario includes: locating a scenario chain template network bound to the business scenario in the template library based on the scenario identifier in the business parameters; the scenario chain template network consists of multiple node templates, each node template corresponding to a missing field; performing a Boolean operation on the currently existing field based on the trigger condition expression built into the node template; when the operation result is true, instantiating the node template immediately to generate a candidate value set for the field to be completed; performing semantic similarity filtering on the candidate value set to obtain the final completed value; and writing the final completed value into the missing node.
[0010] According to the implementation method of the unified interface for a large model provided in this application, the step of converting the response data into a unified format required by the business system includes: unpacking the model-side fields of the response data to obtain the original output of the model; mapping the original output of the model to business fields according to the backfill description file pre-registered with the business system, and folding multi-valued results according to the principle of minimum information entropy to generate single-valued business fields; and packaging the single-valued business fields according to the unified encapsulation protocol specified by the business system to form a unified format.
[0011] According to the implementation method of the unified interface for large models provided in this application, after sending the standard format parameters to the target large model, the method further includes: real-time monitoring of the response status of the target large model; when a response timeout or service unavailability is detected, automatically switching to a backup large model, returning a preset default response, or sending an asynchronous notification including retry suggestions to the business system according to a pre-configured degradation strategy.
[0012] According to the implementation method of a unified interface for a large model provided in this application, before returning the converted response data to the business system, the method further includes: performing differential compression on the response data in the unified format, generating a compressed package and attaching a recovery identifier; writing the compressed package and the recovery identifier together into a cache, and returning a decompressed copy of the response data only when the business system initiates a secondary verification request.
[0013] This application also provides an implementation apparatus for a unified interface for large models, comprising: The request receiving module is used to receive a call request from the business system, wherein the call request includes business parameters; The parameter conversion module is used to convert the business parameters into standard format parameters required by the selected target large model, and send the standard format parameters to the target large model; The format unification module is used to receive the response data returned by the target large model and convert the response data into a unified format required by the business system. The data return module is used to return the converted response data to the business system.
[0014] This application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute, through the computer program, an implementation method for any of the large model unified interfaces described above.
[0015] This application also provides a computer-readable storage medium comprising a stored program, wherein the program, when executed, performs an implementation method of the large model unified interface as described above.
[0016] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the implementation method of any of the above-described large model unified interface.
[0017] The method, apparatus, and electronic device for implementing a unified interface for large models provided in this application achieve this. By converting business parameters from the business system, which are independent of the specific model, into standard format parameters required by the target large model, and then converting the response data back into the unified format required by the business system upon receiving the response, this bidirectional conversion core mechanism allows the business system to operate without needing to concern itself with the specific large model used in the backend, nor to write specific interface adaptation code for each model. This effectively shields the heterogeneity of different large model interfaces in terms of parameter format and response structure. This significantly reduces the development complexity and coding workload of the business system when integrating and using multiple models. Based on this shielding of interface heterogeneity, when business requirements change and require switching or adding / deleting the underlying large model, the business system itself does not need any code modification; it only needs to adapt through the unified interface layer provided by this method. This greatly improves the flexibility and scalability of the business system, enabling it to quickly respond to market changes and technological iterations, and shortening the business implementation cycle caused by model switching or upgrades. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the hardware environment for implementing a unified interface for a large model according to an embodiment of this application; Figure 2 This is one of the flowcharts illustrating the implementation method of the unified interface for the large model provided in this application; Figure 3 This is the second flowchart illustrating the implementation method of the unified interface for the large model provided in this application; Figure 4 This is a schematic diagram of the structure of the implementation device for the unified interface of the large model provided in this application; Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0023] According to one aspect of the embodiments of this application, a method for implementing a unified interface for a large model is provided. This method for implementing a unified interface for a large model is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, smart home device ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above-mentioned method for implementing a unified interface for a large model can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0024] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.
[0025] Figure 2 This is one of the flowcharts illustrating the implementation method of the unified interface for large models provided in this application embodiment. The method is applied to the conversion intermediate layer, which connects the business system and multiple target large models, and includes the following steps: S210: Receives a call request from the business system. The call request includes business parameters.
[0026] According to the implementation method of the unified interface for large models provided in this application, receiving a call request from a business system includes: authenticating the received call request, including verifying the application programming interface key and access permission level of the business system; validating the parameters of the authenticated call request, including checking whether the data type, field integrity, and numerical range of the business parameters conform to predefined rules; and distributing the valid call request to the corresponding target large model processing queue according to the model type identifier in the business parameters.
[0027] Specifically, when a business system initiates a request, it must include its unique Application Programming Interface (API) key in the request header. Upon receiving the request, the unified interface first queries the permission configuration bound to that key to confirm whether it has the authority to access the requested target model. After authentication, the system validates the business parameters according to a predefined set of rules: for example, it checks whether the "temperature" parameter is a floating-point number between 0 and 1, whether the "maximum generation length" is a positive integer, and ensures that all required fields are not empty. Requests that pass validation are routed to the corresponding message queue based on the explicitly specified "model_type" field in their parameters, awaiting further processing.
[0028] By implementing centralized authentication and parameter verification at the front end, common logic that originally needed to be implemented separately by various business systems is unified to the interface layer for processing, which effectively ensures the security and standardization of service calls. Furthermore, by accurately routing requests, it lays the foundation for load balancing and stable operation of different large-scale service pools in the backend.
[0029] S220: Convert the business parameters into the standard format parameters required by the selected target large model, and send the standard format parameters to the target large model.
[0030] According to the implementation method of the unified interface of a large model provided in this application, business parameters are converted into standard format parameters required by the selected target large model, including: mapping the business parameters according to the structured description file pre-bound to the selected target large model to obtain initial standard parameters; for the missing required nodes in the initial standard parameters, performing dynamic completion on the missing required nodes according to the template library corresponding to the business scenario to generate completed standard parameters; and packaging the completed standard parameters according to the serialization protocol specified by the target large model to form standard format parameters.
[0031] Specifically, the structured description file is a JSON-formatted mapping rule that defines the correspondence between business parameters and the API parameters of the target large model. For example, when the business parameter is {"enable": true}, and the target large model "Model Alpha" requires the parameter {"disable": false}, the mapping rule {"sourceField": "enable", "targetField": "disable", "conversionRule": "!sourceValue"} will be executed to perform logical inversion of the boolean value and field name conversion, generating the initial standard parameters. If the target large model "Model Beta" also requires a mandatory "style" parameter that is missing in the initial parameters, the system will match the preset node template from the template library based on the business scenario identifier (such as "creative writing") and automatically complete {"style": "imaginative"}, thereby generating the completed standard parameters. Finally, the parameter object is packaged according to the protocol required by the model to form the final standard format parameters that can be sent.
[0032] Through configurable mapping rules and dynamic completion mechanisms, efficient and accurate conversion of business parameters to interface parameters of different large models is achieved, significantly reducing the development complexity and error risk caused by manual and hard-coded adaptation of different model parameter formats, and improving the success rate and automation level of interface calls.
[0033] According to the implementation method of the unified interface of a large model provided in this application, dynamic completion is performed on the missing required nodes based on the template library corresponding to the business scenario. The method includes: locating the scenario chain template network bound to the business scenario in the template library according to the scenario identifier in the business parameters. The scenario chain template network consists of multiple node templates, and each node template corresponds to a missing field; performing a Boolean operation on the existing field according to the trigger condition expression built into the node template. When the operation result is true, the node template is instantiated immediately to generate a set of candidate values for the field to be completed; performing semantic similarity filtering on the candidate value set to obtain the final completed value; and writing the final completed value into the missing node.
[0034] Specifically, assuming the business scenario is identified as "Customer Service Ticket Summary," the system locates the corresponding scenario chain template network in the template library. This network contains multiple node templates, such as "Summary Style" and "Length Control." For the "Summary Style" node template, its built-in trigger condition expression is (Problem Type == "Technical Fault" && Urgency == "High"). If the existing business parameters meet this condition, the system instantiates the template, generating a set of candidate values: ["Technical Points First", "Points List"]. Subsequently, the system calculates the semantic similarity between these candidate values and the current context, ultimately selecting "Technical Points First" as the final completion value and automatically writing it into the request parameters.
[0035] By using scenario-based template networks and condition-based intelligent instantiation, we achieve accurate and context-aware automatic completion of missing parameters, avoiding model call failures or result deviations caused by missing parameters, and improving the success rate of interface calls and the quality and relevance of returned results.
[0036] According to the implementation method of the unified interface for large models provided in this application, after sending the standard format parameters to the target large model, the method further includes: real-time monitoring of the response status of the target large model; when a response timeout or service unavailability is detected, automatically switching to a backup large model, returning a preset default response, or sending an asynchronous notification including retry suggestions to the business system according to a pre-configured degradation strategy.
[0037] Specifically, after sending the standard format parameters to the target large model, the system starts a timer and listens for its response port. If no response is received within the preset timeout threshold, or if a clear service unavailable status code is received, a degradation strategy is triggered. For example, the strategy can be configured as follows: first, attempt to automatically switch to a backup large model "Model B" with similar capabilities to "Model A" and re-initiate the request; if "Model B" is also unavailable, return a structurally correct but default-valued response from a pre-set default response library, based on the current business scenario, such as returning a "current weather information is temporarily unavailable" response in the "weather query" business scenario; simultaneously, send an asynchronous notification to the callback address of the business system, suggesting that it retry the original request after a specific time.
[0038] By proactively monitoring and employing multi-level degradation strategies, the basic availability and user experience of the business system were effectively ensured when faced with instability in the backend large-scale model service. This prevented the business chain from being interrupted due to a single model failure and enhanced the robustness and fault tolerance of the entire service system.
[0039] S230: Receives response data returned by the target large model based on standard format parameters, and converts the response data into a unified format required by the business system.
[0040] According to the implementation method of the unified interface for large models provided in this application, the response data is converted into a unified format required by the business system, including: unpacking the model-side fields of the response data to obtain the original output of the model; mapping the original output of the model to business fields according to the backfill description file pre-registered with the business system, and folding the multi-valued results according to the principle of minimum information entropy to generate single-valued business fields; and packaging the single-valued business fields according to the unified encapsulation protocol specified by the business system to form a unified format.
[0041] Specifically, upon receiving nested response data from the target model, such as {"choices": [{"message": {"content": "Today's temperature is 25 degrees."}}, {"message": {"content": "Today's weather is sunny."}}]}, the system first unpacks the data to extract the core original model output, which is a list containing two content items. Then, based on the backfill description file pre-registered by the business system, which defines how the "content" field should be mapped to the business field "answer", the system folds the data according to the principle of minimum information entropy, ultimately selecting "Today's temperature is 25 degrees." as the optimal single-value business field. Finally, this field is encapsulated according to the unified protocol required by the business system.
[0042] By unpacking, intelligent mapping, and multi-value folding, diverse and non-standard large model responses are stably and reliably transformed into a unified data structure that can be directly consumed by business systems. This ensures the simplicity and consistency of data processing logic on the business side and improves the efficiency and stability of system integration.
[0043] S240: Return the converted response data to the business system.
[0044] According to the implementation method of a unified interface for a large model provided in this application, before returning the converted response data to the business system, the method further includes: performing differential compression on the response data in the unified format, generating a compressed package and attaching a recovery identifier; writing the compressed package and the recovery identifier together into a cache, and returning a decompressed copy of the response data only when the business system initiates a secondary verification request.
[0045] Specifically, before returning the final uniformly formatted response data to the business system, the system first performs differentiated compression based on its data type and content characteristics. For example, a high compression ratio algorithm is used for text content, while a more efficient binary serialization method is used for structured data, generating a compressed data packet and a unique recovery identifier for this packet. Subsequently, the system stores this compressed packet and the recovery identifier together in a high-speed cache such as Redis, and sets an appropriate expiration time. Under normal circumstances, the system only returns the status information indicating "processing successful" and this recovery identifier to the business system. Only when the business system explicitly initiates a secondary verification request with this identifier for auditing or verification purposes will the system retrieve the corresponding compressed packet from the cache, decompress it, and return a copy of its original data.
[0046] By delaying the return of complete response data, the amount of data returned by the interface under normal circumstances is significantly reduced, alleviating network transmission load and the real-time processing pressure on business systems. Simultaneously, by caching complete data and providing an on-demand retrieval mechanism, the traceability and integrity of data within specific business processes are ensured, achieving a balance between transmission efficiency and data completeness.
[0047] Figure 3This paper clearly elucidates the core working principle and data processing flow of a unified interface method for large models. The core of the entire architecture is an intermediate layer situated between the business system and various large models. The request parameter conversion module is responsible for adapting and translating standardized requests from the business system into parameter formats that can be understood by the downstream specific large models. The converted requests are sent to the request processing module, which acts as a scheduling hub, uniformly handling the communication details with various large models and accurately routing requests to the corresponding target models. When a large model returns a response, the response processing module immediately begins its work. It parses and standardizes the original responses, which vary in format, and finally converts them into a unified format expected by the business system before returning them.
[0048] Through this series of closely linked steps, an abstraction layer was successfully built between the business system and the heterogeneous large model service, thereby shielding the technical differences between different models in terms of interface parameters and response formats. This allows the business system to flexibly call and switch the underlying large model in a consistent and convenient manner, greatly improving development efficiency and system maintainability.
[0049] The implementation apparatus for the unified interface of the large model provided in this application is described below. The implementation apparatus for the unified interface of the large model described below can be referred to in correspondence with the implementation method of the unified interface of the large model described above.
[0050] Figure 4 This is a schematic diagram of the structure of a device for implementing a unified interface for large models provided in an embodiment of the present invention. The structure includes: The request receiving module 410 is used to receive a call request from the business system, wherein the call request includes business parameters; The parameter conversion module 420 is used to convert business parameters into standard format parameters required by the selected target large model, and send the standard format parameters to the target large model; The format unification module 430 is used to receive the response data returned by the target large model and convert the response data into a unified format required by the business system. The data return module 440 is used to return the converted response data to the business system.
[0051] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540. The processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute the implementation method of the unified interface for large models. This implementation is applied to the conversion middleware layer, which connects the business system and multiple target large models. The middleware layer includes: receiving a call request from the business system, wherein the call request includes business parameters; converting the business parameters into standard format parameters required by the selected target large model and sending the standard format parameters to the target large model; receiving response data returned by the target large model based on the standard format parameters and converting the response data into a unified format required by the business system; and returning the converted response data to the business system.
[0052] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0053] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the implementation method of the unified interface for large models provided by the above methods, and apply it to the conversion middleware layer. The conversion middleware layer is a communication connection between the business system and multiple target large models, including: receiving a call request from the business system, wherein the call request includes business parameters; converting the business parameters into standard format parameters required by the selected target large model, and sending the standard format parameters to the target large model; receiving response data returned by the target large model based on the standard format parameters, and converting the response data into a unified format required by the business system; and returning the converted response data to the business system.
[0054] Furthermore, this application also provides a computer-readable storage medium, which includes a stored program. When the program runs, it executes the implementation method of the unified interface for large models provided by the methods described above, applied to a conversion intermediate layer. This intermediate layer communicates between a business system and multiple target large models, including: receiving a call request from the business system, wherein the call request includes business parameters; converting the business parameters into standard format parameters required by the selected target large model, and sending the standard format parameters to the target large model; receiving response data returned by the target large model based on the standard format parameters, and converting the response data into a unified format required by the business system; and returning the converted response data to the business system.
[0055] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0056] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, 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 can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0057] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for implementing a unified interface for a large model, characterized in that, The method, applied to a conversion intermediate layer that provides communication connections between a business system and multiple target large models, includes: Receive a call request from the business system; wherein the call request includes business parameters; The business parameters are converted into standard format parameters required by the selected target large model, and the standard format parameters are sent to the target large model; Receive the response data returned by the target large model based on the standard format parameters, and convert the response data into a unified format required by the business system; The converted response data is returned to the business system.
2. The method for implementing the unified interface for large models according to claim 1, characterized in that, Receiving a call request from the business system includes: The received call request is authenticated via an interface, including verifying the application programming interface key and access permission level of the business system. The authentication-enabled call request is validated for parameter validity. The validation includes checking whether the data type, field integrity, and numerical range of the business parameters conform to predefined rules. The valid call requests are distributed to the corresponding target large model processing queue based on the model type identifier in the business parameters.
3. The method for implementing the unified interface for large models according to claim 1, characterized in that, Convert business parameters into the standard format required for the selected target large model, including: Based on the structured description file pre-bound to the selected target large model, the business parameters are mapped to obtain the initial standard parameters; For the missing required nodes in the initial standard parameters, dynamic completion is performed on the missing required nodes according to the template library corresponding to the business scenario to generate the completed standard parameters; The completed standard parameters are packaged according to the serialization protocol specified by the target large model to form standard format parameters.
4. The method for implementing the unified interface for large models according to claim 3, characterized in that, The step of dynamically completing missing required nodes based on a template library corresponding to the business scenario includes: Based on the scenario identifier in the business parameters, locate the scenario chain template network bound to the business scenario in the template library. The scenario chain template network consists of multiple node templates, and each node template corresponds to a missing field. Based on the trigger condition expression built into the node template, a Boolean operation is performed on the existing field. When the operation result is true, the node template is instantiated immediately to generate a set of candidate values for the field to be completed. The candidate value set is filtered by semantic similarity to obtain the final completed value; Write the final completion value into the missing node.
5. The method for implementing the unified interface for large models according to claim 1, characterized in that, The process of converting the response data into a unified format required by the business system includes: The response data is unpacked from the model-side fields to obtain the original model output; Based on the backfill description file pre-registered with the business system, the original output of the model is mapped to business fields, and multi-valued results are folded according to the principle of minimum information entropy to generate single-valued business fields; Single-value business fields are packaged according to the unified encapsulation protocol specified by the business system to form a unified format.
6. The method for implementing the unified interface for large models according to claim 1, characterized in that, After sending the standard format parameters to the target large model, the following is also included: Real-time monitoring of the response status of the target large model; When a response timeout or service unavailability is detected, the system will automatically switch to a backup large model, return a pre-configured default response, or send an asynchronous notification to the business system including retry suggestions, based on the pre-configured degradation strategy.
7. The method for implementing a unified interface for large models according to any one of claims 1 to 6, characterized in that, Before returning the transformed response data to the business system, the following steps are also included: Perform differential compression on the response data in the uniform format, generate a compressed package and attach a recovery identifier; The compressed package and recovery identifier are written together into the cache, and the decompressed response data copy is returned only when the business system initiates a secondary verification request.
8. A device for implementing a unified interface for a large model, characterized in that, include: The request receiving module is used to receive a call request from the business system, wherein the call request includes business parameters; The parameter conversion module is used to convert the business parameters into standard format parameters required by the selected target large model, and send the standard format parameters to the target large model; The format unification module is used to receive the response data returned by the target large model and convert the response data into a unified format required by the business system. The data return module is used to return the converted response data to the business system.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Automatic checking and correcting method for Restful interface return value
CN113515287A
Model calling method and device, electronic equipment and storage medium
CN117973523A
Large model API aggregation calling method, device and system
CN118916026A
KR20250078263A