pycoze 0.1.31__tar.gz → 0.1.32__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.
Files changed (32) hide show
  1. {pycoze-0.1.31 → pycoze-0.1.32}/PKG-INFO +1 -1
  2. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/bot.py +22 -20
  3. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze.egg-info/PKG-INFO +1 -1
  4. {pycoze-0.1.31 → pycoze-0.1.32}/setup.py +1 -1
  5. {pycoze-0.1.31 → pycoze-0.1.32}/LICENSE +0 -0
  6. {pycoze-0.1.31 → pycoze-0.1.32}/README.md +0 -0
  7. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/__init__.py +0 -0
  8. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/__init__.py +0 -0
  9. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/__init__.py +0 -0
  10. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/agent.py +0 -0
  11. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/agent_types/__init__.py +0 -0
  12. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +0 -0
  13. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/agent_types/react_agent.py +0 -0
  14. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/agent_types/react_prompt.py +0 -0
  15. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/assistant.py +0 -0
  16. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/agent/chat.py +0 -0
  17. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/bot/base.py +0 -0
  18. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/gpu/__init__.py +0 -0
  19. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/gpu/gpu_reserve.py +0 -0
  20. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/module.py +0 -0
  21. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/ui/__init__.py +0 -0
  22. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/ui/base.py +0 -0
  23. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/ui/color.py +0 -0
  24. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/ui/typ.py +0 -0
  25. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/ui/ui_def.py +0 -0
  26. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/utils/__init__.py +0 -0
  27. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/utils/arg.py +0 -0
  28. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze/utils/text_or_file.py +0 -0
  29. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze.egg-info/SOURCES.txt +0 -0
  30. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze.egg-info/dependency_links.txt +0 -0
  31. {pycoze-0.1.31 → pycoze-0.1.32}/pycoze.egg-info/top_level.txt +0 -0
  32. {pycoze-0.1.31 → pycoze-0.1.32}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.31
3
+ Version: 0.1.32
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -26,31 +26,33 @@ def load_tools(bot_setting_file: str):
26
26
  return tools
27
27
 
28
28
 
29
- def chat(bot_setting_file: str):
29
+ def run_agent(bot_setting_file, history):
30
+ role_setting = load_role_setting(bot_setting_file)
31
+ tools = load_tools(bot_setting_file)
32
+ with open(llm_file, "r", encoding="utf-8") as f:
33
+ cfg = json.load(f)
34
+ chat = ChatOpenAI(
35
+ api_key=cfg["apiKey"],
36
+ base_url=cfg["baseURL"],
37
+ model=cfg["model"],
38
+ temperature=role_setting["temperature"],
39
+ )
40
+
41
+ agent = Runnable(
42
+ agent_execution_mode="FuncCall", # 'FuncCall' or 'ReAct',大模型支持FuncCall的话就用FuncCall
43
+ tools=tools,
44
+ llm=chat,
45
+ assistant_message=role_setting["prompt"],
46
+ )
47
+ return asyncio.run(run_agent(agent, history))
48
+
30
49
 
50
+ def chat(bot_setting_file: str):
31
51
  while True:
32
52
  input_text = input()
33
- role_setting = load_role_setting(bot_setting_file)
34
- tools = load_tools(bot_setting_file)
35
53
  if not input_text.startswith(INPUT_MESSAGE):
36
54
  raise ValueError("Invalid message")
37
55
  messages = json.loads(input_text[len(INPUT_MESSAGE) :])
38
-
39
- with open(llm_file, "r", encoding="utf-8") as f:
40
- cfg = json.load(f)
41
- chat = ChatOpenAI(
42
- api_key=cfg["apiKey"],
43
- base_url=cfg["baseURL"],
44
- model=cfg["model"],
45
- temperature=role_setting["temperature"],
46
- )
47
-
48
- agent = Runnable(
49
- agent_execution_mode="FuncCall", # 'FuncCall' or 'ReAct',大模型支持FuncCall的话就用FuncCall
50
- tools=tools,
51
- llm=chat,
52
- assistant_message=role_setting["prompt"],
53
- )
54
56
  history = []
55
57
  for message in messages:
56
58
  if message["role"] == "assistant":
@@ -61,5 +63,5 @@ def chat(bot_setting_file: str):
61
63
  history += [SystemMessage(content=message["content"])]
62
64
  else:
63
65
  raise ValueError("Invalid message")
64
- result = asyncio.run(run_agent(agent, history))
66
+ result = run_agent(bot_setting_file, history)
65
67
  output("assistant", result, history)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.31
3
+ Version: 0.1.32
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pycoze",
5
- version="0.1.31",
5
+ version="0.1.32",
6
6
  packages=find_packages(),
7
7
  install_requires=[],
8
8
  author="Yuan Jie Xiong",
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
File without changes
File without changes
File without changes