Skip to content

Commit

Permalink
handle the string case in audio directly
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie committed Jul 22, 2024
1 parent a5ad0a7 commit e08d693
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/openai/cli/_api/audio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Any, Optional, cast
from argparse import ArgumentParser

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

@staticmethod
def translate(args: CLITranslationArgs) -> None:
Expand All @@ -91,4 +95,7 @@ def translate(args: CLITranslationArgs) -> None:
# but we don't want to validate that here for forwards-compat
response_format=cast(Any, args.response_format),
)
print_model(model)
if isinstance(model, str):
sys.stdout.write(model + "\n")
else:
print_model(model)
5 changes: 1 addition & 4 deletions src/openai/cli/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ def organization_info() -> str:


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


def can_use_http2() -> bool:
Expand Down

0 comments on commit e08d693

Please sign in to comment.