Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Design and implement a strategy for optimizing token usage, including token limits, loop controls, and tool calls

A worked example

Yes or no

Several agent applications call a shared model deployment in Microsoft Foundry through an Azure API Management AI gateway. Each application uses its own API Management subscription. An administrator adds the policy shown in the exhibit to the inbound section of the language model API.

<inbound> <base /> <llm-token-limit counter-key="@(context.Subscription.Id)" tokens-per-minute="5000" estimate-prompt-tokens="false" remaining-tokens-variable-name="remainingTokens" /> </inbound>

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

StatementYesNo
The 5,000 tokens-per-minute limit is tracked separately for each application's subscription.

The source explains that token limits apply per counter key. The subscription ID supplies that key, so each application's subscription has a separate counter.

Correct
The shown policy also configures a monthly token quota for each application.

The source distinguishes a TPM limit from a token quota over a longer period. The exhibit configures a per-minute limit but specifies no monthly quota.

Correct
To apply the limit per originating IP address instead, the administrator can keep the llm-token-limit policy and change the counter-key value to @(context.Request.IpAddress).

The source identifies originating IP address as a supported counter key. Using the request IP address therefore changes the grouping from subscription to caller IP.

Correct
Why

The policy groups token consumption by its counter key, so subscription IDs give the applications separate TPM counters. The exhibit specifies a per-minute rate without configuring a monthly token quota. Using the request IP address as the key instead groups consumption by originating IP.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free