Text processing method and device, equipment, storage medium and product

By introducing a gateway layer between the client and the server to handle calls to the Model Context Protocol and the Open Application Programming Interface, the problem of high client development costs is solved, and secure and efficient interface calls are achieved.

CN121934918APending Publication Date: 2026-04-28杭州三六零亿方智能有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
杭州三六零亿方智能有限公司
Filing Date
2025-11-11
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

When calling MCP and OpenAPI services from the client, the development cost is high, requiring the client to encapsulate multiple protocol interfaces.

Method used

By setting up a gateway layer between the client and the server, the gateway layer responds to the client's Hypertext Transfer Protocol (HTTP) requests, determines the target server, and receives the feedback results. The client only needs to encapsulate the HTTP interface, while the gateway layer handles the calls to the Model Context Protocol (MCP) and the Open Application Programming Interface (API).

Benefits of technology

It reduces client-side development costs, improves the security and efficiency of API calls, and simplifies the development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121934918A_ABST
    Figure CN121934918A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of data processing, and discloses a text processing method and device, equipment, a storage medium and a product. According to the application, the gateway layer is arranged between the client and the server, the tool calling request initiated by the client through the hypertext transfer protocol is responded through the gateway layer, the client only needs to package the interface corresponding to the hypertext transfer protocol, and then the target server corresponding to the tool calling request is determined; according to the method, the server supporting the model context protocol and the open application programming interface server can be called, then the tool calling result fed back by the tool calling request received by the target server is received, and the final text processing result is generated based on the tool calling result through the large language model in the client, so that the development cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a text processing method, apparatus, device, storage medium, and product. Background Technology

[0002] Currently, when using the Model Context Protocol (MCP) service, clients need to encapsulate the corresponding MCP interface to adapt to business / specific scenarios. Similarly, when using the Open API service, clients need to encapsulate the corresponding Hypertext Transfer Protocol (HTTP) interface. Therefore, if a client needs to call either the MCP or OpenAPI service, it must encapsulate both the MCP and HTTP interfaces, resulting in high development costs. Summary of the Invention

[0003] The main purpose of this application is to provide a text processing method, apparatus, device, storage medium, and product, which aims to solve the technical problem of reducing development costs when clients call MCP services and OpenAPI services.

[0004] To achieve the above objectives, this application provides a text processing method applied to a gateway layer, the text processing method comprising the following steps: In response to a tool invocation request initiated by a client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tools required by the client when invoking the large language model; Determine the target server corresponding to the tool invocation request, wherein the target server includes a server that supports the Model Context Protocol and an Open Application Programming Interface server; The system receives the tool invocation result from the target server based on the tool invocation request and sends the tool invocation result to the client.

[0005] Optionally, determining the target server corresponding to the tool invocation request includes: Determine the tool name in the tool invocation request; Identify the first function library in the server that supports the Model Context Protocol and the second function library in the server that supports the Open Application Programming Interface; The tool name is matched with the first function tool library and the second function tool library respectively, and the target server corresponding to the tool call request is determined according to the matching result.

[0006] Optionally, the step of matching the tool name with the first function tool library and the second function tool library respectively, and determining the target server corresponding to the tool call request based on the matching results, includes: The tool name is matched with the first function tool library to obtain the first matching result; The tool name is matched with the second function tool library to obtain a second matching result; If both the first and second matching results are successful, determine the tool parameters in the tool invocation request; The target server corresponding to the tool call request is determined based on the tool parameters.

[0007] Optionally, the response to the tool invocation request initiated by the client via the Hypertext Transfer Protocol further includes: Perform security verification on the client and obtain the security verification result; If the security verification result is successful, sensitive words are filtered for the function parameters corresponding to the function tools required by the client when calling the large language model, and the filtered parameters are obtained. Accordingly, the response to a tool invocation request initiated by the client via the Hypertext Transfer Protocol includes: In response to a tool call request initiated by the client via the Hypertext Transfer Protocol, the tool call request is generated based on the function tools required by the client when calling the large language model and the filtered parameters.

[0008] Optionally, the step of performing security verification on the client and obtaining a security verification result includes: The authentication result of the client is determined based on the application programming interface key corresponding to the client. If the authentication result is successful, determine the number of times the client makes interface calls; If the number of times the interface is called meets the preset requirement, the security verification result is determined to be successful.

[0009] Optionally, if the security verification result is successful, the step of filtering sensitive words on the function parameters corresponding to the function tools required by the client when calling the large language model to obtain the filtered parameters includes: If the security verification result is successful, the client role is determined based on the application programming interface key; The sensitive word filtering strategy is determined based on the client role. Based on the sensitive word filtering strategy, the function parameters corresponding to the function tools required by the client when calling the large language model are filtered for sensitive words, and the filtered parameters are obtained.

[0010] Furthermore, to achieve the above objectives, this application also provides a text processing method applied to a client, the text processing method comprising the following steps: Upon receiving a text processing request from a user, the system selects the corresponding function tool from the preset function tool code using a large language model. The function tool generates a tool call request and sends the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request; The gateway layer receives the tool call result based on the tool call request, and generates the text processing result corresponding to the text processing request based on the tool call result using the large language model.

[0011] Optionally, upon receiving a text processing request from a user, selecting the corresponding function tool from a preset function tool code using a large language model includes: Upon receiving a text processing request from a user, the system retrieves the preset function tool structure set by the gateway layer. The preset function tool structure is obtained by format conversion based on the preset function tool list. The preset function tool list includes a first function tool library in the server that supports the model context protocol and a second function tool library in the open application programming interface server. The function tool corresponding to the text processing request is selected from the preset function tool structure using a large language model.

[0012] Optionally, the step of generating a tool invocation request based on the function tool and sending the tool invocation request to the gateway layer via the Hypertext Transfer Protocol includes: The function parameters corresponding to the text processing request are determined based on the function tool. The function tool and the function parameter generation tool are invoked according to the request; The tool invocation request is sent to the gateway layer via the Hypertext Transfer Protocol.

