Skip to content

Commit e08d693

Browse files
committed
handle the string case in audio directly
1 parent a5ad0a7 commit e08d693

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Diff for: src/openai/cli/_api/audio.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import sys
34
from typing import TYPE_CHECKING, Any, Optional, cast
45
from argparse import ArgumentParser
56

@@ -75,7 +76,10 @@ def transcribe(args: CLITranscribeArgs) -> None:
7576
# but we don't want to validate that here for forwards-compat
7677
response_format=cast(Any, args.response_format),
7778
)
78-
print_model(model)
79+
if isinstance(model, str):
80+
sys.stdout.write(model + "\n")
81+
else:
82+
print_model(model)
7983

8084
@staticmethod
8185
def translate(args: CLITranslationArgs) -> None:
@@ -91,4 +95,7 @@ def translate(args: CLITranslationArgs) -> None:
9195
# but we don't want to validate that here for forwards-compat
9296
response_format=cast(Any, args.response_format),
9397
)
94-
print_model(model)
98+
if isinstance(model, str):
99+
sys.stdout.write(model + "\n")
100+
else:
101+
print_model(model)

Diff for: src/openai/cli/_utils.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ def organization_info() -> str:
3333

3434

3535
def print_model(model: BaseModel) -> None:
36-
if isinstance(model, BaseModel):
37-
sys.stdout.write(model_json(model, indent=2) + "\n")
38-
elif isinstance(model, str):
39-
sys.stdout.write(model)
36+
sys.stdout.write(model_json(model, indent=2) + "\n")
4037

4138

4239
def can_use_http2() -> bool:

0 commit comments

Comments
 (0)