End switching method and system based on AI optimization
Through multi-model parallel call and local knowledge base construction, the problems of single function and insufficient scalability of the AI assistant system are solved, and the comparison of multi-model results and robust paragraph theme prediction are realized, which improves decision efficiency and data utilization.
Patent Information
- Application Number
- CN202510461968.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-04-14
AI Technical Summary
The existing AI assistant system has problems such as single functions, scattered management, poor knowledge base compatibility and insufficient scalability, resulting in different interfaces and response times of different AI service providers, resulting in performance bottlenecks, and the output of natural language models depends on local information and cannot learn topic semantics.
Through multi-model parallel call, dynamic grouping management, unified API scheduling and local knowledge base construction, asynchronous parallel task scheduling is realized, multi-format parsing and encrypted backups are supported, and unsupervised pre-trained models are built for text segmentation and paragraph theme prediction.
It realizes the comparison of multi-model results, improves decision-making efficiency, supports multi-API key polling, reduces costs, improves unstructured data utilization, and learns robust paragraph topic representations, and improves prediction performance.
Smart Images

Figure CN120371963A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and particularly to an end-switching method and system optimized based on AI. Background Art
[0002] The end-switching method optimized based on artificial intelligence (AI) dynamically optimizes data exchange paths, traffic allocation, and network loads by introducing technologies such as machine learning, deep learning, and reinforcement learning, thereby improving the efficiency of data transmission, reducing latency, and enhancing the network's adaptability. The existing AI assistant systems generally have the following deficiencies:
[0003] Single function: Only supports single-model conversations and cannot horizontally compare the output results of different models;
[0004] Scattered management: Requires manual configuration of APIs from multiple service providers, lacks a unified management mechanism, and is easily affected by rate limits;
[0005] Poor knowledge base compatibility: Most systems only support limited file formats and lack local data security guarantees;
[0006] Insufficient scalability: Weak customization ability and difficult to meet the personalized needs of enterprises.
[0007] Currently, the Chinese invention patent with the application number CN202410460852.2 discloses a configurable flow switch with virtual channels for sharing I / O ports. The stored configuration data identifies the source input port and the virtual input channel ID associated with the virtual output channel of the output port. The arbitration logic allocates the bandwidth of the data router based on the request signal associated with the virtual input channel of the input port and the configuration data associated with the virtual output channel. However, in the prior art, there are problems that different AI service providers may have different interfaces and response times, resulting in performance bottlenecks due to the latency of a single request. The sentence representations output by natural language models highly depend on the local information of the sentences, and cannot learn the topic semantics of the original sentence from the chaotic word order, nor can they learn more discriminative representations from sentence and paragraph representations at different granularities. Summary of the Invention
[0008] The technical problem solved by the present invention is that in the prior art, there are problems that different AI service providers may have different interfaces and response times, resulting in performance bottlenecks due to the latency of a single request. The sentence representations output by natural language models highly depend on the local information of the sentences, and cannot learn the topic semantics of the original sentence from the chaotic word order, nor can they learn more discriminative representations from sentence and paragraph representations at different granularities.
[0009] To solve the above technical problems, the present invention provides the following technical solutions: An end-switching method optimized based on AI, comprising the following steps:
[0010] Step S1: Asynchronously request multiple AI service provider interfaces based on multi-model parallel calls, and integrate the interface request results to construct an asynchronous parallel task scheduling framework;
[0011] Step S2: Intelligently expand the assistant market, and achieve automatic tagging storage of conversation records through dynamic grouping management;
[0012] Step S3: Unified scheduling of service providers, supporting API key polling and interface compatibility adaptation;
[0013] Step S4: Construct a local knowledge base, providing multi-format parsing, hybrid retrieval, and encrypted backup functions.
[0014] Preferably, the step S1 includes:
[0015] Adopt a distributed task queue based on p-queue, split the user input problem into multiple subtasks, call the subtasks through a priority queue, record the call count of each subtask, automatically generate unified interface parameters through the adapter pattern, standardize the request parameters and return formats of different natural language model APIs, and be compatible with parallel calls to different natural language model APIs;
[0016] Calculate the median value of the call count, back up and cache the subtasks corresponding to the call count higher than the median value, and store them in a table format using libsql to obtain a subtask storage table. The subtask storage table includes the detailed task steps, task status, and call count of the subtasks, and preferentially call the subtask storage table to answer the user input problem.
[0017] Preferably, assign exclusive avatars and metadata codes to each natural language model API, simultaneously send multiple API requests using the concurrent execution library asyncio, store the interface numbers of the API requests in the subtask storage table, when the responses of each API interface return, store the response routes corresponding to each task in the subtask storage table, establish a communication connection for the natural language model API, establish a virtual transmission channel for the task solution thread, store the response information received per unit time by the subtasks that obtain the response in a response queue, store the response in the queue through the best adaptation method, and perform task response calls on the queue storing the response information through a genetic algorithm scheduling algorithm, and the task solution thread performs the most needed response operation currently.
[0018] Preferably, the step S2 includes:
[0019] The user customizes the assistant logic through the prompt. The background automatically generates code and deploys the user input task as a microservice. The microservice is used as the input of the task execution thread for the industry-specific assistant. The task plan of the industry-specific assistant is optimized through the lightweight fine-tuning scheme of LoRA. The industry-specific assistant includes an insurance claim assistant, a product manager, and a merchant operation. The key information of the conversation is automatically recognized based on the natural language model, and the professional task features of the conversation key information are extracted to obtain the professional task feature tags corresponding to each industry-specific assistant. The user input problem is split according to the professional task feature tags to obtain the sub-task category tags of the user input problem. The sub-task storage table also includes the sub-task category tags corresponding to the sub-tasks.
[0020] Preferably, the step S3 includes:
[0021] Real-time monitor the remaining quota and request delay of the keys of each natural language model API, and use the weighted round-robin algorithm to dynamically allocate the quota and requests;
[0022] Deploy a timed crawler task to regularly visit the official documentation pages of each service provider, parse the latest model list, and automatically update it to the platform database.
[0023] Preferably, the step S4 includes:
[0024] Build a multi-modal document parsing engine, including integrating MSOffice, embedjs-loader, and epub for document content extraction, combining OCR technology to parse the image text in scanned PDF, and converting it into structured JSON data for storage after extracting complex formats. The complex formats include charts in PPTX, and the document formats include file formats such as txt, md, doc, docx, xls, xlsx, epub, and pdf.
[0025] Preferably, building an unsupervised pre-training model and optimizing the tasks of text segmentation and paragraph theme prediction through AI includes improving the discrimination and prediction performance of the unsupervised pre-training model by comparing representations at different granularities. The granularities include sentences and paragraphs, and the model is trained in a self-supervised manner. The text segmentation representation divides a long document into smaller paragraphs, and the paragraphs are of different themes. The paragraph theme prediction represents predicting the theme of the paragraph;
[0026] Building an unsupervised pre-training model based on a neural network model includes:
[0027] Similar sample pairs and dissimilar sample pairs are established based on the data extracted from the local knowledge base. Similar samples are obtained by modifying the existing data samples through data augmentation methods, and other data samples are used as dissimilar samples. The modification operations include rotation, flipping, color adjustment, adding Gaussian noise, and vectorization enhancement of text segmentation. The vectorization enhancement logic includes: dividing each text segment into several words according to the sentence meaning, standardizing each word separately and then converting it into a d-dimensional vector, where d is a constant;
[0028] Modifying the d-dimensional vector includes: performing representational random deletion, all-zero replacement, randomly selecting b-dimensional corresponding features in the d-dimensional vector and replacing them with 0, randomly shuffling the order of the d-dimensional vector, and replacing any eigenvalue in the d-dimensional vector with 0 with a random probability p;
[0029] The address of the similar sample stores the corresponding theme of the corresponding text segment at the same time, and the dissimilar sample has no corresponding theme stored.
[0030] Preferably, when the modification operation selects to randomly shuffle the order of the d-dimensional vector, the corresponding modified sentence is used as the negative sample of the text paragraph, and it is predicted whether the order of the text paragraph is chaotic. The prediction logic includes: randomly dividing the text paragraph into a segments, randomly selecting one of the segments from 0 to a for comparison and outputting a similarity result. The similarity result includes 1 to a, that is, the text paragraph corresponds to one of the theme paragraphs from 1 to a;
[0031] The process of comparing similarity includes:
[0032] Randomly delete several words of the text paragraph, learn the corresponding theme classification of the remaining words through neural network, randomly delete several sentences of the text paragraph, learn the corresponding theme classification of the remaining sentences through neural network, and add multiple [0] symbols at the end of the sentence with the number of words less than other set length sizes to reach the specified length. The similarity is judged by sequentially comparing the coincidence degree of the sentence theme classification and the corresponding label of the text segment theme classification;
[0033] If the coincidence degree exceeds the preset coincidence percentage threshold, it means that the similar sample pair of the text paragraph exists in one of the theme paragraphs from 1 to a, and the theme paragraph with the highest coincidence degree is output;
[0034] If there is no theme paragraph whose coincidence degree exceeds the preset coincidence percentage threshold, it means that the text paragraph is a dissimilar sample;
[0035] Compare the similarity of each text paragraph, and record the similarity result as an undirected graph representation. According to the node connection lines of the undirected graph, represent the relationship between similar samples and dissimilar samples of the predicted text paragraph themes;
[0036] Semantically segment the document content in advance using the unsupervised pre-training model, generate a paragraph-level vector index, and store the paragraph-level vector index in the LibSQL vector database;
[0037] When retrieving the LibSQL vector database, simultaneously extract the vector features of the user query statement through a neural network, match highly relevant paragraphs according to the cosine similarity method, and return the highly relevant paragraphs as text segmentation context.
[0038] Preferably, introduce Git-LFS to manage the knowledge base version in the local knowledge base, supporting incremental updates of documents and backtracking of historical versions;
[0039] Implement incremental backup using the rsync algorithm, only transfer changed data blocks, and support sharded storage and off-site disaster recovery based on the AES-256 encrypted backup solution;
[0040] Run the local large model in a Docker container and prohibit data from being transmitted outside the container through network isolation and permission control.
[0041] An AI-optimized end exchange system, which is used to execute an AI-optimized end exchange method, including an asynchronous parallel task scheduling module, an assistant market module, an API adaptation module, and a local knowledge base module:
[0042] The asynchronous parallel task scheduling module is used to asynchronously request multiple AI service provider interfaces based on multi-model parallel calls, integrate the interface request results, and build an asynchronous parallel task scheduling framework;
[0043] The assistant market module is used to intelligently expand the assistant market and automatically tag and store conversation records through dynamic group management;
[0044] The API adaptation module is used to uniformly schedule service providers, supporting API key polling and interface compatibility adaptation;
[0045] The local knowledge base module is used to build a local knowledge base, providing multi-format parsing, hybrid retrieval, and encrypted backup functions.
[0046] Advantages of the present invention: Innovative question-and-multiple-answer, by parallelly invoking multiple models to generate responses, realizing result comparison, and improving decision-making efficiency; through the AI context feature, introducing the concept of agent group chat, enabling free combination of multiple agents to maximize the role of AI. Support polling calls of multiple API keys to avoid rate limits, and optimize the efficiency of multi-model calls and reduce API costs through load balancing algorithms and caching mechanisms. Support various data sources such as local files (txt, md, doc, docx, xls, xlsx, epub, pdf), URLs, sitemaps, etc., provide segmented retrieval and export functions, and combine OCR, semantic segmentation, and vector retrieval to improve the utilization rate of unstructured data; modifying existing data samples to obtain similar samples can learn the topic semantics of the original sentence with as little information as possible, so that the sentence representations output by the natural language model do not greatly depend on the local information of the sentence, and can learn the topic semantics of the original sentence from the chaotic word order, which is more conducive to the model learning a robust representation. By comparing sentence and paragraph representations at different granularities, more discriminative representations can be learned, thereby improving the performance of paragraph topic prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 FIG. is a schematic diagram of the basic process of the AI-optimized end exchange method provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0048] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following detailed description of the specific embodiments of the present invention will be given in conjunction with the accompanying drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them.
[0049] Referring to Figure 1 , an embodiment of the present invention provides an AI-optimized end exchange method, including the following steps:
[0050] Step S1: Asynchronously request multiple AI service provider interfaces based on multi-model parallel calls, and integrate the interface request results to construct an asynchronous parallel task scheduling framework;
[0051] Step S2: Intelligently expand the assistant market, and realize automatic tagging storage of conversation records through dynamic grouping management;
[0052] Step S3: Uniformly schedule service providers, support API key polling and interface compatibility adaptation;
[0053] Step S4: Build a local knowledge base, and provide multi-format parsing, hybrid retrieval, and encrypted backup functions.
[0054] Step S1 includes:
[0055] Adopt a distributed task queue based on p-queue, split the user input problem into multiple subtasks, call the subtasks through a priority queue, record the call count of each subtask, automatically generate unified interface parameters through the adapter pattern, standardize the request parameters and return formats of different natural language model APIs, and be compatible with parallel calls to different natural language model APIs. The natural language models include statistical language models, word vector-based models, recurrent neural networks (RNN) and their variants, attention mechanisms and Transformer models, pre-trained language models, and multimodal models;
[0056] Calculate the median of the call counts, back up and cache the subtasks corresponding to the call counts higher than the median, and use libsql for tabular storage to obtain a subtask storage table. The subtask storage table includes the detailed task steps, task status, and call counts of the subtasks. Preferentially call the subtask storage table to answer the user input problem, reducing the API call frequency and improving the response speed.
[0057] Assign exclusive avatars and metadata encodings to each natural language model API to enhance the interaction recognition. Use the concurrent execution library asyncio to send multiple API requests simultaneously. Different AI service providers may have different interfaces and response times. Asynchronous requests can avoid performance bottlenecks caused by the latency of a single request. Store the interface numbers of the API requests in the subtask storage table. When the responses of each API interface are returned, store the response routes corresponding to each task in the subtask storage table, establish a communication connection for the natural language model API, establish a virtual transmission channel for the task-solving thread, and store the response information received per unit time by the subtasks that obtain the response in the response queue. Store the response in the queue through the best adaptation method, and perform task response calls on the queue storing the response information through a genetic algorithm scheduling algorithm. The task-solving thread performs the most needed response operation currently.
[0058] Step S2 includes:
[0059] The user customizes the assistant logic through the prompt, and the background automatically generates code and deploys the user input task as a microservice. Input the microservice as a task execution thread into the industry-specific assistant, and optimize the task solution for the industry-specific assistant through the lightweight fine-tuning solution of LoRA. The industry-specific assistants include insurance claim assistants, product managers, and merchant operations. Automatically identify the key information of the conversation based on the natural language model, extract the professional task features of the conversation key information, obtain the professional task feature labels corresponding to each industry-specific assistant, split the task according to the professional task feature labels, obtain the subtask category labels of the user input problem, and the subtask storage table also includes the subtask category labels corresponding to the subtasks.
[0060] Support data transfer between assistants, mainly achieved through group chat @. For example: pull the required assistants into a group, first @ "Translation Assistant" to output the result, and then @ "Writing Assistant" to write using the original text and the result of the "Translation Assistant", so as to achieve collaborative work of multiple assistants.
[0061] Step S3 includes:
[0062] Real-time monitor the remaining quota and request latency of the keys of each natural language model API, and use the weighted round-robin algorithm to dynamically allocate quotas and requests;
[0063] For example, keys with more remaining quotas have higher weights, avoiding overloading of a single key. At the same time, support the round-robin scheduling algorithm of multiple API keys for a single model, and dynamically allocate requests according to the rate limits of service providers;
[0064] Deploy a timed crawler task to regularly visit the official documentation pages of each service provider, parse the latest model list, such as using embedjs-loader-web to extract the model names and parameters in HTML, and automatically update them to the platform database.
[0065] Step S4 includes:
[0066] Build a multi-modal document parsing engine, including integrating MSOffice, embedjs-loader, and epub for document content extraction, combining OCR technology to parse the image text in scanned PDF, and converting the extracted complex format into structured JSON data for storage. Complex formats include charts in PPTX, and document formats include file formats such as txt, md, doc, docx, xls, xlsx, epub, and pdf. In addition, it also supports crawling of web documents.
[0067] Build an unsupervised pre-training model. The tasks of optimizing text segmentation and paragraph topic prediction through AI include improving the discrimination and prediction performance of the unsupervised pre-training model by comparing representations at different granularities. Granularities include sentences and paragraphs, and the model is trained in a self-supervised manner. Text segmentation representation slices a long document into smaller paragraphs, and paragraphs are of different topics. Paragraph topic prediction represents predicting the topic of a paragraph;
[0068] Building an unsupervised pre-training model based on a neural network model includes:
[0069] Similar sample pairs and dissimilar sample pairs are established based on the data extracted from the local knowledge base. Similar samples are obtained by modifying the existing data samples through data augmentation methods, and other data samples are used as dissimilar samples. The modification operations include rotation, flipping, color adjustment, adding Gaussian noise, and vectorization enhancement of text segmentation. The vectorization enhancement logic includes: dividing each text segment into several words according to the sentence meaning, standardizing each word separately and then converting it into a d-dimensional vector, where d is a constant;
[0070] Modifying the d-dimensional vector includes: performing representational random deletion, all-zero replacement, randomly selecting b-dimensional corresponding features in the d-dimensional vector and replacing them with 0, randomly shuffling the order of the d-dimensional vector, and replacing any eigenvalue in the d-dimensional vector with 0 with a random probability p;
[0071] The corresponding topic of the corresponding text segment is stored at the similar sample address, and no corresponding topic is stored for the dissimilar sample.
[0072] Modifying the existing data samples to obtain similar samples can learn the topic semantics of the original sentence using as little information as possible, so that the sentence representation output by the natural language model does not rely too much on the local information of the sentence, and can learn the topic semantics of the original sentence from the chaotic word order, which is more helpful for the model to learn a robust representation.
[0073] When the modification operation selects to randomly shuffle the order of the d-dimensional vector, the corresponding modified sentence is used as the negative sample of the text paragraph, and it is predicted whether the text paragraph order is chaotic. The prediction logic includes: randomly dividing the text paragraph into a segments, randomly selecting one of the segments from 0 to a for comparison and outputting the similarity result. The similarity result includes 1 to a, that is, the text paragraph corresponds to one of the topic paragraphs from 1 to a;
[0074] The process of comparing similarity includes:
[0075] Randomly delete several words in the text paragraph, learn the corresponding topic classification of the remaining words through the neural network, randomly delete several sentences in the text paragraph, learn the corresponding topic classification of the remaining sentences through the neural network, promote the model to infer the paragraph of the text paragraph according to the remaining partial sentences, which helps the model to learn more important information from less information. For sentences with the number of words less than the size of other set lengths, add multiple 【0】 symbols at the end to reach the specified length, and judge the similarity by sequentially comparing the coincidence degree of the sentence topic classification and the corresponding label of the text segment topic classification;
[0076] If the coincidence degree exceeds the preset coincidence percentage threshold, it means that the similar sample pair of the text paragraph exists in one of the topic paragraphs from 1 to a, and the topic paragraph with the highest coincidence degree is output;
[0077] If the topic paragraphs whose overlap degree does not exceed the preset overlap percentage threshold, it indicates that the text paragraph is a non-similar sample;
[0078] Compare the similarity of each text paragraph, and record the similarity result as an undirected graph representation. According to the node connection lines of the undirected graph, represent the relationship between similar samples and non-similar samples among the topics of the text paragraphs;
[0079] By comparing the sentence and paragraph representations at different granularities, more discriminative representations are learned, thereby improving the performance of paragraph topic prediction.
[0080] Use an unsupervised pre-training model to pre-semantically segment the document content, generate paragraph-level vector indexes, and store the paragraph-level vector indexes in the LibSQL vector database;
[0081] When retrieving the LibSQL vector database, the neural network is used to extract vector features of the user query statement at the same time, and high-correlation paragraphs are matched according to the cosine similarity method, and the high-correlation paragraphs are returned to the text segmentation context.
[0082] Introduce Git-LFS in the local knowledge base to manage the knowledge base version, support incremental updates and historical version backtracking of documents, and ensure the continuity and maintainability of the knowledge base;
[0083] At the same time, in order to ensure security, add local backup and recovery option functions.
[0084] Use the rsync algorithm to implement incremental backup, only transfer the changed data blocks, and use an AES-256 encrypted backup solution that supports sharded storage and off-site disaster recovery. Record the backup log locally to ensure the security and immutability of the backup. Use AES-256 encryption for backup to ensure that the cloud data is not leaked;
[0085] Run the local large model in a Docker container, and prohibit the container from transmitting data through network isolation and permission control. The model inference result is only returned to the main system through a secure channel. This function is a value-added service.
[0086] An AI-optimized end-exchange system, which is used to execute an AI-optimized end-exchange method, including an asynchronous parallel task scheduling module, an assistant market module, an API adaptation module, and a local knowledge base module:
[0087] The asynchronous parallel task scheduling module is used to asynchronously request multiple AI service provider interfaces based on multi-model parallel calls, and integrate the interface request results to build an asynchronous parallel task scheduling framework;
[0088] The assistant market module is used to intelligently expand the assistant market and realize automatic tagging storage of conversation records through dynamic grouping management;
[0089] The API adaptation module is used for unified scheduling of service providers, supporting API key polling and interface compatibility adaptation;
[0090] The local knowledge base module is used to build a local knowledge base, providing multi-format parsing, hybrid retrieval, and encrypted backup functions.
[0091] The present invention has innovative one-question-multiple-answers. By parallelly invoking multiple models to generate responses, result comparison is realized to improve decision-making efficiency; through the AI context feature, the concept of intelligent agent group chat is introduced, enabling free combination of multiple intelligent agents to let AI play its maximum role. It supports polling calls of multiple API keys to avoid rate limits, and optimizes the multi-model call efficiency and reduces API costs through load balancing algorithms and caching mechanisms. It supports various data sources such as local files (txt, md, doc, docx, xls, xlsx, epub, pdf), URLs, site maps, etc., provides segmented retrieval and export functions, and combines OCR, semantic segmentation, and vector retrieval to improve the utilization rate of unstructured data; modifying existing data samples to obtain similar samples can learn the topic semantics of the original sentence using as little information as possible, so that the sentence representations output by the natural language model do not highly depend on the local information of the sentence, and can learn the topic semantics of the original sentence from the chaotic word order, which is more helpful for the model to learn robust representations. By comparing sentence and paragraph representations at different granularities, more discriminative representations can be learned, thus improving the paragraph topic prediction performance.
[0092] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk. These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device, and the instruction device implements the functions specified in one process Figure 1 one process or multiple processes and / or boxes Figure 1 specified in one box or multiple boxes.
[0093] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
Claims
1. An end-exchange method optimized based on AI, characterized in that, It includes the following steps: Step S1: Based on multi-model parallel calls, asynchronously request multiple AI service provider interfaces, and integrate the interface request results to construct an asynchronous parallel task scheduling framework; Step S2: Intelligently expand the assistant market, and achieve automatic tagging storage of conversation records through dynamic grouping management; Step S3: Unifiedly schedule service providers, supporting API key polling and interface compatibility adaptation; Step S4: Build a local knowledge base, providing multi-format parsing, hybrid retrieval, and encrypted backup functions.
2. The AI-optimized end exchange method according to claim 1, wherein The said Step S1 includes: Adopt a distributed task queue based on p-queue, split the user input problem into multiple subtasks, call the subtasks through a priority queue, record the call quantity of each subtask, automatically generate unified interface parameters through the adapter pattern, standardize the request parameters and return formats of different natural language model APIs, and be compatible with parallel calls to different natural language model APIs; Calculate the median value of the call quantity, back up and cache the subtasks corresponding to the call quantity higher than the median value, and use libsql for tabular storage to obtain a subtask storage table. The subtask storage table includes the detailed task steps, task status, and call quantity of the subtasks, and preferentially call the subtask storage table to answer the user input problem.
3. The AI-optimized end exchange method according to claim 2, wherein Assign exclusive avatars and metadata codes to each natural language model API, use the concurrent execution library asyncio to send multiple API requests simultaneously, store the interface numbers of the API requests in the subtask storage table, when the responses of each API interface return, store the response routes corresponding to each task in the subtask storage table, establish a communication connection for the natural language model API, establish a virtual transmission channel for the task solution thread, store the response information received per unit time by the obtained response subtasks in a response queue, store the queue of the response information through the best adaptation method, and perform task response calls on the queue storing the response information through a genetic algorithm scheduling algorithm, and the task solution thread performs the currently most needed response operation.
4. The AI-optimized end exchange method according to claim 2, wherein The said Step S2 includes: The user customizes the assistant logic through prompts, the background automatically generates code and deploys the user input task as a microservice, inputs the microservice as a task execution thread into an industry-specific assistant, optimizes the task solution for the industry-specific assistant through a lightweight fine-tuning solution of LoRA. The industry-specific assistant includes an insurance claim assistant, a product manager, and a merchant operation. Automatically identify the key conversation information based on the natural language model, extract the professional task feature of the key conversation information, obtain the professional task feature tags corresponding to each industry-specific assistant, split the task according to the professional task feature tags, obtain the subtask category tags of the user input problem, and the subtask storage table also includes the subtask category tags corresponding to the subtasks.
5. The AI-optimized end exchange method according to claim 1, wherein The said Step S3 includes: Real-time monitor the remaining quota and request delay of the keys of each natural language model API, and dynamically allocate the quota and requests using a weighted round-robin algorithm; Deploy a timed crawler task to regularly visit the official documentation pages of each service provider, parse the latest model list, and automatically update it to the platform database.
6. The AI-optimized end-switching method according to claim 1, wherein The step S4 includes: Building a multi-modal document parsing engine includes integrating MSOffice, embedjs-loader, and epub for document content extraction, combining OCR technology to parse image text in scanned PDF, and converting the extracted complex format into structured JSON data for storage. The complex format includes charts in PPTX, and the document formats include file formats such as txt, md, doc, docx, xls, xlsx, epub, and pdf.
7. The AI-optimized end-exchange method according to claim 6, wherein: Building an unsupervised pre-training model, and the tasks of optimizing text segmentation and paragraph topic prediction by AI include improving the discrimination and prediction performance of the unsupervised pre-training model by comparing representations at different granularities. The granularities include sentences and paragraphs, and the model is trained in a self-supervised manner. The text segmentation representation divides a long document into smaller paragraphs, and the paragraphs are of different topics. The paragraph topic prediction represents predicting the topic of a paragraph; Building an unsupervised pre-training model based on a neural network model includes: Establishing similar sample pairs and dissimilar sample pairs according to the data extracted from the local knowledge base, modifying the existing data samples through data augmentation methods to obtain similar samples, and the other data samples are used as dissimilar samples. The modification operations include rotation, flipping, color adjustment, adding Gaussian noise, and vectorization enhancement of text segmentation. The vectorization enhancement logic includes: dividing each text segment into several words according to the sentence meaning, normalizing each word respectively and then converting it into a d-dimensional vector, where d is a constant; Modifying the d-dimensional vector includes: respectively performing representation random deletion, all-0 replacement, randomly selecting b-dimensional corresponding features in the d-dimensional vector and replacing them with 0, randomly shuffling the order of the d-dimensional vector, and replacing any eigenvalue in the d-dimensional vector with 0 with a random probability p; The corresponding topic of the corresponding text segment is stored at the similar sample address, and no corresponding topic is stored for the dissimilar sample.
8. The AI-optimized end-exchange method according to claim 7, wherein: When the modification operation selects to randomly shuffle the order of the d-dimensional vector, the corresponding modified sentence is used as the negative sample of the text paragraph, and it is predicted whether the order of the text paragraph is chaotic. The prediction logic includes: randomly dividing the text paragraph into a segments, randomly selecting one of the segments from 0 to a for comparison and outputting a similarity result. The similarity result includes 1 to a, that is, the text paragraph corresponds to one of the topic paragraphs from 1 to a; The process of comparing similarity includes: Randomly delete several words in the text paragraph, and learn the corresponding topic classification of the remaining words through a neural network. Randomly delete several sentences in the text paragraph, and learn the corresponding topic classification of the remaining sentences through a neural network. For sentences with a word count less than other set length sizes, add multiple 【0】 symbols at the end to reach the specified length. Determine similarity by sequentially comparing the overlap degree between the sentence topic classification and the corresponding label of the text segmentation topic classification; If the overlap degree exceeds the preset overlap percentage threshold, it indicates that the similar sample pair of the text paragraph exists in a certain topic paragraph among paragraphs 1 to a, and output the topic paragraph with the highest overlap degree; If there is no topic paragraph whose overlap degree exceeds the preset overlap percentage threshold, it indicates that the text paragraph is a non-similar sample; Compare the similarities of each text paragraph, and record the similarity results as an undirected graph. According to the node connection lines of the undirected graph, represent the relationship between similar samples and non-similar samples among the predicted text paragraph topics; Use the unsupervised pre-training model to pre-segment the document content semantically, generate a paragraph-level vector index, and store the paragraph-level vector index in the LibSQL vector database; When retrieving the LibSQL vector database, use a neural network to simultaneously extract vector features of the user query statement, and match highly relevant paragraphs according to the cosine similarity method, and return the highly relevant paragraphs to the text segmentation context.
9. The AI-optimized end exchange method according to claim 8, wherein: Introduce Git-LFS to manage the knowledge base version in the local knowledge base, supporting incremental update of documents and backtracking of historical versions; Adopt the rsync algorithm to achieve incremental backup, only transmit changed data blocks, and a backup scheme based on AES-256 encryption, supporting sharded storage and off-site disaster recovery; Run the local large model in a Docker container, and prohibit the container from transmitting data externally through network isolation and permission control.
10. An AI-optimized end-exchange system for performing an AI-optimized end-exchange method, characterized in that, It includes an asynchronous parallel task scheduling module, an assistant market module, an API adaptation module, and a local knowledge base module: The asynchronous parallel task scheduling module is used to asynchronously request multiple AI service provider interfaces based on multi-model parallel calls, and integrate the interface request results to build an asynchronous parallel task scheduling framework; The assistant market module is used to intelligently expand the assistant market, and realize automatic tagging storage of conversation records through dynamic grouping management; The API adaptation module is used to uniformly schedule service providers, supporting API key polling and interface compatibility adaptation; The local knowledge base module is used to build a local knowledge base, providing multi-format parsing, hybrid retrieval, and encrypted backup functions.
Citation Information
Patent Citations
Configurable flow switch with virtual channels for sharing I / O ports
CN118827593A
Text retrieval method based on graph convolution topological features and keyword features
CN115329046A
Document question and answer method based on multi-granularity mixed retrieval and verification editing reasoning framework
CN117435713A
Multi-level theme type retrieval enhancement generation method and system oriented to industry large model
CN118484516A
Method and system for performing paragraph matching knowledge questioning and answering on air traffic control industry based on large model
CN119046417A
Cited By
Scoring suggestion generation method and device based on social account and related medium
CN121073691A