speedy-utils 1.1.7__py3-none-any.whl → 1.1.9__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.
@@ -7,6 +7,7 @@ import pathlib
7
7
  from abc import ABC
8
8
  from dataclasses import dataclass
9
9
  from typing import Any, Dict, Generic, List, Literal, Optional, TypeVar, Union, cast
10
+ from venv import logger
10
11
 
11
12
  from openai.types.chat import ChatCompletionMessageParam
12
13
  from pydantic import BaseModel
@@ -507,3 +508,13 @@ class AsyncLLMTask(ABC, Generic[InputModelType, OutputModelType]):
507
508
 
508
509
  # Compatibility alias for other LLMTask implementations
509
510
  arun = __call__
511
+
512
+ async def __aenter__(self):
513
+ return self
514
+
515
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
516
+ if hasattr(self._lm, "_last_client"):
517
+ last_client = self._lm._last_client # type: ignore
518
+ await last_client._client.aclose()
519
+ else:
520
+ logger.warning("No last client to close")
@@ -70,6 +70,7 @@ class AsyncLMBase:
70
70
  api_key=self.api_key,
71
71
  base_url=api_base,
72
72
  )
73
+ self._last_client = client
73
74
  return client
74
75
 
75
76
  # ------------------------------------------------------------------ #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: speedy-utils
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Fast and easy-to-use package for data science
5
5
  Author: AnhVTH
6
6
  Author-email: anhvth.226@gmail.com
@@ -7,9 +7,9 @@ llm_utils/group_messages.py,sha256=Oe2tlhg-zRodG1-hodYebddrR77j9UdE05LzJw0EvYI,3
7
7
  llm_utils/lm/__init__.py,sha256=rX36_MsnekM5GHwWS56XELbm4W5x2TDwnPERDTfo0eU,194
8
8
  llm_utils/lm/async_lm/__init__.py,sha256=PUBbCuf5u6-0GBUu-2PI6YAguzsyXj-LPkU6vccqT6E,121
9
9
  llm_utils/lm/async_lm/_utils.py,sha256=P1-pUDf_0pDmo8WTIi43t5ARlyGA1RIJfpAhz-gfA5g,6105
10
- llm_utils/lm/async_lm/async_llm_task.py,sha256=i5Z9yLBnxFK_937JHFMu7A-tImQnRuGAsnWDcC70syg,18648
10
+ llm_utils/lm/async_lm/async_llm_task.py,sha256=QdyxiMLAy7xENdb0SaGAFRTaBO1n0TehPPcTdrLizsg,19010
11
11
  llm_utils/lm/async_lm/async_lm.py,sha256=J1KC7qCpG_CyJMWca4q71la7JHoANiLLSNQrQH44-z0,14045
12
- llm_utils/lm/async_lm/async_lm_base.py,sha256=BIIKAgmSZ9S5gLIf4AKGWg8N1eAr0l_fRfgG6UnKCK4,14839
12
+ llm_utils/lm/async_lm/async_lm_base.py,sha256=Ope5LPOgMm_waoK_nDP7TwOVJRdstP8XCjFS4rBksGY,14874
13
13
  llm_utils/lm/async_lm/lm_specific.py,sha256=KmqdCm3SJ5MqN-dRJd6S5tq5-ve1X2eNWf2CMFtc_3s,3926
14
14
  llm_utils/lm/utils.py,sha256=a0KJj8vjT2fHKb7GKGNJjJHhKLThwpxIL7vnV9Fr3ZY,4584
15
15
  llm_utils/scripts/README.md,sha256=yuOLnLa2od2jp4wVy3rV0rESeiV3o8zol5MNMsZx0DY,999
@@ -33,7 +33,7 @@ speedy_utils/multi_worker/thread.py,sha256=u_hTwXh7_FciMa5EukdEA1fDCY_vUC4moDceB
33
33
  speedy_utils/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  speedy_utils/scripts/mpython.py,sha256=IvywP7Y0_V6tWfMP-4MjPvN5_KfxWF21xaLJsCIayCk,3821
35
35
  speedy_utils/scripts/openapi_client_codegen.py,sha256=f2125S_q0PILgH5dyzoKRz7pIvNEjCkzpi4Q4pPFRZE,9683
36
- speedy_utils-1.1.7.dist-info/METADATA,sha256=EV1Jj7hpGp5Zf9hkj0chArF9iVmJUCUFeSFW2VkXzvI,7441
37
- speedy_utils-1.1.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
38
- speedy_utils-1.1.7.dist-info/entry_points.txt,sha256=T1t85jwx8fK6m5msdkBGIXH5R5Kd0zSL0S6erXERPzg,237
39
- speedy_utils-1.1.7.dist-info/RECORD,,
36
+ speedy_utils-1.1.9.dist-info/METADATA,sha256=puilG60Uz-Z4Een5-ycrkd5cApDrpIPJofwQmqubniU,7441
37
+ speedy_utils-1.1.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
38
+ speedy_utils-1.1.9.dist-info/entry_points.txt,sha256=T1t85jwx8fK6m5msdkBGIXH5R5Kd0zSL0S6erXERPzg,237
39
+ speedy_utils-1.1.9.dist-info/RECORD,,