Skip to content

Commit b9bb6e0

Browse files
authored
feat(cli): Add --json to fine-tuning retrieve (#272)
1 parent bae0065 commit b9bb6e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/together/lib/cli/api/fine_tuning/retrieve.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,26 @@
55
from rich.json import JSON
66

77
from together import Together
8+
from together._utils._json import openapi_dumps
89
from together.lib.cli.api._utils import handle_api_errors, generate_progress_bar
910
from together.lib.utils.serializer import datetime_serializer
1011

1112

1213
@click.command()
1314
@click.pass_context
1415
@click.argument("fine_tune_id", type=str, required=True)
16+
@click.option("--json", is_flag=True, help="Output the response in JSON format")
1517
@handle_api_errors("Fine-tuning")
16-
def retrieve(ctx: click.Context, fine_tune_id: str) -> None:
18+
def retrieve(ctx: click.Context, fine_tune_id: str, json: bool) -> None:
1719
"""Retrieve fine-tuning job details"""
1820
client: Together = ctx.obj
1921

2022
response = client.fine_tuning.retrieve(fine_tune_id)
2123

24+
if json:
25+
click.echo(openapi_dumps(response.model_dump(exclude_none=True)))
26+
return
27+
2228
# remove events from response for cleaner output
2329
response.events = None
2430

0 commit comments

Comments
 (0)