Skip to content

Commit

Permalink
Fix issue: token based throttling can not be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
SavinduDimal committed Oct 15, 2024
1 parent a11f54b commit 7f2777b
Showing 1 changed file with 12 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,18 @@ public static GenericArtifact createAPIArtifactContent(GenericArtifact artifact,
.getTokenBasedThrottlingConfiguration();
artifact.setAttribute(APIConstants.API_TOKEN_BASED_THROTTLING_ENABLED,
tokenBasedThrottlingCountHolder.isTokenBasedThrottlingEnabled().toString());
if (tokenBasedThrottlingCountHolder.getProductionMaxPromptTokenCount() != null) {
artifact.setAttribute(APIConstants.API_PRODUCTION_MAX_PROMPT_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getProductionMaxPromptTokenCount());
}
if (tokenBasedThrottlingCountHolder.getProductionMaxCompletionTokenCount() != null) {
artifact.setAttribute(APIConstants.API_PRODUCTION_MAX_COMPLETION_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getProductionMaxCompletionTokenCount());
}
if (tokenBasedThrottlingCountHolder.getProductionMaxTotalTokenCount() != null) {
artifact.setAttribute(APIConstants.API_PRODUCTION_MAX_TOTAL_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getProductionMaxTotalTokenCount());
}
if (tokenBasedThrottlingCountHolder.getSandboxMaxPromptTokenCount() != null) {
artifact.setAttribute(APIConstants.API_SANDBOX_MAX_PROMPT_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getSandboxMaxPromptTokenCount());
}
if (tokenBasedThrottlingCountHolder.getSandboxMaxCompletionTokenCount() != null) {
artifact.setAttribute(APIConstants.API_SANDBOX_MAX_COMPLETION_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getSandboxMaxCompletionTokenCount());
}
if (tokenBasedThrottlingCountHolder.getSandboxMaxTotalTokenCount() != null) {
artifact.setAttribute(APIConstants.API_SANDBOX_MAX_TOTAL_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getSandboxMaxTotalTokenCount());
}
artifact.setAttribute(APIConstants.API_PRODUCTION_MAX_PROMPT_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getProductionMaxPromptTokenCount());
artifact.setAttribute(APIConstants.API_PRODUCTION_MAX_COMPLETION_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getProductionMaxCompletionTokenCount());
artifact.setAttribute(APIConstants.API_PRODUCTION_MAX_TOTAL_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getProductionMaxTotalTokenCount());
artifact.setAttribute(APIConstants.API_SANDBOX_MAX_PROMPT_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getSandboxMaxPromptTokenCount());
artifact.setAttribute(APIConstants.API_SANDBOX_MAX_COMPLETION_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getSandboxMaxCompletionTokenCount());
artifact.setAttribute(APIConstants.API_SANDBOX_MAX_TOTAL_TOKEN_COUNT,
tokenBasedThrottlingCountHolder.getSandboxMaxTotalTokenCount());
}

String policies = policyBuilder.toString();
Expand Down

0 comments on commit 7f2777b

Please sign in to comment.