most-client 1.0.31__tar.gz → 1.0.32__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.32}/PKG-INFO +1 -1
- {most_client-1.0.31 → most_client-1.0.32}/most/api.py +11 -2
- {most_client-1.0.31 → most_client-1.0.32}/most/async_api.py +11 -2
- {most_client-1.0.31 → most_client-1.0.32}/most/types.py +19 -0
- {most_client-1.0.31 → most_client-1.0.32/most_client.egg-info}/PKG-INFO +1 -1
- {most_client-1.0.31 → most_client-1.0.32}/setup.py +1 -1
- {most_client-1.0.31 → most_client-1.0.32}/MANIFEST.in +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/README.md +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most/__init__.py +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most/_constrants.py +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most/async_trainer_api.py +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most/score_calculation.py +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most/trainer_api.py +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most_client.egg-info/SOURCES.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most_client.egg-info/dependency_links.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most_client.egg-info/requires.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most_client.egg-info/top_level.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/most_client.egg-info/zip-safe +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/requirements.txt +0 -0
- {most_client-1.0.31 → most_client-1.0.32}/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,
|
@@ -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,
|
@@ -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
|