Mean embeddings for application programming interface calls
Techniques are described for API call generation. An example method includes a system generating a plurality of statement tokens that represent the user statement. The system can identify a plurality of embeddings associated with the plurality of statement tokens. The system can determine a mean embedding based at least in part on the plurality of embeddings. The system can identify the first candidate information element token of an API call and the second candidate information element token of the API call from a vocabulary based at least in part on the mean embedding and the prompt. The system can generate a first probability distribution for the first candidate information element token and the second candidate information element token. The system can select the first candidate information element token based at least in part on a first probability of the first candidate information element token.
1 . A computing system comprising:
one or more processors; and
one or more computer-readable media having stored thereon a sequence of instructions, when executed, cause the one or more processors to:
receive input data representing a user statement that comprises a command for a first computing device;
generate a first statement token and a second statement token that represent the user statement;
determine a first integer value associated with the first statement token;
determine a second integer value associated with the second statement token;
determine a mean embedding based at least in part on the first integer value and the second integer value;
receive information associated with a user account, wherein the user account is associated with the first computing device;
select a search space for a candidate information element token based at least in part on the information;
identify the candidate information element token of an API call from a vocabulary based at least in part on the mean embedding and the search space;
generate a probability distribution for the candidate information element token;
select the candidate information element token based at least in part on a probability of the candidate information element token, the probability indicated by the probability distribution; and
generate the API call using the candidate information element token.
2 . The computing system of claim 1 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
receive domain information associated with the user account; and
map the mean embedding to a domain token of the vocabulary based at least in part on the domain information, wherein the candidate information element token is the domain token.
3 . The computing system of claim 1 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
receive API name information associated with the user account; and
map the mean embedding to an API name token of the vocabulary based at least in part on the API name information, wherein the candidate information element token is the API name token.
4 . The computing system of claim 3 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
determine the probability for the API name token based at least in part on the mean embedding.
5 . The computing system of claim 1 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
receive device endpoint identifier information associated with the user account; and
map the mean embedding to a device endpoint identifier token of the vocabulary based at least in part on the device endpoint identifier information, wherein the candidate information element token is the device endpoint identifier token.
6 . The computing system of claim 5 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
determine the probability for the device endpoint identifier token based at least in part on the mean embedding.
7 . The computing system of claim 1 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
include the candidate information element token into the API using an API call format, wherein the API call is generated based at least in part on the API call format.
8 . The computing system of claim 1 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
determine a first embedding associated with the first integer value;
determine a second embedding associated with the second integer value;
perform an element-wise operation using the first embedding associated with the first integer value and the second embedding associated with the second integer value, wherein the mean embedding is generated based at least in part on the element-wise operation.
9 . The computing system of claim 1 , and wherein the sequence of instructions, when executed, further cause the one or more processors to:
receive computing device information identifying the first computing device;
generate a prompt, wherein the prompt comprises the computing device information; and
concatenate the first integer value with the prompt, wherein the candidate information element token is selected based at least in part on the first integer value concatenated with the prompt.
10 . The computing system of claim 9 , wherein the sequence of instructions, when executed, further cause the one or more processors to:
access the prompt and the mean embedding;
identify a plurality of candidate information element tokens from the vocabulary, including the candidate information element token, based at least in part on the mean embedding and the prompt.
11 . The computing system of claim 1 , wherein the computing system comprising a machine learning model, wherein the sequence of instructions, when executed, further cause the one or more processors to:
perform, via an embedding layer of the machine learning model, a lookup operation to identify a plurality of candidate information element tokens from the vocabulary based at least in part on the mean embedding; and
access the candidate information element token from the plurality of candidate information element tokens based at least in part on the lookup operation.