Skip to content

Commit

Permalink
Update DTO to move token based throttling into maxTps
Browse files Browse the repository at this point in the history
  • Loading branch information
SavinduDimal committed Sep 24, 2024
1 parent 9628dbe commit dc9ad94
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10177,39 +10177,6 @@ components:
type: string
llmProviderApiVersion:
type: string
throttlingConfiguration:
type: object
required:
- isTokenBasedThrottlingEnabled
properties:
productionMaxPromptTokenCount:
type: integer
description: "Maximum prompt token count for production"
format: int64
productionMaxCompletionTokenCount:
type: integer
description: "Maximum completion token count for production"
format: int64
productionMaxTotalTokenCount:
type: integer
description: "Maximum total token count for production"
format: int64
sandboxMaxPromptTokenCount:
type: integer
description: "Maximum prompt token count for sandbox"
format: int64
sandboxMaxCompletionTokenCount:
type: integer
description: "Maximum completion token count for sandbox"
format: int64
sandboxMaxTotalTokenCount:
type: integer
description: "Maximum total token count for sandbox"
format: int64
isTokenBasedThrottlingEnabled:
type: boolean
default: false
description: "Whether token-based throttling is enabled"
scopes:
type: array
items:
Expand Down Expand Up @@ -11821,7 +11788,7 @@ components:
example: 1000
productionTimeUnit:
type: string
description: "Time unit for the production in milliseconds. Possible values are 1sec, 1min, 1hour"
description: "Time unit for the production."
default: SECOND
enum:
- SECOND
Expand All @@ -11833,12 +11800,45 @@ components:
example: 1000
sandboxTimeUnit:
type: string
description: "Time unit for the sandbox in milliseconds. Possible values are 1sec, 1min, 1hour"
description: "Time unit for the sandbox."
default: SECOND
enum:
- SECOND
- MINUTE
- HOUR
tokenBasedThrottlingConfiguration:
type: object
required:
- isTokenBasedThrottlingEnabled
properties:
productionMaxPromptTokenCount:
type: integer
description: "Maximum prompt token count for production"
format: int64
productionMaxCompletionTokenCount:
type: integer
description: "Maximum completion token count for production"
format: int64
productionMaxTotalTokenCount:
type: integer
description: "Maximum total token count for production"
format: int64
sandboxMaxPromptTokenCount:
type: integer
description: "Maximum prompt token count for sandbox"
format: int64
sandboxMaxCompletionTokenCount:
type: integer
description: "Maximum completion token count for sandbox"
format: int64
sandboxMaxTotalTokenCount:
type: integer
description: "Maximum total token count for sandbox"
format: int64
isTokenBasedThrottlingEnabled:
type: boolean
default: false
description: "Whether token-based throttling is enabled"
APIBusinessInformation:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIAiConfigurationThrottlingConfigurationDTO;
import javax.validation.constraints.*;