[0013] Optionally, receiving the tool invocation result fed back by the gateway layer according to the tool invocation request, and generating the text processing result corresponding to the text processing request based on the tool invocation result through the large language model, includes: The gateway layer receives the tool call result based on the tool call request, and the large language model determines the lexical units based on the tool call result. By integrating the lexical units using the large language model, the text processing result corresponding to the text processing request is obtained.

[0014] Optionally, receiving the tool invocation result fed back by the gateway layer according to the tool invocation request, and determining the lexical units based on the tool invocation result through the large language model, includes: Receive the tool call result fed back by the gateway layer according to the tool call request, and extract key information from the tool call result through the large language model; The user intent is determined based on the text processing request, and the key information is adjusted according to the user intent to obtain the adjusted information; The adjusted information is sorted to obtain the information sorting result; Based on the sorting results of the information, select lexical units from the adjusted information.

[0015] Furthermore, to achieve the above objectives, this application also provides a text processing apparatus applied at a gateway layer, the text processing apparatus comprising: The request-response module is used to respond to a tool invocation request initiated by the client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tool required by the client when invoking the large language model; The server-side determination module is used to determine the target server corresponding to the tool invocation request, wherein the target server includes a server that supports the model context protocol and an open application programming interface server; The result sending module is used to receive the tool call result fed back by the target server according to the tool call request, and send the tool call result to the client.

[0016] Optionally, the server-side determination module is further configured to determine the tool name in the tool call request; determine the first function tool library in the server supporting the Model Context Protocol and the second function tool library in the Open Application Programming Interface server; match the tool name with the first function tool library and the second function tool library respectively, and determine the target server corresponding to the tool call request based on the matching result.

[0017] Optionally, the server-side determination module is further configured to match the tool name with the first function tool library to obtain a first matching result; match the tool name with the second function tool library to obtain a second matching result; if the first matching result is a successful match and the second matching result is a successful match, determine the tool parameters in the tool call request; and determine the target server corresponding to the tool call request based on the tool parameters.

[0018] Optionally, the request-response module is further configured to perform security verification on the client and obtain a security verification result; if the security verification result is successful, perform sensitive word filtering on the function parameters corresponding to the function tools required by the client when calling the large language model, and obtain the filtered parameters; respond to the tool call request initiated by the client through the Hypertext Transfer Protocol, the tool call request being generated based on the function tools required by the client when calling the large language model and the filtered parameters.

[0019] Furthermore, to achieve the above objectives, this application also provides a text processing apparatus for use on a client side, the text processing apparatus comprising: The tool selection module is used to select the function tool corresponding to the text processing request from the preset function tool code through a large language model when a text processing request is received from a user. The request generation module is used to generate a tool call request based on the function tool, and send the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request; The result generation module is used to receive the tool call result fed back by the gateway layer according to the tool call request, and generate the text processing result corresponding to the text processing request based on the tool call result through the large language model.

[0020] Optionally, the tool selection module is further configured to, upon receiving a text processing request sent by a user, obtain a preset function tool structure set by the gateway layer. The preset function tool structure is obtained by format conversion based on a preset function tool list, which includes a first function tool library in the server supporting the model context protocol and a second function tool library in the open application programming interface server. The module then selects the function tool corresponding to the text processing request from the preset function tool structure using a large language model.

[0021] In addition, to achieve the above objectives, this application also proposes a text processing device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the text processing method described above.

[0022] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the text processing method described above.

[0023] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the text processing method described above.

[0024] This application responds to tool call requests initiated by clients via the Hypertext Transfer Protocol (HTTP) through a gateway layer. The tool call request is generated based on the function tools required by the client when invoking a large language model. Then, the target server corresponding to the tool call request is determined, including servers supporting the Model Context Protocol (MGP) and Open Application Programming Interface (API) servers. The application then receives the tool call result from the target server based on the tool call request and sends the result back to the client. By setting up a gateway layer between the client and server, and responding to the client's tool call request via the gateway layer, the client only needs to encapsulate the corresponding HTTP interface, determine the target server corresponding to the tool call request, be able to invoke the server supporting the MGP and the API server, receive the tool call result from the target server, and then generate the final text processing result based on the tool call result using the large language model in the client. This reduces development costs. Attached Figure Description

[0025] 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.

[0026] 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.

[0027] Figure 1 This is a flowchart illustrating the first embodiment of the text processing method of this application; Figure 2 This is a flowchart illustrating the second embodiment of the text processing method of this application; Figure 3 This is a flowchart illustrating the third embodiment of the text processing method of this application; Figure 4 This is a schematic diagram of the overall process of one embodiment of the text processing method of this application; Figure 5 This is a structural block diagram of the first embodiment of the text processing apparatus of this application; Figure 6 This is a structural block diagram of the third embodiment of the text processing apparatus of this application; Figure 7 This is a schematic diagram of the structure of a text processing device in the hardware operating environment involved in the embodiments of this application.

[0028] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0029] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0030] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0031] This application provides a text processing method applied to a gateway layer, as described in the embodiments below. Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the text processing method of this application.

[0032] In this embodiment, the text processing method includes the following steps: Step S10: In response to a tool invocation request initiated by the client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tools required by the client when invoking the large language model.

[0033] It should be noted that the execution entity in this embodiment can be a gateway layer. The gateway layer can be set between the client and the server and can be used to forward information sent by the client to the server so that the server can generate results based on the information and forward the results received from the server to the client.

[0034] Understandably, the client can encapsulate the Hypertext Transfer Protocol (HTTP) interface. The client can then initiate tool call requests to the gateway layer via HTTP. These requests are generated based on the function tools required by the client when calling the Large Language Model (LLM). The function tool can be a function name; for example, if a user asks "What's the weather like in Beijing today?", the LLM can call the function tool `get_weather(location)`, which can be a function related to obtaining the weather. A Large Language Model (LLM) is a deep learning model trained on a large amount of text data. Through the LLM, the results of the user's text processing requests can be generated.

