stores 0.1.0__py3-none-any.whl → 0.1.1__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.
@@ -1,5 +1,4 @@
1
1
  import asyncio
2
- import functools
3
2
  import inspect
4
3
  import logging
5
4
  import re
@@ -18,6 +17,8 @@ from typing import (
18
17
  get_type_hints,
19
18
  )
20
19
 
20
+ from makefun import create_function
21
+
21
22
  from stores.format import ProviderFormat, format_tools
22
23
  from stores.parse import llm_parse_json
23
24
  from stores.utils import check_duplicates
@@ -209,8 +210,15 @@ def wrap_tool(tool: Callable):
209
210
  # Inject default values within wrapper
210
211
  bound_args = original_signature.bind(*args, **kwargs)
211
212
  bound_args.apply_defaults()
212
- _cast_bound_args(bound_args)
213
213
  # Inject correct Literals
214
+ for k, v in bound_args.arguments.items():
215
+ if (
216
+ v is None
217
+ and original_signature.parameters[k].default is not Parameter.empty
218
+ ):
219
+ bound_args.arguments[k] = original_signature.parameters[k].default
220
+
221
+ _cast_bound_args(bound_args)
214
222
  for k, v in bound_args.arguments.items():
215
223
  if k in literal_maps:
216
224
  param = original_signature.parameters[k]
@@ -219,11 +227,17 @@ def wrap_tool(tool: Callable):
219
227
  )
220
228
  return tool(*bound_args.args, **bound_args.kwargs)
221
229
 
222
- functools.update_wrapper(wrapper, tool)
223
- wrapper.__signature__ = new_sig
224
- wrapper._wrapped = True
230
+ wrapped = create_function(
231
+ new_sig,
232
+ wrapper,
233
+ qualname=tool.__name__,
234
+ doc=inspect.getdoc(tool),
235
+ )
236
+
237
+ wrapped.__name__ = tool.__name__
238
+ wrapped._wrapped = True
225
239
 
226
- return wrapper
240
+ return wrapped
227
241
 
228
242
 
229
243
  class BaseIndex:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stores
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Repository of Python functions and tools for LLMs
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.10
@@ -4,12 +4,12 @@ stores/format.py,sha256=LduYBVDiUDB1J1HDyu9jHrRG1V97pw6C5g76OirpJJY,7792
4
4
  stores/parse.py,sha256=HYPNPzQod2vpu1Cln7yQ8aVkZT1Mw2IN0sZ2A1DIaqE,4967
5
5
  stores/utils.py,sha256=GPWT6lCoGobwP3PlEOHyJfKyd0dobamjyErcR7lgm7M,242
6
6
  stores/indexes/__init__.py,sha256=s-RNqml8uGREQhxwSdDoxcbcxeD8soB9BcL5dBKsQfI,215
7
- stores/indexes/base_index.py,sha256=1DP3cb1njE-MHuVXHVlyQlao2APeyWjRA2VT4RwW6BU,10293
7
+ stores/indexes/base_index.py,sha256=K4--_OAFyPNESaisD0JPNRIEffCnjw9nziahDgjdZHU,10708
8
8
  stores/indexes/index.py,sha256=ckyisaoD_0Uw3dWXpMYYhNWxMXcfykwJIY8lUdpNntA,2113
9
9
  stores/indexes/local_index.py,sha256=NS4AWzeMVZ51YPo0eJ_udbF5aASuksG-88YXLDn41fQ,2880
10
10
  stores/indexes/remote_index.py,sha256=-iKO0q9MS1CiyzY1lu90FxHs0pVR6z82_7Lk7jX9wFk,2523
11
11
  stores/indexes/venv_utils.py,sha256=odeKBphn6H2Jwz6pyy4pvEZFB48Kd1rroAuMiJjcPLE,11696
12
- stores-0.1.0.dist-info/METADATA,sha256=EyJIq_xAsOTaBc0h5dh3H_N58qlXS5CvP4BwIakuOK8,3076
13
- stores-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- stores-0.1.0.dist-info/licenses/LICENSE,sha256=VTidYE7_Dam0Dwyq095EhhDIqi47g03oVpLAHQgKws0,1066
15
- stores-0.1.0.dist-info/RECORD,,
12
+ stores-0.1.1.dist-info/METADATA,sha256=FwbKEQMpPJNB_wPgKRU_kM2lhmUNocmL2VIwBP7UZOE,3076
13
+ stores-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ stores-0.1.1.dist-info/licenses/LICENSE,sha256=VTidYE7_Dam0Dwyq095EhhDIqi47g03oVpLAHQgKws0,1066
15
+ stores-0.1.1.dist-info/RECORD,,
File without changes