Expand All @@ -23,7 +22,6 @@ public class APIAiConfigurationDTO {

private String llmProviderName = null;
private String llmProviderApiVersion = null;
private APIAiConfigurationThrottlingConfigurationDTO throttlingConfiguration = null;

/**
**/
Expand Down Expand Up @@ -59,24 +57,6 @@ public void setLlmProviderApiVersion(String llmProviderApiVersion) {
this.llmProviderApiVersion = llmProviderApiVersion;
}

/**
**/
public APIAiConfigurationDTO throttlingConfiguration(APIAiConfigurationThrottlingConfigurationDTO throttlingConfiguration) {
this.throttlingConfiguration = throttlingConfiguration;
return this;
}


@ApiModelProperty(value = "")
@Valid
@JsonProperty("throttlingConfiguration")
public APIAiConfigurationThrottlingConfigurationDTO getThrottlingConfiguration() {
return throttlingConfiguration;
}
public void setThrottlingConfiguration(APIAiConfigurationThrottlingConfigurationDTO throttlingConfiguration) {
this.throttlingConfiguration = throttlingConfiguration;
}


@Override
public boolean equals(java.lang.Object o) {
Expand All @@ -88,13 +68,12 @@ public boolean equals(java.lang.Object o) {
}
APIAiConfigurationDTO apIAiConfiguration = (APIAiConfigurationDTO) o;
return Objects.equals(llmProviderName, apIAiConfiguration.llmProviderName) &&
Objects.equals(llmProviderApiVersion, apIAiConfiguration.llmProviderApiVersion) &&
Objects.equals(throttlingConfiguration, apIAiConfiguration.throttlingConfiguration);
Objects.equals(llmProviderApiVersion, apIAiConfiguration.llmProviderApiVersion);
}

@Override
public int hashCode() {
return Objects.hash(llmProviderName, llmProviderApiVersion, throttlingConfiguration);
return Objects.hash(llmProviderName, llmProviderApiVersion);
}

@Override
Expand All @@ -104,7 +83,6 @@ public String toString() {

sb.append(" llmProviderName: ").append(toIndentedString(llmProviderName)).append("\n");
sb.append(" llmProviderApiVersion: ").append(toIndentedString(llmProviderApiVersion)).append("\n");
sb.append(" throttlingConfiguration: ").append(toIndentedString(throttlingConfiguration)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIMaxTpsTokenBasedThrottlingConfigurationDTO;
import javax.validation.constraints.*;


Expand Down Expand Up @@ -88,6 +89,7 @@ public static SandboxTimeUnitEnum fromValue(String v) {
}
}
private SandboxTimeUnitEnum sandboxTimeUnit = SandboxTimeUnitEnum.SECOND;
private APIMaxTpsTokenBasedThrottlingConfigurationDTO tokenBasedThrottlingConfiguration = null;

/**
**/
Expand All @@ -107,15 +109,15 @@ public void setProduction(Long production) {
}

/**
* Time unit for the production in milliseconds. Possible values are 1sec, 1min, 1hour
* Time unit for the production.
**/
public APIMaxTpsDTO productionTimeUnit(ProductionTimeUnitEnum productionTimeUnit) {
this.productionTimeUnit = productionTimeUnit;
return this;
}


@ApiModelProperty(value = "Time unit for the production in milliseconds. Possible values are 1sec, 1min, 1hour")
@ApiModelProperty(value = "Time unit for the production.")
@JsonProperty("productionTimeUnit")
public ProductionTimeUnitEnum getProductionTimeUnit() {
return productionTimeUnit;
Expand All @@ -142,15 +144,15 @@ public void setSandbox(Long sandbox) {
}

/**
* Time unit for the sandbox in milliseconds. Possible values are 1sec, 1min, 1hour
* Time unit for the sandbox.
**/
public APIMaxTpsDTO sandboxTimeUnit(SandboxTimeUnitEnum sandboxTimeUnit) {
this.sandboxTimeUnit = sandboxTimeUnit;
return this;
}


@ApiModelProperty(value = "Time unit for the sandbox in milliseconds. Possible values are 1sec, 1min, 1hour")
@ApiModelProperty(value = "Time unit for the sandbox.")
@JsonProperty("sandboxTimeUnit")
public SandboxTimeUnitEnum getSandboxTimeUnit() {
return sandboxTimeUnit;
Expand All @@ -159,6 +161,24 @@ public void setSandboxTimeUnit(SandboxTimeUnitEnum sandboxTimeUnit) {
this.sandboxTimeUnit = sandboxTimeUnit;
}

/**
**/
public APIMaxTpsDTO tokenBasedThrottlingConfiguration(APIMaxTpsTokenBasedThrottlingConfigurationDTO tokenBasedThrottlingConfiguration) {
this.tokenBasedThrottlingConfiguration = tokenBasedThrottlingConfiguration;
return this;
}


@ApiModelProperty(value = "")
@Valid
@JsonProperty("tokenBasedThrottlingConfiguration")
public APIMaxTpsTokenBasedThrottlingConfigurationDTO getTokenBasedThrottlingConfiguration() {
return tokenBasedThrottlingConfiguration;
}
public void setTokenBasedThrottlingConfiguration(APIMaxTpsTokenBasedThrottlingConfigurationDTO tokenBasedThrottlingConfiguration) {
this.tokenBasedThrottlingConfiguration = tokenBasedThrottlingConfiguration;
}


@Override
public boolean equals(java.lang.Object o) {
Expand All @@ -172,12 +192,13 @@ public boolean equals(java.lang.Object o) {
return Objects.equals(production, apIMaxTps.production) &&
Objects.equals(productionTimeUnit, apIMaxTps.productionTimeUnit) &&
Objects.equals(sandbox, apIMaxTps.sandbox) &&
Objects.equals(sandboxTimeUnit, apIMaxTps.sandboxTimeUnit);
Objects.equals(sandboxTimeUnit, apIMaxTps.sandboxTimeUnit) &&
Objects.equals(tokenBasedThrottlingConfiguration, apIMaxTps.tokenBasedThrottlingConfiguration);
}

@Override
public int hashCode() {
return Objects.hash(production, productionTimeUnit, sandbox, sandboxTimeUnit);
return Objects.hash(production, productionTimeUnit, sandbox, sandboxTimeUnit, tokenBasedThrottlingConfiguration);
}

@Override
Expand All @@ -189,6 +210,7 @@ public String toString() {
sb.append(" productionTimeUnit: ").append(toIndentedString(productionTimeUnit)).append("\n");
sb.append(" sandbox: ").append(toIndentedString(sandbox)).append("\n");
sb.append(" sandboxTimeUnit: ").append(toIndentedString(sandboxTimeUnit)).append("\n");
sb.append(" tokenBasedThrottlingConfiguration: ").append(toIndentedString(tokenBasedThrottlingConfiguration)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@



public class APIAiConfigurationThrottlingConfigurationDTO {
public class APIMaxTpsTokenBasedThrottlingConfigurationDTO {

private Long productionMaxPromptTokenCount = null;
private Long productionMaxCompletionTokenCount = null;
Expand All @@ -31,7 +31,7 @@ public class APIAiConfigurationThrottlingConfigurationDTO {
/**
* Maximum prompt token count for production
**/
public APIAiConfigurationThrottlingConfigurationDTO productionMaxPromptTokenCount(Long productionMaxPromptTokenCount) {
public APIMaxTpsTokenBasedThrottlingConfigurationDTO productionMaxPromptTokenCount(Long productionMaxPromptTokenCount) {
this.productionMaxPromptTokenCount = productionMaxPromptTokenCount;
return this;
}
Expand All @@ -49,7 +49,7 @@ public void setProductionMaxPromptTokenCount(Long productionMaxPromptTokenCount)
/**
* Maximum completion token count for production
**/
public APIAiConfigurationThrottlingConfigurationDTO productionMaxCompletionTokenCount(Long productionMaxCompletionTokenCount) {
public APIMaxTpsTokenBasedThrottlingConfigurationDTO productionMaxCompletionTokenCount(Long productionMaxCompletionTokenCount) {
this.productionMaxCompletionTokenCount = productionMaxCompletionTokenCount;
return this;
}
Expand All @@ -67,7 +67,7 @@ public void setProductionMaxCompletionTokenCount(Long productionMaxCompletionTok
/**
* Maximum total token count for production
**/
public APIAiConfigurationThrottlingConfigurationDTO productionMaxTotalTokenCount(Long productionMaxTotalTokenCount) {
public APIMaxTpsTokenBasedThrottlingConfigurationDTO productionMaxTotalTokenCount(Long productionMaxTotalTokenCount) {
this.productionMaxTotalTokenCount = productionMaxTotalTokenCount;
return this;
}
Expand All @@ -85,7 +85,7 @@ public void setProductionMaxTotalTokenCount(Long productionMaxTotalTokenCount) {
/**
* Maximum prompt token count for sandbox
**/
public APIAiConfigurationThrottlingConfigurationDTO sandboxMaxPromptTokenCount(Long sandboxMaxPromptTokenCount) {
public APIMaxTpsTokenBasedThrottlingConfigurationDTO sandboxMaxPromptTokenCount(Long sandboxMaxPromptTokenCount) {
this.sandboxMaxPromptTokenCount = sandboxMaxPromptTokenCount;
return this;
}
Expand All @@ -103,7 +103,7 @@ public void setSandboxMaxPromptTokenCount(Long sandboxMaxPromptTokenCount) {
/**
* Maximum completion token count for sandbox
**/
public APIAiConfigurationThrottlingConfigurationDTO sandboxMaxCompletionTokenCount(Long sandboxMaxCompletionTokenCount) {
public APIMaxTpsTokenBasedThrottlingConfigurationDTO sandboxMaxCompletionTokenCount(Long sandboxMaxCompletionTokenCount) {
this.sandboxMaxCompletionTokenCount = sandboxMaxCompletionTokenCount;
return this;
}
Expand All @@ -121,7 +121,7 @@ public void setSandboxMaxCompletionTokenCount(Long sandboxMaxCompletionTokenCoun
/**
* Maximum total token count for sandbox
**/
public APIAiConfigurationThrottlingConfigurationDTO sandboxMaxTotalTokenCount(Long sandboxMaxTotalTokenCount) {
public APIMaxTpsTokenBasedThrottlingConfigurationDTO sandboxMaxTotalTokenCount(Long sandboxMaxTotalTokenCount) {
this.sandboxMaxTotalTokenCount = sandboxMaxTotalTokenCount;
return this;
}
Expand All @@ -139,7 +139,7 @@ public void setSandboxMaxTotalTokenCount(Long sandboxMaxTotalTokenCount) {
/**
* Whether token-based throttling is enabled
**/
public APIAiConfigurationThrottlingConfigurationDTO isTokenBasedThrottlingEnabled(Boolean isTokenBasedThrottlingEnabled) {
public APIMaxTpsTokenBasedThrottlingConfigurationDTO isTokenBasedThrottlingEnabled(Boolean isTokenBasedThrottlingEnabled) {
this.isTokenBasedThrottlingEnabled = isTokenBasedThrottlingEnabled;
return this;
}
Expand All @@ -164,14 +164,14 @@ public boolean equals(java.lang.Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
APIAiConfigurationThrottlingConfigurationDTO apIAiConfigurationThrottlingConfiguration = (APIAiConfigurationThrottlingConfigurationDTO) o;
return Objects.equals(productionMaxPromptTokenCount, apIAiConfigurationThrottlingConfiguration.productionMaxPromptTokenCount) &&
Objects.equals(productionMaxCompletionTokenCount, apIAiConfigurationThrottlingConfiguration.productionMaxCompletionTokenCount) &&
Objects.equals(productionMaxTotalTokenCount, apIAiConfigurationThrottlingConfiguration.productionMaxTotalTokenCount) &&
Objects.equals(sandboxMaxPromptTokenCount, apIAiConfigurationThrottlingConfiguration.sandboxMaxPromptTokenCount) &&
Objects.equals(sandboxMaxCompletionTokenCount, apIAiConfigurationThrottlingConfiguration.sandboxMaxCompletionTokenCount) &&
Objects.equals(sandboxMaxTotalTokenCount, apIAiConfigurationThrottlingConfiguration.sandboxMaxTotalTokenCount) &&
Objects.equals(isTokenBasedThrottlingEnabled, apIAiConfigurationThrottlingConfiguration.isTokenBasedThrottlingEnabled);
APIMaxTpsTokenBasedThrottlingConfigurationDTO apIMaxTpsTokenBasedThrottlingConfiguration = (APIMaxTpsTokenBasedThrottlingConfigurationDTO) o;
return Objects.equals(productionMaxPromptTokenCount, apIMaxTpsTokenBasedThrottlingConfiguration.productionMaxPromptTokenCount) &&
Objects.equals(productionMaxCompletionTokenCount, apIMaxTpsTokenBasedThrottlingConfiguration.productionMaxCompletionTokenCount) &&
Objects.equals(productionMaxTotalTokenCount, apIMaxTpsTokenBasedThrottlingConfiguration.productionMaxTotalTokenCount) &&
Objects.equals(sandboxMaxPromptTokenCount, apIMaxTpsTokenBasedThrottlingConfiguration.sandboxMaxPromptTokenCount) &&
Objects.equals(sandboxMaxCompletionTokenCount, apIMaxTpsTokenBasedThrottlingConfiguration.sandboxMaxCompletionTokenCount) &&
Objects.equals(sandboxMaxTotalTokenCount, apIMaxTpsTokenBasedThrottlingConfiguration.sandboxMaxTotalTokenCount) &&
Objects.equals(isTokenBasedThrottlingEnabled, apIMaxTpsTokenBasedThrottlingConfiguration.isTokenBasedThrottlingEnabled);
}

@Override
Expand All @@ -182,7 +182,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class APIAiConfigurationThrottlingConfigurationDTO {\n");
sb.append("class APIMaxTpsTokenBasedThrottlingConfigurationDTO {\n");

sb.append(" productionMaxPromptTokenCount: ").append(toIndentedString(productionMaxPromptTokenCount)).append("\n");
sb.append(" productionMaxCompletionTokenCount: ").append(toIndentedString(productionMaxCompletionTokenCount)).append("\n");
Expand Down
Loading

0 comments on commit dc9ad94

Please sign in to comment.