most-client 1.0.43__py3-none-any.whl → 1.0.45__py3-none-any.whl

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/api.py CHANGED
@@ -454,6 +454,14 @@ class MostClient(object):
454
454
  raise RuntimeError("Audio can't be indexed")
455
455
  return None
456
456
 
457
+ def search_by_indexed_audio(self, query: str, limit: int) -> List:
458
+ resp = self.get(f"/{self.client_id}/model/{self.model_id}/search_elastic",
459
+ params={"query": query,
460
+ "limit": limit})
461
+ if resp.status_code >= 400:
462
+ raise RuntimeError("Audio can't be indexed")
463
+ return resp.json()
464
+
457
465
  def get_usage(self,
458
466
  start_dt: datetime,
459
467
  end_dt: datetime):
most/async_api.py CHANGED
@@ -462,6 +462,14 @@ class AsyncMostClient(object):
462
462
  raise RuntimeError("Audio can't be indexed")
463
463
  return None
464
464
 
465
+ async def search_by_indexed_audio(self, query: str, limit: int) -> List:
466
+ resp = await self.get(f"/{self.client_id}/model/{self.model_id}/search_elastic",
467
+ params={"query": query,
468
+ "limit": limit})
469
+ if resp.status_code >= 400:
470
+ raise RuntimeError("Audio can't be indexed")
471
+ return resp.json()
472
+
465
473
  async def get_usage(self,
466
474
  start_dt: datetime,
467
475
  end_dt: datetime):
most/types.py CHANGED
@@ -203,6 +203,13 @@ def is_valid_objectid(oid: str) -> bool:
203
203
  return bool(re.fullmatch(r"^[0-9a-fA-F]{24}$", oid))
204
204
 
205
205
 
206
+ def is_valid_english_word(text: str) -> bool:
207
+ """
208
+ Returns True if the text starts with a letter and contains only English letters and digits.
209
+ """
210
+ return bool(re.fullmatch(r"[A-Za-z][A-Za-z0-9]*", text))
211
+
212
+
206
213
  def is_valid_id(smth_id: Optional[str]) -> bool:
207
214
  if smth_id is None:
208
215
  return False
@@ -210,4 +217,4 @@ def is_valid_id(smth_id: Optional[str]) -> bool:
210
217
  if smth_id.startswith("most-"):
211
218
  smth_id = smth_id[5:]
212
219
 
213
- return is_valid_objectid(smth_id)
220
+ return is_valid_objectid(smth_id) or is_valid_english_word(smth_id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: most-client
3
- Version: 1.0.43
3
+ Version: 1.0.45
4
4
  Summary: Most AI API for https://the-most.ai
5
5
  Home-page: https://github.com/the-most-ai/most-client
6
6
  Author: George Kasparyants
@@ -1,7 +1,7 @@
1
1
  most/__init__.py,sha256=ZA2n_h824tfGd5tFl3RsD0noUyv_T08fBoBxMEgxmzs,548
2
2
  most/_constrants.py,sha256=SlHKcBoXwe_sPzk8tdbb7lqhQz-Bfo__FhSoeFWodZE,217
3
- most/api.py,sha256=-DZK8TZ7_OdgUZTknqLW27i8YigXKM33W0vjr8b92gE,19401
4
- most/async_api.py,sha256=RJkdQGuNJ9s-PuyHbcuVqGmp_GN5ry8bWbVzi8k4ed0,20696
3
+ most/api.py,sha256=oD7VmdxdoyQI05ISgVvOG1o6dlW97FLohLhmXyD5h4k,19773
4
+ most/async_api.py,sha256=vg0Y-EOEMNxPOae9rIXxD4AeEvTwTEjpP_6Vzht2AZw,21092
5
5
  most/async_catalog.py,sha256=LgQ5zghQtDMnqq-WjmRHqZkqcdixZnHtmoRaVv74VKM,1059
6
6
  most/async_glossary.py,sha256=nehgkQvqENxT5vnmMiRLSWgD0jFr2Hzs7yqNZfC9ahs,1281
7
7
  most/async_searcher.py,sha256=C0zViW20K7OhKO1BzBZktTbMJYBBvor3uK6LAHZTxz0,2238
@@ -12,9 +12,9 @@ most/score_calculation.py,sha256=vLtGqXrR43xZhGjrH5dpQZfWX1q3s74LvTaHn-SKBAg,325
12
12
  most/search_types.py,sha256=GFwXaDJV4qI_gaFZToLMHoYH-JXVfIVwfVTgJ7RDWoY,7211
13
13
  most/searcher.py,sha256=9UdiSlScsE6EPc6RpK8xkRLeB5gHNxgPQpXTJ17i3lQ,2135
14
14
  most/trainer_api.py,sha256=ZwOv4mhROfY97n6i7IY_ZpafsuNRazOqMBAf2dh708k,992
15
- most/types.py,sha256=rfIfj_Dylrd_SGQl-GGlTMLUAjM6wI55TIsP3RwAsC4,5088
16
- most_client-1.0.43.dist-info/METADATA,sha256=jql2yXek-OubXmLj4v8TmaZDoIgZIQKAUNXpGBwZ5U0,1027
17
- most_client-1.0.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- most_client-1.0.43.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
19
- most_client-1.0.43.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
20
- most_client-1.0.43.dist-info/RECORD,,
15
+ most/types.py,sha256=7o8uqhQd8FbO7H50TMJPbSIG4VyyX-LumWYRlHeqwgg,5343
16
+ most_client-1.0.45.dist-info/METADATA,sha256=adEOomfAq7CaqdscKedIhXOLxCKDl7nSX8aNAA9Icrw,1027
17
+ most_client-1.0.45.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ most_client-1.0.45.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
19
+ most_client-1.0.45.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
20
+ most_client-1.0.45.dist-info/RECORD,,