unique_toolkit 0.5.14__py3-none-any.whl → 0.5.15__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.
@@ -2,7 +2,7 @@ import logging
2
2
  import os
3
3
  import tempfile
4
4
  from pathlib import Path
5
- from typing import Optional, cast
5
+ from typing import Optional, Union, cast
6
6
 
7
7
  import requests
8
8
  import unique_sdk
@@ -344,6 +344,7 @@ class ContentService(BaseService):
344
344
  content_id: str,
345
345
  content_name: str,
346
346
  chat_id: Optional[str] = None,
347
+ dir_path: Optional[Union[str, Path]] = "/tmp",
347
348
  ) -> Path:
348
349
  """
349
350
  Downloads content to temporary directory
@@ -352,6 +353,7 @@ class ContentService(BaseService):
352
353
  content_id (str): The id of the uploaded content.
353
354
  content_name (str): The name of the uploaded content.
354
355
  chat_id (Optional[str]): The chat_id, defaults to None.
356
+ dir_path (Optional[Union[str, Path]]): The directory path to download the content to, defaults to "/tmp". If not provided, the content will be downloaded to a random directory inside /tmp. Be aware that this directory won't be cleaned up automatically.
355
357
 
356
358
  Returns:
357
359
  content_path: The path to the downloaded content in the temporary directory.
@@ -365,7 +367,7 @@ class ContentService(BaseService):
365
367
  url = f"{url}?chatId={chat_id}"
366
368
 
367
369
  # Create a random directory inside /tmp
368
- random_dir = tempfile.mkdtemp(dir="/tmp")
370
+ random_dir = tempfile.mkdtemp(dir=dir_path)
369
371
 
370
372
  # Create the full file path
371
373
  content_path = Path(random_dir) / content_name
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 0.5.14
3
+ Version: 0.5.15
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -101,6 +101,9 @@ All notable changes to this project will be documented in this file.
101
101
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
102
102
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
103
103
 
104
+ ## [0.5.15] - 2024-08-27
105
+ - Possibility to specify root directory in `ContentService.download_content`
106
+
104
107
  ## [0.5.14] - 2024-08-26
105
108
  - Add AZURE_GPT_4o_MINI_2024_0718 to language model infos
106
109
 
@@ -15,7 +15,7 @@ unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,
15
15
  unique_toolkit/chat/utils.py,sha256=ihm-wQykBWhB4liR3LnwPVPt_qGW6ETq21Mw4HY0THE,854
16
16
  unique_toolkit/content/__init__.py,sha256=MSH2sxjQyKD2Sef92fzE5Dt9SihdzivB6yliSwJfTmQ,890
17
17
  unique_toolkit/content/schemas.py,sha256=UlC5nBIaFkq9TD31LR6ioG9JRZ1ScmtABi0l06HZR70,2231
18
- unique_toolkit/content/service.py,sha256=4CHqZDE3C-VQpG6RAlenarvBmBgI28Ec6T9HZf9TB84,13565
18
+ unique_toolkit/content/service.py,sha256=iBS1ntg5xdL-i5lfDlN2MGYDTIdg3u-uxQH9h_ss3KM,13894
19
19
  unique_toolkit/content/utils.py,sha256=Lake671plRsqNvO3pN_rmyVcpwbdED_KQpLcCnc4lv4,6902
20
20
  unique_toolkit/embedding/__init__.py,sha256=dr8M9jvslQTxPpxgaGwzxY0FildiWf-DidN_cahPAWw,191
21
21
  unique_toolkit/embedding/schemas.py,sha256=1GvKCaSk4jixzVQ2PKq8yDqwGEVY_hWclYtoAr6CC2g,96
@@ -26,7 +26,7 @@ unique_toolkit/language_model/infos.py,sha256=JkugUAFFlrhTHXeM3A_R5QLkNSR9Ro85xW
26
26
  unique_toolkit/language_model/schemas.py,sha256=h5zjZNk7O-wLKtRuiNtMCIbp5hEVXrAOviKonQcjFuI,4594
27
27
  unique_toolkit/language_model/service.py,sha256=JjsOOcGDcR7db3yF3_oDXclEGfxqmwWpL5jor7Q42cU,10470
28
28
  unique_toolkit/language_model/utils.py,sha256=WBPj1XKkDgxy_-T8HCZvsfkkSzj_1w4UZzNmyvdbBLY,1081
29
- unique_toolkit-0.5.14.dist-info/LICENSE,sha256=bIeCWCYuoUU_MzNdg48-ubJSVm7qxakaRbzTiJ5uxrs,1065
30
- unique_toolkit-0.5.14.dist-info/METADATA,sha256=p_jPjGwKWiNOLzbVcibqdWCrXA1TA813LnIdLfkkmVE,10124
31
- unique_toolkit-0.5.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
- unique_toolkit-0.5.14.dist-info/RECORD,,
29
+ unique_toolkit-0.5.15.dist-info/LICENSE,sha256=bIeCWCYuoUU_MzNdg48-ubJSVm7qxakaRbzTiJ5uxrs,1065
30
+ unique_toolkit-0.5.15.dist-info/METADATA,sha256=YWF1EolvIQgwdP9-oV04EE-o6hWzA5HP69bl3_Ui400,10227
31
+ unique_toolkit-0.5.15.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
+ unique_toolkit-0.5.15.dist-info/RECORD,,