toolslm 0.3.5__py3-none-any.whl → 0.3.6__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.
toolslm/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.3.5"
1
+ __version__ = "0.3.6"
toolslm/_modidx.py CHANGED
@@ -18,6 +18,7 @@ d = { 'settings': { 'branch': 'main',
18
18
  'toolslm.funccall._copy_loc': ('funccall.html#_copy_loc', 'toolslm/funccall.py'),
19
19
  'toolslm.funccall._get_nested_schema': ('funccall.html#_get_nested_schema', 'toolslm/funccall.py'),
20
20
  'toolslm.funccall._handle_container': ('funccall.html#_handle_container', 'toolslm/funccall.py'),
21
+ 'toolslm.funccall._handle_type': ('funccall.html#_handle_type', 'toolslm/funccall.py'),
21
22
  'toolslm.funccall._is_container': ('funccall.html#_is_container', 'toolslm/funccall.py'),
22
23
  'toolslm.funccall._is_parameterized': ('funccall.html#_is_parameterized', 'toolslm/funccall.py'),
23
24
  'toolslm.funccall._param': ('funccall.html#_param', 'toolslm/funccall.py'),
toolslm/funccall.py CHANGED
@@ -1,7 +1,8 @@
1
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../01_funccall.ipynb.
2
2
 
3
3
  # %% auto 0
4
- __all__ = ['empty', 'get_schema', 'python', 'mk_ns', 'call_func', 'call_func_async', 'mk_param', 'schema2sig', 'mk_tool']
4
+ __all__ = ['empty', 'custom_types', 'get_schema', 'python', 'mk_ns', 'call_func', 'call_func_async', 'mk_param', 'schema2sig',
5
+ 'mk_tool']
5
6
 
6
7
  # %% ../01_funccall.ipynb
7
8
  import inspect, json
@@ -44,6 +45,19 @@ def _param(name, info):
44
45
  if info.default is not empty: pschema["default"] = info.default
45
46
  return pschema
46
47
 
48
+ # %% ../01_funccall.ipynb
49
+ custom_types = {Path, bytes, Decimal, UUID}
50
+
51
+ def _handle_type(t, defs):
52
+ "Handle a single type, creating nested schemas if necessary"
53
+ if t is NoneType: return {'type': 'null'}
54
+ if t in custom_types: return {'type':'string', 'format':t.__name__}
55
+ if t in (dict, list, tuple, set): return {'type': _types(t)[0]}
56
+ if isinstance(t, type) and not issubclass(t, (int, float, str, bool)) or inspect.isfunction(t):
57
+ defs[t.__name__] = _get_nested_schema(t)
58
+ return {'$ref': f'#/$defs/{t.__name__}'}
59
+ return {'type': _types(t)[0]}
60
+
47
61
  # %% ../01_funccall.ipynb
48
62
  def _is_container(t):
49
63
  "Check if type is a container (list, dict, tuple, set, Union)"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolslm
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Tools to make language models a bit easier to use
5
5
  Home-page: https://github.com/AnswerDotAI/toolslm
6
6
  Author: Jeremy Howard
@@ -0,0 +1,13 @@
1
+ toolslm/__init__.py,sha256=W_9dCm49nLvZulVAvvsafxLJjVBSKDBHz9K7szFZllo,22
2
+ toolslm/_modidx.py,sha256=IP0QiChKArAME_xajael2bLjR8dwFnMgyyrGb7ygDrM,5214
3
+ toolslm/download.py,sha256=g3BxUSxylC_575M7RFSJ1GI3Co3EwPDdEeWzxaf2Czk,4451
4
+ toolslm/funccall.py,sha256=0OBrx6KzI0KK13L-5Hn69yah9oZhgTsKchmMenCoT0A,10421
5
+ toolslm/md_hier.py,sha256=r_NPezhgfxjRmSYFlu_ND42hXt1qSbaPWHTcjbviOn4,11010
6
+ toolslm/shell.py,sha256=dGInuRKvexu21VmtZkw_0S3BGiTsbAongUG-yG4YHpc,1566
7
+ toolslm/xml.py,sha256=2QGVGrTWfyyf0duBDn_Of5kFzYFoBjvl8PrZKgNxbUU,5806
8
+ toolslm-0.3.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
+ toolslm-0.3.6.dist-info/METADATA,sha256=tAaR6Scb_Zm1Rk2X4wdtwd3f20n59Cf2pce90w_e8Fk,2404
10
+ toolslm-0.3.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ toolslm-0.3.6.dist-info/entry_points.txt,sha256=xFz0Eymlo5X7BGpaO6DI9gMxvN5A7faebzrlr8ctp5I,95
12
+ toolslm-0.3.6.dist-info/top_level.txt,sha256=4hRTrFWayz_Kz5221XjvlpCwVFrW3WPi1P0fllkTq9s,8
13
+ toolslm-0.3.6.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- toolslm/__init__.py,sha256=ThnCuF3X7rsQSd5PAea_jfYA70ZmhLvkFcLBxBPwZnY,22
2
- toolslm/_modidx.py,sha256=DWmzODG1IzXmJBQmOC89s6m0evOg4NeXgS_6KPVWYSA,5092
3
- toolslm/download.py,sha256=g3BxUSxylC_575M7RFSJ1GI3Co3EwPDdEeWzxaf2Czk,4451
4
- toolslm/funccall.py,sha256=z35-r1uzmI83zD5f6zapaHTlidA64KFvdwiSShcNkdM,9812
5
- toolslm/md_hier.py,sha256=r_NPezhgfxjRmSYFlu_ND42hXt1qSbaPWHTcjbviOn4,11010
6
- toolslm/shell.py,sha256=dGInuRKvexu21VmtZkw_0S3BGiTsbAongUG-yG4YHpc,1566
7
- toolslm/xml.py,sha256=2QGVGrTWfyyf0duBDn_Of5kFzYFoBjvl8PrZKgNxbUU,5806
8
- toolslm-0.3.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
- toolslm-0.3.5.dist-info/METADATA,sha256=yh3pgKcJ98EFN3CY7bRFx4AJsrEWzJ2f55gHuQNVuDs,2404
10
- toolslm-0.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- toolslm-0.3.5.dist-info/entry_points.txt,sha256=xFz0Eymlo5X7BGpaO6DI9gMxvN5A7faebzrlr8ctp5I,95
12
- toolslm-0.3.5.dist-info/top_level.txt,sha256=4hRTrFWayz_Kz5221XjvlpCwVFrW3WPi1P0fllkTq9s,8
13
- toolslm-0.3.5.dist-info/RECORD,,