stores 0.1.7.dev4__py3-none-any.whl → 0.1.7.dev6__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.
@@ -5,6 +5,7 @@ import json
5
5
  import logging
6
6
  import os
7
7
  import pickle
8
+ import queue
8
9
  import socket
9
10
  import subprocess
10
11
  import sys
@@ -340,16 +341,43 @@ def parse_tool_signature(
340
341
  elif signature_dict.get("isgeneratorfunction"):
341
342
 
342
343
  def func_handler(*args, **kwargs):
343
- for value in run_remote_tool(
344
- tool_id=signature_dict["tool_id"],
345
- index_folder=index_folder,
346
- args=args,
347
- kwargs=kwargs,
348
- venv=venv,
349
- env_var=env_var,
350
- stream=True,
351
- ):
352
- yield value
344
+ q = queue.Queue()
345
+ sentinel = object()
346
+
347
+ def run():
348
+ async def runner():
349
+ try:
350
+ async for item in run_remote_tool(
351
+ tool_id=signature_dict["tool_id"],
352
+ index_folder=index_folder,
353
+ args=args,
354
+ kwargs=kwargs,
355
+ venv=venv,
356
+ env_var=env_var,
357
+ stream=True,
358
+ ):
359
+ q.put(item)
360
+ except Exception as e:
361
+ q.put(e)
362
+ finally:
363
+ q.put(sentinel)
364
+
365
+ asyncio.run(runner())
366
+
367
+ t = threading.Thread(target=run)
368
+ t.start()
369
+
370
+ while True:
371
+ item = q.get()
372
+ if item is sentinel:
373
+ break
374
+ elif isinstance(item, Exception):
375
+ raise item
376
+ else:
377
+ yield item
378
+
379
+ t.join()
380
+
353
381
  elif signature_dict.get("iscoroutinefunction"):
354
382
 
355
383
  async def func_handler(*args, **kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stores
3
- Version: 0.1.7.dev4
3
+ Version: 0.1.7.dev6
4
4
  Summary: Repository of Python functions and tools for LLMs
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.10
@@ -8,8 +8,8 @@ stores/indexes/base_index.py,sha256=YrEwETZ5eXj3rXK5qxOllRXqFifQoteYdzPAasbvEyg,
8
8
  stores/indexes/index.py,sha256=Cub5mtnYGipHfPR8BexJYRSKfuJmcGPp0B3ou2bGNqs,2901
9
9
  stores/indexes/local_index.py,sha256=Gg9LkEo1L0_NZZYPItsF_-1y6nFP369C3QlPvPyvPx8,3708
10
10
  stores/indexes/remote_index.py,sha256=-GV4l2c7GL6_bcVOQnSK5rzYru237bwC5L6eiO-QFzM,3438
11
- stores/indexes/venv_utils.py,sha256=-6cL9dcW9TVc1rTGHTCFIIrA38FaG8DKElNuwRL9-78,17764
12
- stores-0.1.7.dev4.dist-info/METADATA,sha256=kmOekRAa1E8TGBgejyKqDNuzt3A7XSCCOeytEfwp1_s,3081
13
- stores-0.1.7.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- stores-0.1.7.dev4.dist-info/licenses/LICENSE,sha256=VTidYE7_Dam0Dwyq095EhhDIqi47g03oVpLAHQgKws0,1066
15
- stores-0.1.7.dev4.dist-info/RECORD,,
11
+ stores/indexes/venv_utils.py,sha256=k664ptVhPfs4AHCpB6CiE-pWHGcqi982YjsZDDt64Ys,18577
12
+ stores-0.1.7.dev6.dist-info/METADATA,sha256=Gg4CaLZDS0isd_R0Vhpn7IGCIQQ51Og5rBuBANnV7tk,3081
13
+ stores-0.1.7.dev6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ stores-0.1.7.dev6.dist-info/licenses/LICENSE,sha256=VTidYE7_Dam0Dwyq095EhhDIqi47g03oVpLAHQgKws0,1066
15
+ stores-0.1.7.dev6.dist-info/RECORD,,