most-client 1.0.18__py3-none-any.whl → 1.0.19__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
@@ -17,7 +17,7 @@ from most.types import (
17
17
  Script,
18
18
  StoredAudioData,
19
19
  Text,
20
- is_valid_id,
20
+ is_valid_id, SearchParams,
21
21
  )
22
22
 
23
23
 
@@ -296,3 +296,24 @@ class MostClient(object):
296
296
  audio = AudioSegment.from_file(io.BytesIO(resp.content),
297
297
  format=format)
298
298
  return audio
299
+
300
+ def index_audio(self, audio_id: str) -> None:
301
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/indexing")
302
+ if resp.status_code >= 400:
303
+ raise RuntimeError("Audio can't be indexed")
304
+ return None
305
+
306
+ def search(self,
307
+ query: str,
308
+ filter: SearchParams,
309
+ limit: int = 10) -> List[Audio]:
310
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/search",
311
+ json={
312
+ "query": query,
313
+ "filter": filter.to_dict(),
314
+ "limit": limit,
315
+ })
316
+ if resp.status_code >= 400:
317
+ raise RuntimeError("Audio can't be indexed")
318
+ audio_list = resp.json()
319
+ return self.retort.load(audio_list, List[Audio])
most/async_api.py CHANGED
@@ -17,7 +17,7 @@ from most.types import (
17
17
  Script,
18
18
  StoredAudioData,
19
19
  Text,
20
- is_valid_id,
20
+ is_valid_id, SearchParams,
21
21
  )
22
22
 
23
23
 
@@ -301,3 +301,24 @@ class AsyncMostClient(object):
301
301
  audio = AudioSegment.from_file(io.BytesIO(resp.content),
302
302
  format=format)
303
303
  return audio
304
+
305
+ async def index_audio(self, audio_id: str) -> None:
306
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/indexing")
307
+ if resp.status_code >= 400:
308
+ raise RuntimeError("Audio can't be indexed")
309
+ return None
310
+
311
+ async def search(self,
312
+ query: str,
313
+ filter: SearchParams,
314
+ limit: int = 10) -> List[Audio]:
315
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/model/{self.model_id}/search",
316
+ json={
317
+ "query": query,
318
+ "filter": filter.to_dict(),
319
+ "limit": limit,
320
+ })
321
+ if resp.status_code >= 400:
322
+ raise RuntimeError("Audio can't be indexed")
323
+ audio_list = resp.json()
324
+ return self.retort.load(audio_list, List[Audio])
most/types.py CHANGED
@@ -113,6 +113,32 @@ class DialogResult(DataClassJsonMixin):
113
113
  results: Optional[List[ColumnResult]]
114
114
 
115
115
 
116
+ @dataclass_json
117
+ @dataclass
118
+ class StoredInfoCondition(DataClassJsonMixin):
119
+ key: str
120
+ match: Optional[str] = None
121
+ starts_with: Optional[str] = None
122
+ ends_with: Optional[str] = None
123
+
124
+
125
+ @dataclass_json
126
+ @dataclass
127
+ class ResultsCondition(DataClassJsonMixin):
128
+ column: str
129
+ subcolumn: str
130
+ score_greater_than: Optional[int] = None
131
+ score_less_than: Optional[int] = None
132
+
133
+
134
+ @dataclass_json
135
+ @dataclass
136
+ class SearchParams(DataClassJsonMixin):
137
+ must: List[StoredInfoCondition | ResultsCondition]
138
+ should: List[StoredInfoCondition | ResultsCondition]
139
+ must_not: List[StoredInfoCondition | ResultsCondition]
140
+
141
+
116
142
  def is_valid_objectid(oid: str) -> bool:
117
143
  """
118
144
  Check if a given string is a valid MongoDB ObjectId (24-character hex).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: most-client
3
- Version: 1.0.18
3
+ Version: 1.0.19
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
@@ -0,0 +1,9 @@
1
+ most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
+ most/api.py,sha256=fn5Husx-uayQ2MR_I7S1YA9QiCHc7fSFLTIzWqyAJc0,13046
3
+ most/async_api.py,sha256=D4sM9zo7EN5vfoMuI2-FsdNwpht0nLuRej0o4DY5smc,13875
4
+ most/types.py,sha256=M6KZiy0OurFCHSnJnnqrkwmsCjTyrq7nsICIfAhLo-A,3455
5
+ most_client-1.0.19.dist-info/METADATA,sha256=jUYmnk-Qx5LM5vGUiKOLZY8ZA57ZSf4pxVZeJH0ous4,1027
6
+ most_client-1.0.19.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
7
+ most_client-1.0.19.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
8
+ most_client-1.0.19.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
+ most_client-1.0.19.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
- most/api.py,sha256=IvgklvaP9fvcr_fy-gGvnEDWcyxPRTxNN0MO492YgT0,12101
3
- most/async_api.py,sha256=tFFLTWhGVexVz5v9hYuNp4BqFEWTNSp_6DLSAQBjF9c,12858
4
- most/types.py,sha256=apUz6FHFAHWJNVvRh57wVQk5DFw2XKnLLhkAyWgtvfw,2825
5
- most_client-1.0.18.dist-info/METADATA,sha256=bJfi-Nsqkp3oHirr417vvUtJgo79AzaCOqsBUSUJq58,1027
6
- most_client-1.0.18.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
7
- most_client-1.0.18.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
8
- most_client-1.0.18.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
- most_client-1.0.18.dist-info/RECORD,,