Agentic intermediary for managing AI providers
A request for completion by an artificial intelligence (AI) model is received. Tasks required to fulfill the request are identified. An AI model is selected based on the tasks and capabilities of the AI model. The request is transmitted to the selected AI model. A response is received from the AI model. The response is then transmitter to a requester.
1 . A method, comprising:
receiving a request for completion by an artificial intelligence (AI) model;
identifying tasks required to fulfill the request;
selecting an AI model from available AI models based on the tasks and capabilities of the available AI models,
wherein the selected AI model is a large language model;
retrieving context data relevant to the request;
querying an AI models register that stores technical specifications for a plurality of AI models to retrieve a maximum token limit associated with the selected AI model, wherein different AI models in the AI models register have different maximum token limits;
determining a total number of tokens for the context data;
pruning less relevant context data from the context data if the determined total number of tokens for the context data exceeds the retrieved maximum token limit,
wherein the less relevant context data are identified based on relevance to the request based on contextual importance or historical usage, and
wherein tokens comprise discrete textual units for processing by the selected AI model;
formatting the request and the context data into a data structure compatible with an API endpoint of the selected AI model;
transmitting the formatted request and the formatted context data to the selected AI model;
receiving a response from the AI model; and
transmitting the response to a requester.
2 . The method of claim 1 , wherein selecting the AI model comprises:
retrieving client-defined parameters from a configuration database;
identifying eligible AI models from an AI models register based on the client-defined parameters;
evaluating the eligible AI models based on real-time availability and performance metrics; and
selecting an optimal AI model from the eligible AI models based on the evaluation.
3 . The method of claim 1 , wherein retrieving the context data relevant to the request comprises:
analyzing context requirements for the request;
retrieving the context data from multiple data sources comprising at least two of: a short-term memory store, a long-term memory store, or an internal knowledge base;
aggregating the context data; and
formatting the context data for the selected AI model before transmitting the request.
4 . The method of claim 1 , further comprising:
monitoring performance metrics of the selected AI model in fulfilling the request;
updating an AI models register with the performance metrics;
determining if the performance metrics meet predefined thresholds; and
adjusting future AI model selection based on the performance metrics.
5 . The method of claim 1 , wherein selecting the AI model comprises:
filtering a set of AI models based on compatibility with the tasks to exclude AI models lacking required capabilities; and
ranking the filtered AI models using a scoring function that weights task-specific performance criteria.
6 . The method of claim 1 , further comprising:
validating security requirements of the request using a security engine before transmitting the request to the selected AI model; and
anonymizing sensitive data in the request if the selected AI model is an external model.
7 . The method of claim 1 , wherein transmitting the request to the selected AI model comprises:
formatting the request into a data structure compatible with an API endpoint of the selected AI model; and
transmitting the formatted request via a secure communication channel.
8 . The method of claim 1 , further comprising:
decomposing the request into a plurality of subtasks if the request exceeds a complexity threshold; and
selecting a distinct AI model for at least one subtask based on specialized capabilities of the distinct AI model.
9 . A system comprising:
a memory subsystem; and
processing circuitry, the processing circuitry configured to execute instructions stored in the memory subsystem to:
receive a request for completion by an artificial intelligence (AI) model;
identify tasks required to fulfill the request;
select an AI model from available AI models based on the tasks and capabilities of the available AI models,
wherein the selected AI model is a large language model;
retrieve context data relevant to the request;
query an AI models register that stores technical specifications for a plurality of AI models to retrieve a maximum token limit associated with the selected AI model, wherein different AI models in the AI models register have different maximum token limits;
determine a total number of tokens for the context data;
prune less relevant context data from the context data if the determined total number of tokens for the context data exceeds the retrieved maximum token limit,
wherein the less relevant context data are identified based on relevance to the request based on contextual importance or historical usage, and
wherein tokens comprise discrete textual units for processing by the selected AI model:
format the request and the context data into a data structure compatible with an API endpoint of the selected AI model;
transmit the formatted request and the formatted context data to the selected AI model;
receive a response from the AI model; and
transmit the response to a requester.
10 . The system of claim 9 , wherein to select the AI model comprises to:
retrieve client-defined parameters from a configuration database;
identify eligible AI models from an AI models register based on the client-defined parameters;
evaluate the eligible AI models based on real-time availability and performance metrics; and
select an optimal AI model from the eligible AI models based on the evaluation.
11 . The system of claim 9 , wherein to retrieve the context data relevant to the request comprises:
analyze context requirements for the request;
retrieve the context data from multiple data sources comprising at least two of: a short-term memory store, a long-term memory store, or an internal knowledge base;
aggregate the context data; and
format the context data for the selected AI model before transmitting the request.
12 . The system of claim 9 , wherein the processing circuitry further configured to execute instructions stored in the memory subsystem to:
monitor performance metrics of the selected AI model in fulfilling the request;
update an AI models register with the performance metrics;
determine if the performance metrics meet predefined thresholds; and
adjust future AI model selection based on the performance metrics.
13 . The system of claim 9 , wherein to select the AI model comprises to:
filter a set of AI models based on compatibility with the tasks to exclude AI models lacking required capabilities; and
rank the filtered AI models using a scoring function that weights task-specific performance criteria.
14 . The system of claim 9 , wherein the processing circuitry further configured to execute instructions stored in the memory subsystem to:
validate security requirements of the request using a security engine before transmitting the request to the selected AI model; and
anonymize sensitive data in the request if the selected AI model is an external model.
15 . The system of claim 9 , wherein to transmit the request to the selected AI model comprises to:
format the request into a data structure compatible with an API endpoint of the selected AI model; and
transmit the formatted request via a secure communication channel.
16 . One or more non-transitory computer readable media storing instructions operable to cause one or more processors to perform operations comprising:
receiving a request for completion by an artificial intelligence (AI) model;
identifying tasks required to fulfill the request;
selecting an AI model from available AI models based on the tasks and capabilities of the available AI models,
wherein the selected AI model is a large language model;
retrieving context data relevant to the request;
querying an AI models register that stores technical specifications for a plurality of AI models to retrieve a maximum token limit associated with the selected AI model, wherein different AI models in the AI models register have different maximum token limits;
determining a total number of tokens for the context data;
pruning less relevant context data from the context data if the determined total number of tokens for the context data exceeds the retrieved maximum token limit,
wherein the less relevant context data are identified based on relevance to the request based on contextual importance or historical usage, and
wherein tokens comprise discrete textual units for processing by the selected AI model;
formatting the request and the context data into a data structure compatible with an API endpoint of the selected AI model;
transmitting the formatted request and the formatted context data to the selected AI model;
receiving a response from the AI model; and
transmitting the response to a requester.
17 . The one or more non-transitory computer readable media of claim 16 , wherein selecting the AI model comprises:
retrieving client-defined parameters from a configuration database;
identifying eligible AI models from an AI models register based on the client-defined parameters;
evaluating the eligible AI models based on real-time availability and performance metrics; and
selecting an optimal AI model from the eligible AI models based on the evaluation.
18 . The one or more non-transitory computer readable media of claim 16 , wherein retrieving the context data relevant to the request comprises:
analyzing context requirements for the request;
retrieving the context data from multiple data sources comprising at least two of: a short-term memory store, a long-term memory store, or an internal knowledge base;
aggregating the context data; and
formatting the context data for the selected AI model before transmitting the request.
19 . The one or more non-transitory computer readable media of claim 16 , the operations further comprising:
monitoring performance metrics of the selected AI model in fulfilling the request;
updating an AI models register with the performance metrics;
determining if the performance metrics meet predefined thresholds; and
adjusting future AI model selection based on the performance metrics.
20 . The one or more non-transitory computer readable media of claim 16 , the operations further comprising, wherein selecting the AI model comprises:
filtering a set of AI models based on compatibility with the tasks to exclude AI models lacking required capabilities; and
ranking the filtered AI models using a scoring function that weights task-specific performance criteria.