Skip to content

Commit

Permalink
added new types
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-ya committed Feb 14, 2024
1 parent 292df28 commit 9b9bcf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 5 additions & 8 deletions outpostcli/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def list_endpoints(api_token, entity):
"--visibility",
type=click.Choice(["private", "public", "internal"]),
# type=str,
default="private",
help="visibility of the endpoint",
required=False,
)
Expand Down Expand Up @@ -169,13 +170,12 @@ def create_endpoint(
replica_scaling_min: int,
replica_scaling_max: int,
visibility: str,
replica_scaling_scaledowm_period: int,
replica_scaling_scaledown_period: int,
replica_scaling_target_pending_req: int,
):
client = Client(api_token=api_token)
if template_path:
[actual_path, class_name] = template_path.rsplit(":", 1)
click.echo(f"{actual_path},{class_name}")
if not actual_path or not class_name:
click.echo(
"Please specify the template classname along with the path.", err=True
Expand All @@ -187,7 +187,6 @@ def create_endpoint(
try:
result = urlparse(actual_path)
if all([result.scheme, result.netloc]):
click.echo("url")
data = {
"templateType": "custom",
"customTemplateConfig": {
Expand All @@ -203,7 +202,7 @@ def create_endpoint(
"replicaScalingConfig": {
"min": replica_scaling_min,
"max": replica_scaling_max,
"scaledownPeriod": replica_scaling_scaledowm_period,
"scaledownPeriod": replica_scaling_scaledown_period,
"targetPendingRequests": replica_scaling_target_pending_req,
},
}
Expand All @@ -212,8 +211,6 @@ def create_endpoint(
raise ValueError("Not an url.")
except ValueError:
if os.path.exists(actual_path) and os.path.isfile(actual_path):
click.echo("file")
# do something
data = {
"templateType": "custom",
"customTemplateConfig": {
Expand All @@ -228,7 +225,7 @@ def create_endpoint(
"replicaScalingConfig": {
"min": replica_scaling_min,
"max": replica_scaling_max,
"scaledownPeriod": replica_scaling_scaledowm_period,
"scaledownPeriod": replica_scaling_scaledown_period,
"targetPendingRequests": replica_scaling_target_pending_req,
},
}
Expand Down Expand Up @@ -278,7 +275,7 @@ def create_endpoint(
"replicaScalingConfig": {
"min": replica_scaling_min,
"max": replica_scaling_max,
"scaledownPeriod": replica_scaling_scaledowm_period,
"scaledownPeriod": replica_scaling_scaledown_period,
"targetPendingRequests": replica_scaling_target_pending_req,
},
}
Expand Down
8 changes: 4 additions & 4 deletions outpostcli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import click
from outpostkit._types.endpoint import (
InferenceAutogeneratedHFModelDetails,
InferenceAutogeneratedOutpostModelDetails,
EndpointAutogeneratedHFModelDetails,
EndpointAutogeneratedOutpostModelDetails,
)
from rich.console import Console

Expand Down Expand Up @@ -60,8 +60,8 @@ def check_token(token: str):

def combine_inf_load_source_model(
load_source,
outpost_model: Optional[InferenceAutogeneratedOutpostModelDetails],
hf_model: Optional[InferenceAutogeneratedHFModelDetails],
outpost_model: Optional[EndpointAutogeneratedOutpostModelDetails],
hf_model: Optional[EndpointAutogeneratedHFModelDetails],
):
if load_source == "hugginface" and hf_model:
return f"hf:{hf_model.id}"
Expand Down

0 comments on commit 9b9bcf1

Please sign in to comment.