pycoze 0.1.146__py3-none-any.whl → 0.1.148__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
pycoze/bot/bot.py CHANGED
@@ -25,11 +25,11 @@ def load_abilities(bot_setting_file: str):
25
25
 
26
26
  abilities = []
27
27
  for bot_id in role_setting["bots"]:
28
- bot = ref_bot(bot_id)
28
+ bot = ref_bot(bot_id, as_agent_tool=True)
29
29
  if bot:
30
30
  abilities.append(bot)
31
31
  for tool_id in role_setting["tools"]:
32
- abilities.extend(ref_tools(tool_id))
32
+ abilities.extend(ref_tools(tool_id, as_agent_tool=True))
33
33
  return abilities
34
34
 
35
35
 
pycoze/reference/bot.py CHANGED
@@ -9,7 +9,7 @@ import json
9
9
 
10
10
  bot_index = 0
11
11
 
12
- def ref_bot(bot_id):
12
+ def ref_bot(bot_id, as_agent_tool=False):
13
13
  global bot_index
14
14
  tool_base_path = "../../bot"
15
15
  module_path = os.path.join(tool_base_path, bot_id)
@@ -53,7 +53,7 @@ def {random_name}(command:str) -> str:
53
53
  tool.func = wrapped_func(tool, module_path)
54
54
  if tool.description is None:
55
55
  tool.description = "This tool is used to " + tool.name + "."
56
- return tool
56
+ return tool if as_agent_tool else tool.func
57
57
  except Exception as e:
58
58
  print(f"Error loading bot {bot_id}: {e}")
59
59
  return None
pycoze/reference/lib.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import sys
3
3
  import importlib
4
+ import types
4
5
 
5
6
 
6
7
  class ChangeDirectoryAndPath:
@@ -58,7 +59,7 @@ def wrapped_func(item, module_path):
58
59
  with ChangeDirectoryAndPath(module_path):
59
60
  result = original_tool_function(*args, **kwargs)
60
61
  try:
61
- print(f"{item.name} 调用完毕,结果为:", result)
62
+ print(f"{item.name} 调用完毕,结果:", result, type result, isinstance(result, types.GeneratorType))
62
63
  except:
63
64
  pass
64
65
  return result
pycoze/reference/tool.py CHANGED
@@ -7,7 +7,7 @@ import langchain_core
7
7
  from .lib import ChangeDirectoryAndPath, ModuleManager, wrapped_func
8
8
 
9
9
 
10
- def ref_tools(tool_id):
10
+ def ref_tools(tool_id, as_agent_tool=False):
11
11
  tool_base_path = "../../tool"
12
12
  module_path = os.path.join(tool_base_path, tool_id)
13
13
  module_path = os.path.normpath(os.path.abspath(module_path))
@@ -39,4 +39,4 @@ def ref_tools(tool_id):
39
39
  if tool.description is None:
40
40
  tool.description = "This tool is used to " + tool.name + "."
41
41
 
42
- return export_tools
42
+ return export_tools if as_agent_tool else [tool.func for tool in export_tools]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.146
3
+ Version: 0.1.148
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -3,7 +3,7 @@ pycoze/module.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pycoze/ai/__init__.py,sha256=odM2lgYSnApxw4AzLV_5AyaxL5_MLfydOSB1VmLGFyA,75
4
4
  pycoze/ai/vram_reserve.py,sha256=QbqaA8qv87cnEpOVDMygi0BNMxuhLYwj1UKfR_D5BD4,4340
5
5
  pycoze/bot/__init__.py,sha256=6HHMxDQVOyZM9dtSjQm9tjGnhj4h7CixD0JOvEwTi48,41
6
- pycoze/bot/bot.py,sha256=uBezgDfi8WOBguTB0oqFigFcB2CbCAU9rdrJrNQgzVE,3364
6
+ pycoze/bot/bot.py,sha256=QNFul9KZHMuTcTeWe2wbrh9l3tSdtP_o1_KwzD01EOo,3404
7
7
  pycoze/bot/agent/__init__.py,sha256=YR9vpkEQn1e4937r_xFPJXUCPBEJ0SFzEQDBe2x3-YA,157
8
8
  pycoze/bot/agent/agent.py,sha256=Aue8nWeW_I7e1jo4o7cUjFFjrsV9NtVUiTX3EQYHmbA,3507
9
9
  pycoze/bot/agent/assistant.py,sha256=3iLxnRvf_ia0cP-FHK5Fv4ylltlnzPq1KscRCFYqjkc,1147
@@ -12,9 +12,9 @@ pycoze/bot/agent/agent_types/__init__.py,sha256=zmU2Kmrv5mCdfg-QlPn2H6pWxbGeq8s7
12
12
  pycoze/bot/agent/agent_types/const.py,sha256=BfUKPrhAHREoMLHuFNG2bCIEkC1-f7K0LEqNg4RwiRE,70
13
13
  pycoze/bot/agent/agent_types/openai_func_call_agent.py,sha256=SnEm5MODHn2uMsaMNqgzULM_91vqLHC0TU6ovwCOqLU,6675
14
14
  pycoze/reference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- pycoze/reference/bot.py,sha256=UMnDxCe_E3pz77Pw3my1be7SwcrIi9qhQLESZu8Q4M0,2152
16
- pycoze/reference/lib.py,sha256=sp3PqvsyE3OjSqgnykyaz_JARwelMGq44NQUU1x7IV4,2045
17
- pycoze/reference/tool.py,sha256=tieFKJkWW65zP4ld5Vtcrz66Is21QOh-XAZD6rs_ol8,1446
15
+ pycoze/reference/bot.py,sha256=6w8LGBFxLygAMR4UUiItUF3AbClnoyDaSoyPK3V-mIg,2205
16
+ pycoze/reference/lib.py,sha256=6l29w22NAPRbL9uq8JtCro8LH3S91kNHU9JEjHBJQBE,2110
17
+ pycoze/reference/tool.py,sha256=W-XAa2ppIZET99kJcaU9mgYxsxJEKos9ZSUQA8hbqX0,1526
18
18
  pycoze/ui/__init__.py,sha256=7xAfL2lfG7-jllPJEZUJO89xUE9sNzvo1y0WmBswjBI,458
19
19
  pycoze/ui/base.py,sha256=SCXVDK7PpMaBv6ovvabHcfRq_d2AWM0BRyxpNhuJN5A,1285
20
20
  pycoze/ui/color.py,sha256=cT9Ib8uNzkOKxyW0IwVj46o4LwdB1xgNCj1_Rou9d_4,854
@@ -23,8 +23,8 @@ pycoze/ui/ui_def.py,sha256=UhhU_yB3GV9ISbvTWT48hsHPHI250BhMILh6bu5Uioo,4206
23
23
  pycoze/utils/__init__.py,sha256=ET0W5wzq4zlY3dr1wHVbbeRKlKdC_zqHt9b0jZyHohw,94
24
24
  pycoze/utils/arg.py,sha256=orLVEGw3x2f3l7bZDbBPkkdDPSdqXo-_Rs-4ZhzmrEw,984
25
25
  pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
26
- pycoze-0.1.146.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
27
- pycoze-0.1.146.dist-info/METADATA,sha256=kwGock8TR0QWHQbZ8dhcaPc6mjjd43BuPR_s0Q4VY1o,726
28
- pycoze-0.1.146.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
29
- pycoze-0.1.146.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
30
- pycoze-0.1.146.dist-info/RECORD,,
26
+ pycoze-0.1.148.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
27
+ pycoze-0.1.148.dist-info/METADATA,sha256=z4ijocIjsHLxvJbiUXnaoA7D6z_TiKQY9sAfHkxcCzY,726
28
+ pycoze-0.1.148.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
29
+ pycoze-0.1.148.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
30
+ pycoze-0.1.148.dist-info/RECORD,,