most-client 1.0.44__py3-none-any.whl → 1.0.46__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):
@@ -462,3 +470,20 @@ class MostClient(object):
462
470
  'end_dt': end_dt.astimezone(timezone.utc).isoformat()})
463
471
  resp.raise_for_status()
464
472
  return self.retort.load(resp.json(), Usage)
473
+
474
+ def ask(self, question,
475
+ audio_ids: List[str],
476
+ text_ids: List[str]) -> str:
477
+ if not all(is_valid_id(text_id) for text_id in text_ids):
478
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
479
+
480
+ if not all(is_valid_id(audio_id) for audio_id in audio_ids):
481
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
482
+
483
+ resp = self.post(f"/{self.client_id}/model/{self.model_id}/ask",
484
+ json={
485
+ "question": question,
486
+ "text_ids": text_ids,
487
+ "audio_ids": audio_ids,
488
+ })
489
+ return resp.json()
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):
@@ -470,3 +478,20 @@ class AsyncMostClient(object):
470
478
  'end_dt': end_dt.astimezone(timezone.utc).isoformat()})
471
479
  resp.raise_for_status()
472
480
  return self.retort.load(resp.json(), Usage)
481
+
482
+ async def ask(self, question,
483
+ audio_ids: List[str],
484
+ text_ids: List[str]) -> str:
485
+ if not all(is_valid_id(text_id) for text_id in text_ids):
486
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
487
+
488
+ if not all(is_valid_id(audio_id) for audio_id in audio_ids):
489
+ raise RuntimeError("Please use valid text_id. [try text.id from list_texts()]")
490
+
491
+ resp = await self.post(f"/{self.client_id}/model/{self.model_id}/ask",
492
+ json={
493
+ "question": question,
494
+ "text_ids": text_ids,
495
+ "audio_ids": audio_ids,
496
+ })
497
+ return resp.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: most-client
3
- Version: 1.0.44
3
+ Version: 1.0.46
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=EeK7_uPcJ2QI2FD_l11RIpgi8C-JGSe2G7AwKK9iqXY,20513
4
+ most/async_api.py,sha256=3hWDH-twIeivb5md8KBuBjoZFTiV92PxDRdIYJ-8eKo,21886
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
@@ -13,8 +13,8 @@ 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
15
  most/types.py,sha256=7o8uqhQd8FbO7H50TMJPbSIG4VyyX-LumWYRlHeqwgg,5343
16
- most_client-1.0.44.dist-info/METADATA,sha256=yZy3T34ZtdnW-C28iBLyf0kTEjKq0tA6-Wdha3gRF74,1027
17
- most_client-1.0.44.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- most_client-1.0.44.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
19
- most_client-1.0.44.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
20
- most_client-1.0.44.dist-info/RECORD,,
16
+ most_client-1.0.46.dist-info/METADATA,sha256=jJop33nFt004MEkWb6cEuS6lcYNwuamZsAr3qworCO0,1027
17
+ most_client-1.0.46.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ most_client-1.0.46.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
19
+ most_client-1.0.46.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
20
+ most_client-1.0.46.dist-info/RECORD,,