most-client 1.0.31__tar.gz → 1.0.33__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {most_client-1.0.31/most_client.egg-info → most_client-1.0.33}/PKG-INFO +1 -1
- {most_client-1.0.31 → most_client-1.0.33}/most/api.py +14 -5
- {most_client-1.0.31 → most_client-1.0.33}/most/async_api.py +12 -3
- {most_client-1.0.31 → most_client-1.0.33}/most/types.py +19 -0
- {most_client-1.0.31 → most_client-1.0.33/most_client.egg-info}/PKG-INFO +1 -1
- {most_client-1.0.31 → most_client-1.0.33}/setup.py +1 -1
- {most_client-1.0.31 → most_client-1.0.33}/MANIFEST.in +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/README.md +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most/__init__.py +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most/_constrants.py +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most/async_trainer_api.py +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most/score_calculation.py +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most/trainer_api.py +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most_client.egg-info/SOURCES.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most_client.egg-info/dependency_links.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most_client.egg-info/requires.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most_client.egg-info/top_level.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/most_client.egg-info/zip-safe +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/requirements.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.33}/setup.cfg +0 -0
@@ -18,7 +18,7 @@ from most.types import (
|
|
18
18
|
Script,
|
19
19
|
StoredAudioData,
|
20
20
|
Text,
|
21
|
-
is_valid_id, SearchParams, ScriptScoreMapping, Dialog,
|
21
|
+
is_valid_id, SearchParams, ScriptScoreMapping, Dialog, Usage,
|
22
22
|
)
|
23
23
|
|
24
24
|
|
@@ -26,7 +26,7 @@ class MostClient(object):
|
|
26
26
|
retort = Retort(recipe=[
|
27
27
|
loader(int, lambda x: int(x)),
|
28
28
|
loader(float, lambda x: float(x)),
|
29
|
-
loader(datetime, lambda x: datetime.fromtimestamp(x).
|
29
|
+
loader(datetime, lambda x: datetime.fromtimestamp(x).astimezone(tz=timezone.utc) if isinstance(x, (int, float)) else datetime.fromisoformat(x)),
|
30
30
|
],)
|
31
31
|
|
32
32
|
def __init__(self,
|
@@ -133,7 +133,7 @@ class MostClient(object):
|
|
133
133
|
headers=headers,
|
134
134
|
**kwargs)
|
135
135
|
if resp.status_code >= 400:
|
136
|
-
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else
|
136
|
+
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else resp.content)
|
137
137
|
return resp
|
138
138
|
|
139
139
|
def put(self, url, **kwargs):
|
@@ -151,7 +151,7 @@ class MostClient(object):
|
|
151
151
|
headers=headers,
|
152
152
|
**kwargs)
|
153
153
|
if resp.status_code >= 400:
|
154
|
-
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else
|
154
|
+
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else resp.content)
|
155
155
|
return resp
|
156
156
|
|
157
157
|
def post(self, url,
|
@@ -393,7 +393,7 @@ class MostClient(object):
|
|
393
393
|
})
|
394
394
|
return self.retort.load(resp.json(), StoredAudioData)
|
395
395
|
|
396
|
-
def fetch_info(self, audio_id: str) -> Dict[str, str]:
|
396
|
+
def fetch_info(self, audio_id: str) -> Dict[str, str | int | float]:
|
397
397
|
if not is_valid_id(audio_id):
|
398
398
|
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
399
399
|
|
@@ -444,3 +444,12 @@ class MostClient(object):
|
|
444
444
|
raise RuntimeError("Audio can't be indexed")
|
445
445
|
audio_list = resp.json()
|
446
446
|
return self.retort.load(audio_list, List[Audio])
|
447
|
+
|
448
|
+
def get_usage(self,
|
449
|
+
start_dt: datetime,
|
450
|
+
end_dt: datetime):
|
451
|
+
resp = self.get(f"/{self.client_id}/model/{self.model_id}/usage",
|
452
|
+
params={'start_dt': start_dt.astimezone(timezone.utc).isoformat(),
|
453
|
+
'end_dt': end_dt.astimezone(timezone.utc).isoformat()})
|
454
|
+
resp.raise_for_status()
|
455
|
+
return self.retort.load(resp.json(), Usage)
|
@@ -18,7 +18,7 @@ from most.types import (
|
|
18
18
|
Script,
|
19
19
|
StoredAudioData,
|
20
20
|
Text,
|
21
|
-
is_valid_id, SearchParams, ScriptScoreMapping, Dialog,
|
21
|
+
is_valid_id, SearchParams, ScriptScoreMapping, Dialog, Usage,
|
22
22
|
)
|
23
23
|
|
24
24
|
|
@@ -26,7 +26,7 @@ class AsyncMostClient(object):
|
|
26
26
|
retort = Retort(recipe=[
|
27
27
|
loader(int, lambda x: int(x)),
|
28
28
|
loader(float, lambda x: float(x)),
|
29
|
-
loader(datetime, lambda x: datetime.fromtimestamp(x).
|
29
|
+
loader(datetime, lambda x: datetime.fromtimestamp(x).astimezone(tz=timezone.utc) if isinstance(x, (int, float)) else datetime.fromisoformat(x)),
|
30
30
|
])
|
31
31
|
|
32
32
|
def __init__(self,
|
@@ -400,7 +400,7 @@ class AsyncMostClient(object):
|
|
400
400
|
})
|
401
401
|
return self.retort.load(resp.json(), StoredAudioData)
|
402
402
|
|
403
|
-
async def fetch_info(self, audio_id: str) -> Dict[str, str]:
|
403
|
+
async def fetch_info(self, audio_id: str) -> Dict[str, str | int | float]:
|
404
404
|
if not is_valid_id(audio_id):
|
405
405
|
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
406
406
|
resp = await self.get(f"/{self.client_id}/audio/{audio_id}/info")
|
@@ -450,3 +450,12 @@ class AsyncMostClient(object):
|
|
450
450
|
raise RuntimeError("Audio can't be indexed")
|
451
451
|
audio_list = resp.json()
|
452
452
|
return self.retort.load(audio_list, List[Audio])
|
453
|
+
|
454
|
+
async def get_usage(self,
|
455
|
+
start_dt: datetime,
|
456
|
+
end_dt: datetime):
|
457
|
+
resp = await self.get(f"/{self.client_id}/model/{self.model_id}/usage",
|
458
|
+
params={'start_dt': start_dt.astimezone(timezone.utc).isoformat(),
|
459
|
+
'end_dt': end_dt.astimezone(timezone.utc).isoformat()})
|
460
|
+
resp.raise_for_status()
|
461
|
+
return self.retort.load(resp.json(), Usage)
|
@@ -173,6 +173,25 @@ class HumanFeedback(DataClassJsonMixin):
|
|
173
173
|
return sum((preds[key] == gt[key]) for key in common_keys) / len(common_keys)
|
174
174
|
|
175
175
|
|
176
|
+
@dataclass_json
|
177
|
+
@dataclass
|
178
|
+
class Usage(DataClassJsonMixin):
|
179
|
+
apply_audio_async: int
|
180
|
+
apply_audio_async_duration: int
|
181
|
+
apply_text_async: int
|
182
|
+
|
183
|
+
apply_audio: int
|
184
|
+
apply_audio_duration: int
|
185
|
+
apply_text: int
|
186
|
+
|
187
|
+
upload_audio: int
|
188
|
+
upload_audio_duration: int
|
189
|
+
upload_text: int
|
190
|
+
|
191
|
+
start_dt: datetime
|
192
|
+
end_dt: datetime
|
193
|
+
|
194
|
+
|
176
195
|
def is_valid_objectid(oid: str) -> bool:
|
177
196
|
"""
|
178
197
|
Check if a given string is a valid MongoDB ObjectId (24-character hex).
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|