toolslm 0.3.25__tar.gz → 0.3.26__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolslm
3
- Version: 0.3.25
3
+ Version: 0.3.26
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
@@ -16,7 +16,7 @@ Classifier: License :: OSI Approved :: Apache Software License
16
16
  Requires-Python: >=3.9
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: fastcore>=1.9.7
19
+ Requires-Dist: fastcore>=1.12.4
20
20
  Requires-Dist: httpx
21
21
  Requires-Dist: ghapi
22
22
  Requires-Dist: codesigs
@@ -1,11 +1,11 @@
1
1
  [DEFAULT]
2
2
  repo = toolslm
3
3
  lib_name = toolslm
4
- version = 0.3.25
4
+ version = 0.3.26
5
5
  min_python = 3.9
6
6
  license = apache2
7
7
  black_formatting = False
8
- requirements = fastcore>=1.9.7 httpx ghapi codesigs
8
+ requirements = fastcore>=1.12.4 httpx ghapi codesigs
9
9
  dev_requirements = ipython
10
10
  doc_path = _docs
11
11
  lib_path = toolslm
@@ -39,4 +39,5 @@ console_scripts = folder2ctx=toolslm.xml:folder2ctx_cli
39
39
  cell_number = False
40
40
  skip_procs =
41
41
  update_pyproject = True
42
+ clean_ids = True
42
43
 
@@ -0,0 +1 @@
1
+ __version__ = "0.3.26"
@@ -11,6 +11,7 @@ from fastcore.utils import *
11
11
  from fastcore.meta import delegates
12
12
  import inspect, re, sys, ast, builtins, os, linecache
13
13
  from importlib import import_module
14
+
14
15
  from .xml import *
15
16
 
16
17
  # %% ../05_inspecttools.ipynb #9778fca8
@@ -23,6 +24,7 @@ def _find_frame_dict(var:str):
23
24
  raise ValueError(f"Could not find {var} in any scope")
24
25
 
25
26
  # %% ../05_inspecttools.ipynb #7fd415fa