[0035] Step S20: Determine the target server corresponding to the tool call request, wherein the target server includes a server that supports the Model Context Protocol and an Open Application Programming Interface server.

[0036] It should be understood that the target server may include a server that supports the Model Context Protocol (MCP server) and an Open Application Programming Interface (OpenAPI server). The gateway layer can send messages to the MCP server via the Model Context Protocol or to the OpenAPI server via the Hypertext Transfer Protocol. Both the MCP server and the OpenAPI server can be cloud servers.

[0037] Optionally, in order to accurately determine the target server corresponding to the tool call request, step S20 includes: determining the tool name in the tool call request; determining the first function tool library in the server supporting the Model Context Protocol and the second function tool library in the Open Application Programming Interface server; matching the tool name with the first function tool library and the second function tool library respectively, and determining the target server corresponding to the tool call request based on the matching results.

[0038] Understandably, this embodiment can determine the tool name, i.e., the function name, in the tool call request. It also determines the first function tool library in the MCP server and the second function tool library in the OpenAPI server. The first function tool library may include all application-related function tools that can be called by the MCP server, and the second function tool library may include all function tools that can be called by the OpenAPI server.

[0039] It should be understood that the tool name can be matched with the first function library, and the tool name can be matched with the second function library. If the tool name matches the first function library, the MCP server can be used as the target server. If the tool name matches the second function library, the OpenAPI server can be used as the target server.

[0040] Optionally, the step of matching the tool name with the first function tool library and the second function tool library respectively, and determining the target server corresponding to the tool call request based on the matching results, includes: matching the tool name with the first function tool library to obtain a first matching result; matching the tool name with the second function tool library to obtain a second matching result; if both the first and second matching results are successful, determining the tool parameters in the tool call request; and determining the target server corresponding to the tool call request based on the tool parameters.

[0041] Understandably, the tool name can be matched with the first function library to obtain the first matching result, and the tool name can be matched with the second function library to obtain the second matching result. If the first matching result is a successful match and the second matching result is a failed match, the MCP server can be used as the target server; if the first matching result is a failed match and the second matching result is a successful match, the OpenAPI server can be used as the target server.

[0042] In practical implementation, if both the first and second matching results are successful, it means that both the MCP server and the OpenAPI server can be used as the target server. Furthermore, one server can be selected as the target server. Specifically, the tool parameters in the tool call request can be determined, and the target server can be determined based on the tool parameters. For example, if the tool name is "Get Weather" and the tool parameters are "Time: Today's various moments" and "Location: Beijing", since it is necessary to obtain the weather in Beijing at various moments today, the OpenAPI server may only be able to obtain the weather trend in Beijing today and cannot accurately obtain the weather at various moments. Therefore, the MCP server can be used as the target server.

[0043] Step S30: Receive the tool call result fed back by the target server according to the tool call request, and send the tool call result to the client.

[0044] Understandably, the gateway layer can receive tool call results from the target server based on the tool call request. These results can be the outcome of a function call on the target server; for example, calling a weather function might result in a result like "sunny," "cloudy turning sunny," etc. When the target server is an MCP server, the tool call results can be received via the Model Context Protocol (MTP). When the target server is an OpenAPI server, the results can be received via the Hypertext Transfer Protocol (HTTP) and then sent to the client via HTTP.

[0045] This embodiment responds to tool call requests initiated by clients via the Hypertext Transfer Protocol (HTTP) through a gateway layer. The tool call request is generated based on the function tools required by the client when invoking the large language model. Then, the target server corresponding to the tool call request is determined. The target server includes a server supporting the Model Context Protocol (MGP) and an Open Application Programming Interface (API) server. The tool call result is then received from the target server based on the tool call request and sent back to the client. This embodiment reduces development costs by setting up a gateway layer between the client and the server, responding to the client's HTTP request through the gateway layer. The client only needs to encapsulate the corresponding HTTP interface, determine the target server for the tool call request, be able to invoke the server supporting the MGP and the API server, receive the tool call result from the target server, and then generate the final text processing result based on the tool call result using the large language model in the client.

[0046] refer to Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of the text processing method of this application.

[0047] Based on the first embodiment described above, in this embodiment, before step S10, the method further includes: Step S01: Perform security verification on the client and obtain the security verification result.

[0048] It should be understood that this embodiment can perform security verification on the client and obtain the security verification result, thereby determining whether the client can call the server to perform text processing.

[0049] Optionally, in order to effectively perform security verification on the client, step S01 includes: determining the authentication result corresponding to the client based on the application programming interface key corresponding to the client; if the authentication result is successful, determining the number of interface calls of the client; if the number of interface calls meets a preset number requirement, determining that the security verification result is successful.

[0050] Understandably, an Application Programming Interface Key (API Key) is a unique string used for authentication and authorization. The client's identity can be determined based on the API Key corresponding to the client, verifying whether the client is a legitimate client that has enabled the service. If so, the authentication result is successful.

[0051] In practical implementation, once the client's authentication is successful, the number of times the client can call the interface (i.e., the number of OpenAPI calls) can be determined for billing or quota management. If the number of interface calls meets a preset requirement, the security verification result is determined to be successful, indicating that the client can continue to call the server. The preset requirement can be an upper limit on the number of times the client can call the server, such as 5 or 6 times.

[0052] Step S02: If the security verification result is successful, perform sensitive word filtering on the function parameters corresponding to the function tools required by the client when calling the large language model, and obtain the filtered parameters.

[0053] Understandably, in order to further improve the security of tool call requests received by the server when the security verification result is passed, this embodiment can filter the function parameters corresponding to the function tools required by the client when calling the large language model, so as to avoid transmitting sensitive words to the server and obtain the filtered parameters.

[0054] Optionally, in order to accurately filter sensitive words for function parameters, step S02 includes: if the security verification result is successful, determining the client role based on the application programming interface key; determining a sensitive word filtering strategy based on the client role; and filtering sensitive words for the function parameters corresponding to the function tools required by the client when calling the large language model according to the sensitive word filtering strategy, thereby obtaining the filtered parameters.

[0055] It should be understood that, if the security verification result is successful, the client role can be determined based on the application programming interface key. The client role may include administrator, regular user, VIP user, etc. Then, a sensitive word filtering strategy is determined based on the client role. For example, when the client role is administrator, the sensitive word filtering strategy may be to pre-set restricted words, such as auditing terms; when the client role is regular user, the sensitive word filtering strategy may be to enable strict sensitive word filtering; when the client role is VIP user, the sensitive word filtering strategy may be to use a moderate filtering strength. In one feasible embodiment, sensitive words can be set according to the type of application being called, such as financial sensitive words, social media sensitive words, etc. This embodiment can filter function parameters based on pre-set sensitive words and a sensitive word filtering strategy, where the sensitive word filtering strategy can be the sensitivity word filtering strength, to obtain the filtered parameters.

[0056] Accordingly, step S10 includes: responding to a tool call request initiated by the client via the Hypertext Transfer Protocol, the tool call request being generated based on the function tools required by the client when calling the large language model and the filtered parameters.

[0057] In practice, after filtering the function parameters for sensitive words and obtaining the filtered parameters, the tool call request can include the function tool and the filtered parameters.

[0058] This embodiment performs security verification on the client, obtains a security verification result, and if the verification passes, filters the function parameters corresponding to the function tools required by the client when calling the large language model for sensitive words. The filtered parameters are then obtained, and the embodiment responds to the tool call request initiated by the client via the Hypertext Transfer Protocol. The tool call request is generated based on the function tools required by the client when calling the large language model and the filtered parameters. This embodiment improves the security of interface calls by performing security verification on the client and further enhances the security of subsequent tool calls by filtering function parameters for sensitive words, resulting in a modified tool call request.

[0059] This application provides a text processing method applied to a client, as shown in the embodiments below. Figure 3 , Figure 3 This is a flowchart illustrating the third embodiment of the text processing method of this application.

[0060] In this embodiment, the text processing method includes the following steps: Step S40: Upon receiving a text processing request from a user, select the function tool corresponding to the text processing request from the preset function tool code using a large language model.

[0061] It should be noted that the execution entity in this embodiment can be a client. The client may contain a large language model, which can generate the text processing result corresponding to the text processing request sent by the user and display the text processing result to the user.

[0062] Understandably, when a client receives a text processing request from a user, it can select the corresponding function tool from the preset function tool library using a large language model. The preset function tool code can be the function tool code corresponding to the MCP server and the OpenAPI server.

[0063] Optionally, in order to obtain the preset function tool code, step S40 includes: upon receiving a text processing request sent by a user, obtaining the preset function tool structure set by the gateway layer, the preset function tool structure being generated based on a preset function tool list, the preset function tool list including a first function tool library in the server supporting the model context protocol and a second function tool library in the open application programming interface server; and selecting the function tool corresponding to the text processing request from the preset function tool structure through a large language model.

[0064] It should be understood that upon receiving a text processing request from a user, the pre-defined function tool code set by the gateway layer can be obtained. Specifically, the gateway layer retrieves the function tool structures corresponding to the MCP server and OpenAPI server, which can be represented using OpenAI's tool structure. The pre-defined function tool structure is obtained by format conversion based on a list of pre-defined function tools. This list may include several function tools, and each function tool can be converted into an OpenAI tool structure to obtain the pre-defined function tool structure.

[0065] Understandably, the list of preset function tools may include a first function tool library in the server supporting the model context protocol and a second function tool library in the open application programming interface server. Since the large model can recognize the tool structure of OpenAI, this embodiment inputs the text processing request and the preset function tool structure into the large language model, and can output the function tool corresponding to the text processing request.

[0066] Step S50: Generate a tool call request based on the function tool, and send the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request.

[0067] It should be understood that a tool invocation request may contain a function tool corresponding to a text processing request. The client can send the tool invocation request to the gateway layer via the Hypertext Transfer Protocol. The gateway layer can determine the target server corresponding to the tool invocation request, receive the tool invocation result from the target server based on the tool invocation request, and transmit the tool invocation result to the client.

[0068] Optionally, the step of generating a tool call request based on the function tool and sending the tool call request to the gateway layer via the Hypertext Transfer Protocol includes: determining the function parameters corresponding to the text processing request based on the function tool; generating a tool call request based on the function tool and the function parameters; and sending the tool call request to the gateway layer via the Hypertext Transfer Protocol.

[0069] In the specific implementation, after determining the function tool, the corresponding function parameters can be determined. For example, if the function tool is `get_weather(city)`, the function parameters could be cities such as Beijing. A tool invocation request is then generated based on the function tool and its parameters, and the client's tool invocation request is sent to the gateway layer via the Hypertext Transfer Protocol. The tool invocation request can include both the function tool and its parameters.

[0070] Step S60: Receive the tool call result fed back by the gateway layer according to the tool call request, and generate the text processing result corresponding to the text processing request based on the tool call result through the large language model.

[0071] It should be understood that the client can receive the tool call results fed back by the gateway layer, and generate the text processing results corresponding to the text processing request based on the tool call results through the large language model. The tool call results can be integrated to obtain the text processing results. For example, if the tool call result is "sunny", the text processing result can be "Today's weather in Beijing is sunny".

[0072] Optionally, in order to accurately obtain the text processing result, step S60 includes: receiving the tool call result fed back by the gateway layer according to the tool call request, and determining the lexical units based on the tool call result through the large language model; integrating the lexical units through the large language model to obtain the text processing result corresponding to the text processing request.

