most-client 1.0.18__tar.gz → 1.0.19__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.18/most_client.egg-info → most_client-1.0.19}/PKG-INFO +1 -1
- {most_client-1.0.18 → most_client-1.0.19}/most/api.py +22 -1
- {most_client-1.0.18 → most_client-1.0.19}/most/async_api.py +22 -1
- {most_client-1.0.18 → most_client-1.0.19}/most/types.py +26 -0
- {most_client-1.0.18 → most_client-1.0.19/most_client.egg-info}/PKG-INFO +1 -1
- {most_client-1.0.18 → most_client-1.0.19}/setup.py +1 -1
- {most_client-1.0.18 → most_client-1.0.19}/MANIFEST.in +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/README.md +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/most/__init__.py +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/most_client.egg-info/SOURCES.txt +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/most_client.egg-info/dependency_links.txt +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/most_client.egg-info/requires.txt +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/most_client.egg-info/top_level.txt +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/most_client.egg-info/zip-safe +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/requirements.txt +0 -0
- {most_client-1.0.18 → most_client-1.0.19}/setup.cfg +0 -0
@@ -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])
|
@@ -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])
|
@@ -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).
|
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
|