27
+ @llmtool
26
28
  def importmodule(
27
29
  mod: str, # The module to import (e.g. 'torch.nn.functional')
28
30
  caller_symbol:str = '__msg_id' # The name of the special variable to find the correct caller namespace
@@ -79,6 +81,7 @@ def _src_from_lines(lines, start):
79
81
  return ''.join(lines[start:start + tree.body[0].end_lineno])
80
82
 
81
83
  # %% ../05_inspecttools.ipynb #41ecbd5c
84
+ @llmtool
82
85
  def symsrc(
83
86
  sym: str # Dotted symbol path (e.g `Interval` or `sympy.sets.sets.Interval`) or "_last" for previous result
84
87
  ):
@@ -109,6 +112,7 @@ def symsrc(
109
112
  raise OSError(f"Source for {name} not found")
110
113
 
111
114
  # %% ../05_inspecttools.ipynb #bbf67405
115
+ @llmtool
112
116
  def symtype(
113
117
  syms: str # Comma separated str list of dotted symbol paths (e.g `'Interval,a'` or `'sympy.sets.sets.Interval'`); "_last" for prev result
114
118
  ):
@@ -125,6 +129,7 @@ def symtype(
125
129
  return [f(o) for o in re.split(r'\,\s*', syms)]
126
130
 
127
131
  # %% ../05_inspecttools.ipynb #dd4279b8
132
+ @llmtool
128
133
  def symval(
129
134
  syms: str # Comma separated str list of dotted symbol paths (e.g `Interval` or `sympy.sets.sets.Interval`); "_last" for prev result
130
135
  ):
@@ -156,6 +161,7 @@ def symtype_val(
156
161
  return [f(o) for o in re.split(r'\,\s*', syms)]
157
162
 
158
163
  # %% ../05_inspecttools.ipynb #1cd34596
164
+ @llmtool
159
165
  def symdir(
160
166
  sym: str, # Dotted symbol path (e.g `Interval` or `sympy.sets.sets.Interval`) or "_last" for previous result
161
167
  exclude_private: bool=False # Filter out attrs starting with "_"
@@ -166,6 +172,7 @@ def symdir(
166
172
  return [o for o in res if o[0]!='_']
167
173
 
168
174
  # %% ../05_inspecttools.ipynb #9542de0b
175
+ @llmtool
169
176
  def symnth(
170
177
  sym: str, # Dotted symbol path to a dict or object with .values()
171
178
  n: int # Index into the values (0-based)
@@ -181,6 +188,7 @@ def symnth(
181
188
  return _last
182
189
 
183
190
  # %% ../05_inspecttools.ipynb #4ac6ca2d
191
+ @llmtool
184
192
  def symlen(
185
193
  sym: str # Dotted symbol path or "_last" for previous result
186
194
  ):
@@ -188,6 +196,7 @@ def symlen(
188
196
  return len(resolve(sym))
189
197
 
190
198
  # %% ../05_inspecttools.ipynb #a5dfbe8f
199
+ @llmtool
191
200
  def symslice(
192
201
  sym: str, # Dotted symbol path or "_last" for previous result
193
202
  start: int, # Starting index for slice
@@ -198,6 +207,7 @@ def symslice(
198
207
  except Exception as e: return f'Error: {e}'
199
208
 
200
209
  # %% ../05_inspecttools.ipynb #5fca4d70
210
+ @llmtool
201
211
  def symsearch(
202
212
  sym:str, # Dotted symbol path or "_last" for previous result
203
213
  term:str, # Search term (exact string or regex pattern)
@@ -210,6 +220,7 @@ def symsearch(
210
220
  else: return str([(x, i) for i, x in enumerate(resolve(sym)) if x == term])
211
221
 
212
222
  # %% ../05_inspecttools.ipynb #02c09e1a
223
+ @llmtool
213
224
  def symset(
214
225
  val: str # Value to assign to _ai_sym
215
226
  ):
@@ -217,6 +228,7 @@ def symset(
217
228
  _find_frame_dict('__msg_id')['_ai_sym'] = val
218
229
 
219
230
  # %% ../05_inspecttools.ipynb #72e5f0a8
231
+ @llmtool
220
232
  @delegates(sym2folderctx)
221
233
  def symfiles_folder(
222
234
  sym:str, # Dotted symbol path or "_last" for previous result
@@ -228,6 +240,7 @@ def symfiles_folder(
228
240
  return sym2folderctx(s, **kwargs)
229
241
 
230
242
  # %% ../05_inspecttools.ipynb #fdd0990e
243
+ @llmtool
231
244
  @delegates(sym2pkgctx)
232
245
  def symfiles_package(
233
246
  sym:str, # Dotted symbol path or "_last" for previous result
@@ -193,9 +193,10 @@ def sym2file(sym):
193
193
  @delegates(folder2ctx)
194
194
  def sym2folderctx(
195
195
  sym,
196
- types:str|list='py', # list or comma-separated str of ext types from: py, js, java, c, cpp, rb, r, ex, sh, web, doc, cfg
197
- skip_file_re=r'^_mod',
198
- **kwargs):
196
+ types:str|list='py', # List or comma-separated str of ext types from: py, js, java, c, cpp, rb, r, ex, sh, web, doc, cfg
197
+ skip_file_re:str=r'^_mod', # Skip files matching regex
198
+ **kwargs
199
+ ):
199
200
  "Return folder context for a symbol's source file location"
200
201
  return folder2ctx(Path(inspect.getfile(sym)).parent, types=types, skip_file_re=skip_file_re, **kwargs)
201
202
 
@@ -208,7 +209,13 @@ def sym2pkgpath(sym):
208
209
 
209
210
  # %% ../00_xml.ipynb #798ca61f
210
211
  @delegates(folder2ctx)
211
- def sym2pkgctx(sym, types:str|list='py', skip_file_re=r'^_mod', skip_folder_re=r'^(\.|__)', **kwargs):
212
+ def sym2pkgctx(
213
+ sym,
214
+ types:str|list='py', # List or comma-separated str of ext types from: py, js, java, c, cpp, rb, r, ex, sh, web, doc, cfg
215
+ skip_file_re:str=r'^_mod', # Skip files matching regex
216
+ skip_folder_re:str=r'^(\.|__)', # Skip folders matching regex
217
+ **kwargs
218
+ ):
212
219
  "Return contents of files in a symbol's root package"
213
220
  return folder2ctx(sym2pkgpath(sym), types=types, skip_file_re=skip_file_re, skip_folder_re=skip_folder_re, **kwargs)
214
221
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolslm
3
- Version: 0.3.25
3
+ Version: 0.3.26
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
@@ -16,7 +16,7 @@ Classifier: License :: OSI Approved :: Apache Software License
16
16
  Requires-Python: >=3.9
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: fastcore>=1.9.7
19
+ Requires-Dist: fastcore>=1.12.4
20
20
  Requires-Dist: httpx
21
21
  Requires-Dist: ghapi
22
22
  Requires-Dist: codesigs
@@ -1,4 +1,4 @@
1
- fastcore>=1.9.7
1
+ fastcore>=1.12.4
2
2
  httpx
3
3
  ghapi
4
4
  codesigs
@@ -1 +0,0 @@
1
- __version__ = "0.3.25"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes