most-client 1.0.42__tar.gz → 1.0.43__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.
Files changed (29) hide show
  1. {most_client-1.0.42/most_client.egg-info → most_client-1.0.43}/PKG-INFO +1 -1
  2. {most_client-1.0.42 → most_client-1.0.43}/most/__init__.py +6 -1
  3. most_client-1.0.43/most/async_catalog.py +28 -0
  4. most_client-1.0.43/most/async_glossary.py +32 -0
  5. most_client-1.0.43/most/catalog.py +28 -0
  6. most_client-1.0.43/most/glossary.py +32 -0
  7. {most_client-1.0.42 → most_client-1.0.43}/most/types.py +11 -1
  8. {most_client-1.0.42 → most_client-1.0.43/most_client.egg-info}/PKG-INFO +1 -1
  9. {most_client-1.0.42 → most_client-1.0.43}/most_client.egg-info/SOURCES.txt +2 -0
  10. {most_client-1.0.42 → most_client-1.0.43}/setup.py +1 -1
  11. most_client-1.0.42/most/async_glossary.py +0 -18
  12. most_client-1.0.42/most/glossary.py +0 -18
  13. {most_client-1.0.42 → most_client-1.0.43}/MANIFEST.in +0 -0
  14. {most_client-1.0.42 → most_client-1.0.43}/README.md +0 -0
  15. {most_client-1.0.42 → most_client-1.0.43}/most/_constrants.py +0 -0
  16. {most_client-1.0.42 → most_client-1.0.43}/most/api.py +0 -0
  17. {most_client-1.0.42 → most_client-1.0.43}/most/async_api.py +0 -0
  18. {most_client-1.0.42 → most_client-1.0.43}/most/async_searcher.py +0 -0
  19. {most_client-1.0.42 → most_client-1.0.43}/most/async_trainer_api.py +0 -0
  20. {most_client-1.0.42 → most_client-1.0.43}/most/score_calculation.py +0 -0
  21. {most_client-1.0.42 → most_client-1.0.43}/most/search_types.py +0 -0
  22. {most_client-1.0.42 → most_client-1.0.43}/most/searcher.py +0 -0
  23. {most_client-1.0.42 → most_client-1.0.43}/most/trainer_api.py +0 -0
  24. {most_client-1.0.42 → most_client-1.0.43}/most_client.egg-info/dependency_links.txt +0 -0
  25. {most_client-1.0.42 → most_client-1.0.43}/most_client.egg-info/requires.txt +0 -0
  26. {most_client-1.0.42 → most_client-1.0.43}/most_client.egg-info/top_level.txt +0 -0
  27. {most_client-1.0.42 → most_client-1.0.43}/most_client.egg-info/zip-safe +0 -0
  28. {most_client-1.0.42 → most_client-1.0.43}/requirements.txt +0 -0
  29. {most_client-1.0.42 → most_client-1.0.43}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: most-client
3
- Version: 1.0.42
3
+ Version: 1.0.43
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
@@ -4,4 +4,9 @@ from .trainer_api import Trainer
4
4
  from .async_trainer_api import AsyncTrainer
5
5
  from .searcher import MostSearcher
6
6
  from .async_searcher import AsyncMostClient
