Skip to content

Commit f0ef207

Browse files
committed
added create endpoint with availability zone and list availability zones. still need to return availability zone per endpoint.
1 parent 2b1b702 commit f0ef207

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

src/together/cli/api/endpoints.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def endpoints(ctx: click.Context) -> None:
133133
help="Number of minutes of inactivity after which the endpoint will be automatically stopped. Set to 0 to disable.",
134134
)
135135
@click.option(
136-
"--user-specified-avzone",
137-
help="User-specified availability zone (e.g., us-central-4b)",
136+
"--availability-zone",
137+
help="Start endpoint in specified availability zone (e.g., us-central-4b)",
138138
)
139139
@click.option(
140140
"--wait",
@@ -156,7 +156,7 @@ def create(
156156
no_speculative_decoding: bool,
157157
no_auto_start: bool,
158158
inactive_timeout: int | None,
159-
user_specified_avzone: str | None,
159+
availability_zone: str | None,
160160
wait: bool,
161161
) -> None:
162162
"""Create a new dedicated inference endpoint."""
@@ -182,7 +182,7 @@ def create(
182182
disable_speculative_decoding=no_speculative_decoding,
183183
state="STOPPED" if no_auto_start else "STARTED",
184184
inactive_timeout=inactive_timeout,
185-
user_specified_avzone=user_specified_avzone,
185+
availability_zone=availability_zone,
186186
)
187187
except InvalidRequestError as e:
188188
print_api_error(e)
@@ -209,8 +209,8 @@ def create(
209209
click.echo(" Auto-start: disabled", err=True)
210210
if inactive_timeout is not None:
211211
click.echo(f" Inactive timeout: {inactive_timeout} minutes", err=True)
212-
if user_specified_avzone:
213-
click.echo(f" Availability zone: {user_specified_avzone}", err=True)
212+
if availability_zone:
213+
click.echo(f" Availability zone: {availability_zone}", err=True)
214214

215215
click.echo(f"Endpoint created successfully, id: {response.id}", err=True)
216216

@@ -458,22 +458,24 @@ def update(
458458
click.echo("Successfully updated endpoint", err=True)
459459
click.echo(endpoint_id)
460460

461+
461462
@endpoints.command()
462463
@click.option("--json", is_flag=True, help="Print output in JSON format")
463464
@click.pass_obj
464465
@handle_api_errors
465-
def avzones(client: Together, json: bool) -> None:
466-
"""List all available availability zones."""
466+
def availability_zones(client: Together, json: bool) -> None:
467+
"""List all availability zones."""
467468
avzones = client.endpoints.list_avzones()
468-
469+
469470
if not avzones:
470471
click.echo("No availability zones found", err=True)
471472
return
472-
473+
473474
if json:
474475
import json as json_lib
476+
475477
click.echo(json_lib.dumps({"avzones": avzones}, indent=2))
476478
else:
477479
click.echo("Available zones:", err=True)
478-
for avzone in sorted(avzones):
479-
click.echo(f" {avzone}")
480+
for availability_zone in sorted(avzones):
481+
click.echo(f" {availability_zone}")

src/together/resources/endpoints.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def create(
7676
disable_speculative_decoding: bool = True,
7777
state: Literal["STARTED", "STOPPED"] = "STARTED",
7878
inactive_timeout: Optional[int] = None,
79-
user_specified_avzone: Optional[str] = None,
79+
availability_zone: Optional[str] = None,
8080
) -> DedicatedEndpoint:
8181
"""
8282
Create a new dedicated endpoint.
@@ -91,7 +91,7 @@ def create(
9191
disable_speculative_decoding (bool, optional): Whether to disable speculative decoding. Defaults to False.
9292
state (str, optional): The desired state of the endpoint. Defaults to "STARTED".
9393
inactive_timeout (int, optional): The number of minutes of inactivity after which the endpoint will be automatically stopped. Set to 0 to disable automatic timeout.
94-
user_specified_avzone (str, optional): Start endpoint in specified availability zone (e.g., us-central-4b).
94+
availability_zone (str, optional): Start endpoint in specified availability zone (e.g., us-central-4b).
9595
9696
Returns:
9797
DedicatedEndpoint: Object containing endpoint information
@@ -118,8 +118,8 @@ def create(
118118
if inactive_timeout is not None:
119119
data["inactive_timeout"] = inactive_timeout
120120

121-
if user_specified_avzone is not None:
122-
data["user_specified_avzone"] = user_specified_avzone
121+
if availability_zone is not None:
122+
data["availability_zone"] = availability_zone
123123

124124
response, _, _ = requestor.request(
125125
options=TogetherRequest(
@@ -292,7 +292,7 @@ def list_avzones(self) -> List[str]:
292292
response, _, _ = requestor.request(
293293
options=TogetherRequest(
294294
method="GET",
295-
url="clusters/avzones",
295+
url="clusters/availability-zones",
296296
),
297297
stream=False,
298298
)
@@ -370,7 +370,7 @@ async def create(
370370
disable_speculative_decoding: bool = True,
371371
state: Literal["STARTED", "STOPPED"] = "STARTED",
372372
inactive_timeout: Optional[int] = None,
373-
user_specified_avzone: Optional[str] = None,
373+
availability_zone: Optional[str] = None,
374374
) -> DedicatedEndpoint:
375375
"""
376376
Create a new dedicated endpoint.
@@ -411,8 +411,8 @@ async def create(
411411
if inactive_timeout is not None:
412412
data["inactive_timeout"] = inactive_timeout
413413

414-
if user_specified_avzone is not None:
415-
data["user_specified_avzone"] = user_specified_avzone
414+
if availability_zone is not None:
415+
data["availability_zone"] = availability_zone
416416

417417
response, _, _ = await requestor.arequest(
418418
options=TogetherRequest(
@@ -575,7 +575,7 @@ async def list_hardware(
575575

576576
async def list_avzones(self) -> List[str]:
577577
"""
578-
List all available availability zones.
578+
List all availability zones.
579579
580580
Returns:
581581
List[str]: List of unique availability zones
@@ -587,7 +587,7 @@ async def list_avzones(self) -> List[str]:
587587
response, _, _ = await requestor.arequest(
588588
options=TogetherRequest(
589589
method="GET",
590-
url="clusters/avzones",
590+
url="clusters/availability-zones",
591591
),
592592
stream=False,
593593
)
@@ -596,4 +596,4 @@ async def list_avzones(self) -> List[str]:
596596
assert isinstance(response.data, dict)
597597
assert isinstance(response.data["avzones"], list)
598598

599-
return response.data["avzones"]
599+
return response.data["avzones"]

0 commit comments

Comments
 (0)