[0073] Understandably, after the client receives the tool call result from the gateway layer, it can determine the lexical units based on the tool call result through the large language model. The lexical units can be words that make up the text processing result to be displayed to the user. Then, the large language model integrates the lexical units to obtain the text processing result corresponding to the text processing request.

[0074] Optionally, to accurately obtain lexical units, the step of receiving the tool call result fed back by the gateway layer according to the tool call request, and determining lexical units based on the tool call result using the large language model, includes: receiving the tool call result fed back by the gateway layer according to the tool call request, and extracting key information from the tool call result using the large language model; determining the user intent according to the text processing request, and adjusting the key information according to the user intent to obtain adjusted information; sorting the adjusted information to obtain an information sorting result; and selecting lexical units from the adjusted information according to the information sorting result.

[0075] It should be understood that after the large language model receives the tool call results, it can first extract key information from the results, such as location: Beijing, temperature: 28 degrees Celsius, weather: sunny. Then, the large language model determines the user's intent based on the text processing request. For example, if the text processing request is "What will the weather be like in Beijing tomorrow?", the user's explicit intent is to obtain weather information, and their implicit intent (inference) is that they might go out, are concerned about whether they need an umbrella, and whether it's suitable for outdoor activities. Based on the user's intent, the key information can be adjusted by deleting unnecessary information and adding appropriate content, such as weather, sunny, suitable, and outdoor activities. The adjusted information is then sorted, prioritizing explicit intents and then implicit intents. For example, the order from highest to lowest priority could be: weather (sunny), temperature (28 degrees Celsius), location (Beijing), time (tomorrow), and suggestion (suitable for going out). Finally, based on the sorting result, lexical units are selected sequentially from the adjusted information. Lexical units may include: Beijing, tomorrow, weather, sunny, temperature, 28 degrees Celsius, very suitable, and outdoor activities. The final integrated text processing result is: "Beijing will have sunny skies and a temperature of 28 degrees Celsius tomorrow, perfect for outdoor activities!" In the specific implementation, refer to Figure 4 , Figure 4 This is a schematic diagram of the overall flow of an embodiment of the text processing method of this application, as shown below. Figure 4As shown, User sends a text processing request (chat) to the Large Language Model (LLM). The LLM selects a function tool (tool_calls) from the preset function tool code (bind_tools). bind_tools can contain tool1, tool2, tool3, etc. Authentication is performed by the authentication module auth in the gateway layer based on the API key. After successful authentication, the tool call request is sent to the gateway layer service-mcp via the Hypertext Transfer Protocol (HTTP). The gateway layer determines the target server corresponding to the tool call request. The target servers include servers supporting the Model Context Protocol (MCP) (mcp-servers) and open API servers (open-api-servers). The gateway layer sends the corresponding tool call request to the MCP servers via the Model Context Protocol (MCP) or to the open API servers via HTTP. The gateway layer then receives the tool call result (resp) from the target server and sends it to the LLM in the client. The LLM generates a text processing response and sends it to the user.

[0076] This embodiment, upon receiving a text processing request from a user, uses a large language model to select the corresponding function tool from a pre-defined set of function tool codes. It then generates a tool invocation request based on the function tool and sends it to the gateway layer via the Hypertext Transfer Protocol (HTTP). The gateway layer then determines the target server for the tool invocation request, receives the tool invocation result from the target server, and uses the large language model to generate the corresponding text processing result. This efficient approach reduces development costs. The client only needs to encapsulate the HTTP interface, receive the tool invocation result from the gateway layer, and generate the text processing result based on the result, thus reducing overall development costs.

[0077] Reference Figure 5 , Figure 5 This is a structural block diagram of the first embodiment of the text processing device of this application.

[0078] like Figure 5As shown, the text processing apparatus proposed in this application embodiment is applied to the gateway layer and includes: The request-response module 10 is used to respond to a tool call request initiated by the client via the Hypertext Transfer Protocol, wherein the tool call request is generated based on the function tool required by the client when calling the large language model; The server determination module 20 is used to determine the target server corresponding to the tool call request, wherein the target server includes a server that supports the model context protocol and an open application programming interface server; The result sending module 30 is used to receive the tool call result fed back by the target server according to the tool call request, and send the tool call result to the client.

[0079] This embodiment responds to tool call requests initiated by clients via the Hypertext Transfer Protocol (HTTP) through a gateway layer. The tool call request is generated based on the function tools required by the client when invoking the large language model. Then, the target server corresponding to the tool call request is determined. The target server includes a server supporting the Model Context Protocol (MGP) and an Open Application Programming Interface (API) server. The tool call result is then received from the target server based on the tool call request and sent back to the client. This embodiment reduces development costs by setting up a gateway layer between the client and the server, responding to the client's HTTP request through the gateway layer. The client only needs to encapsulate the corresponding HTTP interface, determine the target server for the tool call request, be able to invoke the server supporting the MGP and the API server, receive the tool call result from the target server, and then generate the final text processing result based on the tool call result using the large language model in the client.

[0080] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this application. In practical applications, those skilled in the art can select some or all of it to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.

[0081] In addition, for technical details not described in detail in this embodiment, please refer to the text processing methods provided in any embodiment of this application, which will not be repeated here.

[0082] Based on the first embodiment of the text processing apparatus described in this application, a second embodiment of the text processing apparatus of this application is proposed.

[0083] In this embodiment, the server-side determination module 20 is further configured to determine the tool name in the tool call request; determine the first function tool library in the server supporting the Model Context Protocol and the second function tool library in the Open Application Programming Interface server; match the tool name with the first function tool library and the second function tool library respectively, and determine the target server corresponding to the tool call request based on the matching result.

[0084] Furthermore, the server-side determination module 20 is also configured to match the tool name with the first function tool library to obtain a first matching result; match the tool name with the second function tool library to obtain a second matching result; determine the tool parameters in the tool call request if both the first and second matching results are successful; and determine the target server corresponding to the tool call request based on the tool parameters.

[0085] Furthermore, the request response module 10 is also used to perform security verification on the client and obtain a security verification result; if the security verification result is successful, sensitive word filtering is performed on the function parameters corresponding to the function tools required by the client when calling the large language model, and the filtered parameters are obtained; in response to the tool call request initiated by the client through the Hypertext Transfer Protocol, the tool call request is generated based on the function tools required by the client when calling the large language model and the filtered parameters.

[0086] Furthermore, the request response module 10 is also used to determine the authentication result corresponding to the client based on the application programming interface key corresponding to the client; if the authentication result is successful, determine the number of interface calls of the client; if the number of interface calls meets the preset number requirement, determine that the security verification result is successful.

[0087] Furthermore, the request response module 10 is also configured to, if the security verification result is successful, determine the client role based on the application programming interface key; determine a sensitive word filtering strategy based on the client role; and perform sensitive word filtering on the function parameters corresponding to the function tools required by the client when calling the large language model according to the sensitive word filtering strategy, so as to obtain the filtered parameters.

[0088] Other embodiments or specific implementations of the text processing apparatus of this application can be found in the first and second method embodiments described above, and will not be repeated here.

[0089] Reference Figure 6 , Figure 6 This is a structural block diagram of the third embodiment of the text processing apparatus of this application.

[0090] like Figure 6 As shown, the text processing apparatus proposed in this application embodiment is applied to a client and includes: The tool selection module 40 is used to select the function tool corresponding to the text processing request from the preset function tool code through a large language model when a text processing request is received from the user. The request generation module 50 is used to generate a tool call request based on the function tool, and send the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request; The result generation module 60 is used to receive the tool call result fed back by the gateway layer according to the tool call request, and generate the text processing result corresponding to the text processing request based on the tool call result through the large language model.

[0091] This embodiment, upon receiving a text processing request from a user, uses a large language model to select the corresponding function tool from a pre-defined set of function tool codes. It then generates a tool invocation request based on the function tool and sends it to the gateway layer via the Hypertext Transfer Protocol (HTTP). The gateway layer then determines the target server for the tool invocation request, receives the tool invocation result from the target server, and uses the large language model to generate the corresponding text processing result. This efficient approach reduces development costs. The client only needs to encapsulate the HTTP interface, receive the tool invocation result from the gateway layer, and generate the text processing result based on the result, thus reducing overall development costs.

[0092] Based on the third embodiment of the text processing apparatus described above, a fourth embodiment of the text processing apparatus of this application is proposed.

[0093] In this embodiment, the tool selection module 40 is further configured to, upon receiving a text processing request sent by a user, obtain a preset function tool structure set by the gateway layer. The preset function tool structure is obtained by format conversion based on a preset function tool list, which includes a first function tool library in the server supporting the model context protocol and a second function tool library in the open application programming interface server. The module then selects the function tool corresponding to the text processing request from the preset function tool structure using a large language model.

[0094] Furthermore, the request generation module 50 is also used to determine the function parameters corresponding to the text processing request based on the function tool; generate a tool invocation request based on the function tool and the function parameters; and send the tool invocation request to the gateway layer via the Hypertext Transfer Protocol.

[0095] Furthermore, the result generation module 60 is also used to receive the tool call result fed back by the gateway layer according to the tool call request, and determine the lexical units based on the tool call result through the large language model; and integrate the lexical units through the large language model to obtain the text processing result corresponding to the text processing request.

[0096] Furthermore, the result generation module 60 is also used to receive the tool call result fed back by the gateway layer according to the tool call request, and extract key information from the tool call result through the large language model; determine the user intent according to the text processing request, and adjust the key information according to the user intent to obtain the adjusted information; sort the adjusted information to obtain the information sorting result; and select lexical units from the adjusted information according to the information sorting result.

[0097] Other embodiments or specific implementations of the text processing device of this application can be found in the third method embodiment described above, and will not be repeated here.

[0098] This application provides a text processing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the text processing method in Embodiment 1 above.

[0099] The following is for reference. Figure 7The diagram illustrates a structural schematic of a text processing device suitable for implementing embodiments of this application. The text processing device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The text processing device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0100] like Figure 7 As shown, the text processing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the text processing device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the text processing device to communicate wirelessly or wiredly with other devices to exchange data. Although the figures show text processing devices with various systems, it should be understood that it is not required to implement or possess all of the systems shown. More or fewer systems may be implemented alternatively.

[0101] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0102] The text processing device provided in this application, employing the text processing method described in the above embodiments, can solve the technical problem of reducing development costs when clients call MCP services and OpenAPI services. Compared with the prior art, the beneficial effects of the text processing device provided in this application are the same as those of the text processing method provided in the above embodiments, and other technical features of this text processing device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0103] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0104] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0105] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the text processing method in the above embodiments.

[0106] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage 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.

[0107] The aforementioned computer-readable storage medium may be included in a text processing device; or it may exist independently and not be assembled into a text processing device.

[0108] The aforementioned computer-readable storage medium carries one or more programs that, when executed by a text processing device, cause the text processing device to: respond to a tool invocation request initiated by a client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tools required by the client when invoking a large language model; determine a target server corresponding to the tool invocation request, wherein the target server includes a server supporting the Model Context Protocol and an Open Application Programming Interface (API) server; receive a tool invocation result fed back by the target server based on the tool invocation request, and send the tool invocation result to the client.

[0109] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages—such as Python, Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0110] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0111] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0112] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described text processing method. This solves the technical problem of reducing development costs when clients call MCP and OpenAPI services. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the text processing method provided in the above embodiments, and will not be repeated here.

[0113] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the text processing method described above.

[0114] The computer program product provided in this application solves the technical problem of reducing development costs when clients call MCP services and OpenAPI services. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the text processing method provided in the above embodiments, and will not be repeated here.

[0115] The above description is only a part of the embodiments of this application and does not limit the scope of protection of this application. All equivalent structural transformations made under the technical concept of this application and using the content of this application specification and drawings, or direct / indirect applications in other related technical fields, are included in the scope of protection of this application.

[0116] This invention discloses A1. A text processing method applied to a gateway layer, the text processing method comprising the following steps: In response to a tool invocation request initiated by a client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tools required by the client when invoking the large language model; Determine the target server corresponding to the tool invocation request, wherein the target server includes a server that supports the Model Context Protocol and an Open Application Programming Interface server; The system receives the tool invocation result from the target server based on the tool invocation request and sends the tool invocation result to the client.

[0117] A2. The text processing method as described in A1, wherein determining the target server corresponding to the tool invocation request includes: Determine the tool name in the tool invocation request; Identify the first function library in the server that supports the Model Context Protocol and the second function library in the server that supports the Open Application Programming Interface; The tool name is matched with the first function tool library and the second function tool library respectively, and the target server corresponding to the tool call request is determined according to the matching result.

[0118] A3. The text processing method as described in A2, wherein matching the tool name with the first function tool library and the second function tool library respectively, and determining the target server corresponding to the tool call request based on the matching results, includes: The tool name is matched with the first function tool library to obtain the first matching result; The tool name is matched with the second function tool library to obtain a second matching result; If both the first and second matching results are successful, determine the tool parameters in the tool invocation request; The target server corresponding to the tool call request is determined based on the tool parameters.

[0119] A4. The text processing method as described in any one of A1 to A3, further comprising, before responding to a tool call request initiated by a client via the Hypertext Transfer Protocol: Perform security verification on the client and obtain the security verification result; If the security verification result is successful, sensitive words are filtered for the function parameters corresponding to the function tools required by the client when calling the large language model, and the filtered parameters are obtained. Accordingly, the response to a tool invocation request initiated by the client via the Hypertext Transfer Protocol includes: In response to a tool call request initiated by the client via the Hypertext Transfer Protocol, the tool call request is generated based on the function tools required by the client when calling the large language model and the filtered parameters.

[0120] A5. The text processing method as described in A4, wherein performing security verification on the client and obtaining the security verification result includes: The authentication result of the client is determined based on the application programming interface key corresponding to the client. If the authentication result is successful, determine the number of times the client makes interface calls; If the number of times the interface is called meets the preset requirement, the security verification result is determined to be successful.

[0121] A6. The text processing method as described in A4, wherein, if the security verification result is successful, sensitive word filtering is performed on the function parameters corresponding to the function tools required by the client when calling the large language model, to obtain the filtered parameters, including: If the security verification result is successful, the client role is determined based on the application programming interface key; The sensitive word filtering strategy is determined based on the client role. Based on the sensitive word filtering strategy, the function parameters corresponding to the function tools required by the client when calling the large language model are filtered for sensitive words, and the filtered parameters are obtained.

[0122] This invention also discloses B7. A text processing method applied to a client, the text processing method comprising the following steps: Upon receiving a text processing request from a user, the system selects the corresponding function tool from the preset function tool code using a large language model. The function tool generates a tool call request and sends the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request; The gateway layer receives the tool call result based on the tool call request, and generates the text processing result corresponding to the text processing request based on the tool call result using the large language model.

[0123] B8. The text processing method as described in B7, wherein upon receiving a text processing request from a user, selecting the function tool corresponding to the text processing request from a preset function tool code using a large language model includes: Upon receiving a text processing request from a user, the system retrieves the preset function tool structure set by the gateway layer. This preset function tool structure is obtained by format conversion based on a preset function tool list, which includes a first function tool library in the server supporting the model context protocol and a second function tool library in the open application programming interface server. The system then selects the function tool corresponding to the text processing request from the preset function tool structure using a large language model.

[0124] B9. The text processing method as described in B7, wherein generating a tool invocation request based on the function tool and sending the tool invocation request to the gateway layer via the Hypertext Transfer Protocol includes: The function parameters corresponding to the text processing request are determined based on the function tool. The function tool and the function parameter generation tool are invoked according to the request; The tool invocation request is sent to the gateway layer via the Hypertext Transfer Protocol.

[0125] B10. The text processing method as described in any one of B7 to B9, wherein receiving the tool invocation result fed back by the gateway layer according to the tool invocation request, and generating the text processing result corresponding to the text processing request based on the tool invocation result through the large language model, includes: The gateway layer receives the tool call result based on the tool call request, and the large language model determines the lexical units based on the tool call result. By integrating the lexical units using the large language model, the text processing result corresponding to the text processing request is obtained.

[0126] B11. The text processing method as described in B10, wherein receiving the tool invocation result fed back by the gateway layer according to the tool invocation request, and determining the lexical units based on the tool invocation result through the large language model, includes: Receive the tool call result fed back by the gateway layer according to the tool call request, and extract key information from the tool call result through the large language model; The user intent is determined based on the text processing request, and the key information is adjusted according to the user intent to obtain the adjusted information; The adjusted information is sorted to obtain the information sorting result; Based on the sorting results of the information, select lexical units from the adjusted information.

[0127] The present invention also discloses C12. A text processing apparatus applied to a gateway layer, the text processing apparatus comprising: The request-response module is used to respond to a tool invocation request initiated by the client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tool required by the client when invoking the large language model; The server-side determination module is used to determine the target server corresponding to the tool invocation request, wherein the target server includes a server that supports the model context protocol and an open application programming interface server; The result sending module is used to receive the tool call result fed back by the target server according to the tool call request, and send the tool call result to the client.

[0128] C13. The text processing apparatus as described in C12, wherein the server-side determination module is further configured to determine the tool name in the tool call request; determine a first function tool library in the server supporting the Model Context Protocol and a second function tool library in the Open Application Programming Interface server; match the tool name with the first function tool library and the second function tool library respectively, and determine the target server corresponding to the tool call request based on the matching result.

[0129] C14. The text processing apparatus as described in C13, wherein the server-side determination module is further configured to match the tool name with the first function tool library to obtain a first matching result; match the tool name with the second function tool library to obtain a second matching result; determine the tool parameters in the tool call request if both the first and second matching results are successful; and determine the target server corresponding to the tool call request based on the tool parameters.

[0130] C15. The text processing apparatus as described in any one of C12 to C14, wherein the request-response module is further configured to perform security verification on the client and obtain a security verification result; if the security verification result is successful, to perform sensitive word filtering on the function parameters corresponding to the function tools required by the client when calling the large language model, and obtain filtered parameters; and to respond to a tool call request initiated by the client through the Hypertext Transfer Protocol, wherein the tool call request is generated based on the function tools required by the client when calling the large language model and the filtered parameters.

[0131] The present invention also discloses D16. A text processing device applied to a client, the text processing device comprising: The tool selection module is used to select the function tool corresponding to the text processing request from the preset function tool code through a large language model when a text processing request is received from a user. The request generation module is used to generate a tool call request based on the function tool, and send the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request; The result generation module is used to receive the tool call result fed back by the gateway layer according to the tool call request, and generate the text processing result corresponding to the text processing request based on the tool call result through the large language model.

[0132] D17. In the text processing apparatus as described in D16, the tool selection module is further configured to, upon receiving a text processing request sent by a user, obtain a preset function tool structure set by the gateway layer, wherein the preset function tool structure is obtained by format conversion based on a preset function tool list, the preset function tool list including a first function tool library in the server supporting the model context protocol and a second function tool library in the open application programming interface server; and select the function tool corresponding to the text processing request from the preset function tool structure through a large language model.

[0133] The present invention also discloses E18. A text processing device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of a text processing method as described in any one of A1 to A6 or any one of B7 to B11.

[0134] The present invention also discloses F19. A storage medium, which is a computer-readable storage medium, wherein a computer program is stored on the storage medium, and the computer program, when executed by a processor, implements the steps of a text processing method as described in any one of A1 to A6 or any one of B7 to B11.

[0135] The present invention also discloses G20. A computer program product comprising a computer program that, when executed by a processor, implements the steps of a text processing method as described in any one of A1 to A6 or any one of B7 to B11.

Claims

1. A text processing method applied to a gateway layer, characterized in that, The text processing method includes the following steps: In response to a tool invocation request initiated by a client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tools required by the client when invoking the large language model; Determine the target server corresponding to the tool invocation request, wherein the target server includes a server that supports the Model Context Protocol and an Open Application Programming Interface server; The system receives the tool invocation result from the target server based on the tool invocation request and sends the tool invocation result to the client.

2. The text processing method as described in claim 1, characterized in that, Determining the target server corresponding to the tool invocation request includes: Determine the tool name in the tool invocation request; Identify the first function library in the server that supports the Model Context Protocol and the second function library in the server that supports the Open Application Programming Interface; The tool name is matched with the first function tool library and the second function tool library respectively, and the target server corresponding to the tool call request is determined according to the matching result.

3. The text processing method as described in claim 2, characterized in that, The step of matching the tool name with the first function tool library and the second function tool library respectively, and determining the target server corresponding to the tool call request based on the matching results, includes: The tool name is matched with the first function tool library to obtain the first matching result; The tool name is matched with the second function tool library to obtain a second matching result; If both the first and second matching results are successful, determine the tool parameters in the tool invocation request; The target server corresponding to the tool call request is determined based on the tool parameters.

4. A text processing method, applied to a client, characterized in that, The text processing method includes the following steps: Upon receiving a text processing request from a user, the system selects the corresponding function tool from the preset function tool code using a large language model. The function tool generates a tool call request and sends the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request; The gateway layer receives the tool call result based on the tool call request, and generates the text processing result corresponding to the text processing request based on the tool call result using the large language model.

5. The text processing method as described in claim 4, characterized in that, Upon receiving a text processing request from a user, the step of selecting the corresponding function tool from a preset function tool code using a large language model includes: Upon receiving a text processing request from a user, the system retrieves the preset function tool structure set by the gateway layer. The preset function tool structure is obtained by format conversion based on the preset function tool list. The preset function tool list includes a first function tool library in the server that supports the model context protocol and a second function tool library in the open application programming interface server. The function tool corresponding to the text processing request is selected from the preset function tool structure using a large language model.

6. A text processing device applied to a gateway layer, characterized in that, The text processing device includes: The request-response module is used to respond to a tool invocation request initiated by the client via the Hypertext Transfer Protocol, wherein the tool invocation request is generated based on the function tool required by the client when invoking the large language model; The server-side determination module is used to determine the target server corresponding to the tool invocation request, wherein the target server includes a server that supports the model context protocol and an open application programming interface server; The result sending module is used to receive the tool call result fed back by the target server according to the tool call request, and send the tool call result to the client.

7. A text processing device, applied to a client, characterized in that, The text processing device includes: The tool selection module is used to select the function tool corresponding to the text processing request from the preset function tool code through a large language model when a text processing request is received from a user. The request generation module is used to generate a tool call request based on the function tool, and send the tool call request to the gateway layer via the Hypertext Transfer Protocol, so that the gateway layer can determine the target server corresponding to the tool call request and receive the tool call result fed back by the target server based on the tool call request; The result generation module is used to receive the tool call result fed back by the gateway layer according to the tool call request, and generate the text processing result corresponding to the text processing request based on the tool call result through the large language model.

8. A text processing device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the text processing method as claimed in any one of claims 1 to 3 or any one of claims 4 to 5.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the text processing method as claimed in any one of claims 1 to 3 or any one of claims 4 to 5.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the text processing method as claimed in any one of claims 1 to 3 or any one of claims 4 to 5.