7
- from .search_types import SearchParams, IDCondition, ChannelsCondition, DurationCondition, ResultsCondition, StoredInfoCondition, TagsCondition
7
+ from .search_types import SearchParams, IDCondition, ChannelsCondition, DurationCondition, ResultsCondition, StoredInfoCondition, TagsCondition
8
+ from .glossary import Glossary
9
+ from .async_glossary import AsyncGlossary
10
+ from .catalog import Catalog
11
+ from .async_catalog import AsyncCatalog
12
+ from .types import GlossaryNGram, Item
@@ -0,0 +1,28 @@
1
+ from typing import List
2
+
3
+ from .async_api import AsyncMostClient
4
+ from .types import Item
5
+
6
+
7
+ class AsyncCatalog(object):
8
+ def __init__(self, client: AsyncMostClient):
9
+ super(AsyncCatalog, self).__init__()
10
+ self.client = client
11
+
12
+ async def add_items(self, items: List[Item] | Item) -> List[Item]:
13
+ if not isinstance(items, list):
14
+ items = [items]
15
+ resp = await self.client.post(f"/{self.client.client_id}/upload_items",
16
+ json=[item.to_dict() for item in items])
17
+ return self.client.retort.load(resp.json(), List[Item])
18
+
19
+ async def list_items(self) -> List[Item]:
20
+ resp = await self.client.get(f"/{self.client.client_id}/items")
21
+ return self.client.retort.load(resp.json(), List[Item])
22
+
23
+ async def delete_items(self, item_ids: List[str]):
24
+ if not isinstance(item_ids, list):
25
+ item_ids = [item_ids]
26
+ await self.client.post(f"/{self.client.client_id}/delete_items",
27
+ json=item_ids)
28
+ return self
@@ -0,0 +1,32 @@
1
+ from typing import List
2
+
3
+ from .async_api import AsyncMostClient
4
+ from .types import GlossaryNGram
5
+
6
+
7
+ class AsyncGlossary(object):
8
+ def __init__(self, client: AsyncMostClient):
9
+ super(AsyncGlossary, self).__init__()
10
+ self.client = client
11
+
12
+ async def add_ngrams(self, ngrams: List[GlossaryNGram] | GlossaryNGram) -> List[GlossaryNGram]:
13
+ if not isinstance(ngrams, list):
14
+ ngrams = [ngrams]
15
+ resp = await self.client.post(f"/{self.client.client_id}/upload_glossary",
16
+ json=[ngram.to_dict() for ngram in ngrams])
17
+ return self.client.retort.load(resp.json(), List[GlossaryNGram])
18
+
19
+ async def list_ngrams(self) -> List[GlossaryNGram]:
20
+ resp = await self.client.get(f"/{self.client.client_id}/glossary")
21
+ return self.client.retort.load(resp.json(), List[GlossaryNGram])
22
+
23
+ async def del_ngrams(self, ngram_ids: List[str] | str):
24
+ if not isinstance(ngram_ids, list):
25
+ ngram_ids = [ngram_ids]
26
+ await self.client.post(f"/{self.client.client_id}/delete_glossary_ngrams",
27
+ json=ngram_ids)
28
+ return self
29
+
30
+ async def drop(self):
31
+ await self.client.post(f"/{self.client.client_id}/delete_glossary")
32
+ return self
@@ -0,0 +1,28 @@
1
+ from typing import List
2
+
3
+ from .api import MostClient
4
+ from .types import Item
5
+
6
+
7
+ class Catalog(object):
8
+ def __init__(self, client: MostClient):
9
+ super(Catalog, self).__init__()
10
+ self.client = client
11
+
12
+ def add_items(self, items: List[Item] | Item) -> List[Item]:
13
+ if not isinstance(items, list):
14
+ items = [items]
15
+ resp = self.client.post(f"/{self.client.client_id}/upload_items",
16
+ json=[item.to_dict() for item in items])
17
+ return self.client.retort.load(resp.json(), List[Item])
18
+
19
+ def list_items(self) -> List[Item]:
20
+ resp = self.client.get(f"/{self.client.client_id}/items")
21
+ return self.client.retort.load(resp.json(), List[Item])
22
+
23
+ def delete_items(self, item_ids: List[str]):
24
+ if not isinstance(item_ids, list):
25
+ item_ids = [item_ids]
26
+ self.client.post(f"/{self.client.client_id}/delete_items",
27
+ json=item_ids)
28
+ return self
@@ -0,0 +1,32 @@
1
+ from typing import List
2
+
3
+ from .api import MostClient
4
+ from .types import GlossaryNGram
5
+
6
+
7
+ class Glossary(object):
8
+ def __init__(self, client: MostClient):
9
+ super(Glossary, self).__init__()
10
+ self.client = client
11
+
12
+ def add_ngrams(self, ngrams: List[GlossaryNGram] | GlossaryNGram) -> List[GlossaryNGram]:
13
+ if not isinstance(ngrams, list):
14
+ ngrams = [ngrams]
15
+ resp = self.client.post(f"/{self.client.client_id}/upload_glossary",
16
+ json=[ngram.to_dict() for ngram in ngrams])
17
+ return self.client.retort.load(resp.json(), List[GlossaryNGram])
18
+
19
+ def list_ngrams(self) -> List[GlossaryNGram]:
20
+ resp = self.client.get(f"/{self.client.client_id}/glossary")
21
+ return self.client.retort.load(resp.json(), List[GlossaryNGram])
22
+
23
+ def del_ngrams(self, ngram_ids: List[str] | str):
24
+ if not isinstance(ngram_ids, list):
25
+ ngram_ids = [ngram_ids]
26
+ self.client.post(f"/{self.client.client_id}/delete_glossary_ngrams",
27
+ json=ngram_ids)
28
+ return self
29
+
30
+ def drop(self):
31
+ self.client.post(f"/{self.client.client_id}/delete_glossary")
32
+ return self
@@ -131,8 +131,18 @@ class Dialog(DataClassJsonMixin):
131
131
  @dataclass_json
132
132
  @dataclass
133
133
  class GlossaryNGram(DataClassJsonMixin):
134
- pronunciation: List[str]
135
134
  original: List[str]
135
+ pronunciation: List[str]
136
+ weight: float = 2
137
+ id: Optional[str] = None
138
+
139
+
140
+ @dataclass_json
141
+ @dataclass
142
+ class Item(DataClassJsonMixin):
143
+ title: str
144
+ pronunciation: str
145
+ metadata: Dict[str, str]
136
146
  id: Optional[str] = None
137
147
 
138
148
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: most-client
3
- Version: 1.0.42
3
+ Version: 1.0.43
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
@@ -6,9 +6,11 @@ most/__init__.py
6
6
  most/_constrants.py
7
7
  most/api.py
8
8
  most/async_api.py
9
+ most/async_catalog.py
9
10
  most/async_glossary.py
10
11
  most/async_searcher.py
11
12
  most/async_trainer_api.py
13
+ most/catalog.py
12
14
  most/glossary.py
13
15
  most/score_calculation.py
14
16
  most/search_types.py
@@ -8,7 +8,7 @@ with open('requirements.txt', 'r') as f:
8
8
 
9
9
  setup(
10
10
  name='most-client',
11
- version='1.0.42',
11
+ version='1.0.43',
12
12
  python_requires=f'>=3.6',
13
13
  description='Most AI API for https://the-most.ai',
14
14
  url='https://github.com/the-most-ai/most-client',
@@ -1,18 +0,0 @@
1
- from typing import List
2
-
3
- from .async_api import AsyncMostClient
4
- from .types import GlossaryNGram
5
-
6
-
7
- class AsyncGlossary(object):
8
- def __init__(self, client: AsyncMostClient):
9
- self.client = client
10
-
11
- async def add_ngram(self, ngram: GlossaryNGram):
12
- pass
13
-
14
- async def list_ngrams(self) -> List[GlossaryNGram]:
15
- return []
16
-
17
- async def del_ngram(self, ngram_id: str):
18
- pass
@@ -1,18 +0,0 @@
1
- from typing import List
2
-
3
- from .api import MostClient
4
- from .types import GlossaryNGram
5
-
6
-
7
- class Glossary(object):
8
- def __init__(self, client: MostClient):
9
- self.client = client
10
-
11
- def add_ngram(self, ngram: GlossaryNGram):
12
- pass
13
-
14
- def list_ngrams(self) -> List[GlossaryNGram]:
15
- return []
16
-
17
- def del_ngram(self, ngram_id: str):
18
- pass
File without changes
File without changes
File without changes
File without changes