Skip to content

Commit

Permalink
Merge pull request #460 from dvonthenen/fix-reported-issues-manage
Browse files Browse the repository at this point in the history
Fix Reported Manage Issues
  • Loading branch information
dvonthenen authored Sep 10, 2024
2 parents 0cb8467 + d0618f4 commit 66e649b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion deepgram/clients/listen/v1/rest/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PrerecordedOptions(
custom_intent_mode: Optional[str] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
custom_topics: Optional[Union[List[str], str]] = field(
custom_topic: Optional[Union[List[str], str]] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
custom_topic_mode: Optional[str] = field(
Expand Down
23 changes: 18 additions & 5 deletions deepgram/clients/manage/v1/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,18 @@ class Details(BaseResponse): # pylint: disable=too-many-instance-attributes

config: Config
usd: float = 0
duration: float = 0
total_audio: float = 0
channels: int = 0
streams: int = 0
duration: Optional[float] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
total_audio: Optional[float] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
channels: Optional[int] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
streams: Optional[int] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
method: str = ""
tier: Optional[str] = ""
models: List[str] = field(default_factory=list)
Expand Down Expand Up @@ -471,9 +479,14 @@ class Response(BaseResponse):
Response object
"""

details: Details
details: Optional[Details] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
code: int = 0
completed: str = ""
message: Optional[str] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
tts_details: Optional[TTSDetails] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
Expand Down
18 changes: 9 additions & 9 deletions examples/manage/usage/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,30 @@ def main():
print("")

# get request
reqResp = deepgram.manage.v("1").get_usage_request(myId, requestId)
if reqResp is None:
getResp = deepgram.manage.v("1").get_usage_request(myId, requestId)
if getResp is None:
print("No request found")
else:
print(f"GetUsageRequest() - listResp: {listResp}")
print(f"GetUsageRequest() - getResp: {getResp}")
print("")

# get fields
options: UsageFieldsOptions = {}
listResp = deepgram.manage.v("1").get_usage_fields(myId, options)
if listResp is None:
listFields = deepgram.manage.v("1").get_usage_fields(myId, options)
if listFields is None:
print(f"UsageFields not found.")
sys.exit(1)
else:
print(f"GetUsageFields Models - listResp: {listResp}")
print(f"GetUsageFields Models - listFields: {listFields}")
print("")

# list usage
options: UsageSummaryOptions = {}
listResp = deepgram.manage.v("1").get_usage_summary(myId, options)
if listResp is None:
getSummary = deepgram.manage.v("1").get_usage_summary(myId, options)
if getSummary is None:
print("UsageSummary not found")
else:
print(f"GetSummary - listResp: {listResp}")
print(f"GetSummary - getSummary: {getSummary}")
except Exception as e:
print(f"Exception: {e}")

Expand Down

0 comments on commit 66e649b

Please sign in to comment.