LightAgent 0.2.6__tar.gz → 0.2.8__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.
@@ -14,10 +14,11 @@ import importlib
14
14
 
15
15
  # 全局工具注册表
16
16
  _FUNCTION_MAPPINGS = {} # 工具名称 -> 工具函数
17
+ _FUNCTION_INFO = {} # 工具名称 -> 工具info信息
17
18
  _OPENAI_FUNCTION_SCHEMAS = [] # OpenAI 格式的工具描述
18
19
  _PROMPT_FUNCTION_SCHEMAS = [] # prompt 格式的工具描述
19
20
 
20
- __version__ = "0.2.1" # 你可以根据需要设置版本号
21
+ __version__ = "0.2.8" # 你可以根据需要设置版本号
21
22
 
22
23
 
23
24
  def register_tool_manually(tools: List[Union[str, Callable]]) -> bool:
@@ -32,6 +33,9 @@ def register_tool_manually(tools: List[Union[str, Callable]]) -> bool:
32
33
 
33
34
  tool_info = func.tool_info
34
35
  tool_name = tool_info["tool_name"]
36
+
37
+ # 注册到全局字典
38
+ _FUNCTION_INFO[tool_name] = tool_info
35
39
  _FUNCTION_MAPPINGS[tool_name] = func # 注册工具
36
40
 
37
41
  # 构建 OpenAI 格式的工具描述
@@ -159,11 +163,14 @@ class LightAgent:
159
163
  instructions: Optional[str] = None, # 代理指令
160
164
  role: Optional[str] = None,
161
165
  model: str,
162
- api_key: str,
166
+ api_key: str | None = None,
163
167
  base_url: str | httpx.URL | None = None,
164
168
  websocket_base_url: str | httpx.URL | None = None,
165
169
  memory=None, # 支持外部传入记忆模块
166
170
  tree_of_thought: bool = False, # 是否启用链式思考
171
+ tot_model: str | None = None,
172
+ tot_api_key: str | None = None,
173
+ tot_base_url: str | httpx.URL | None = None,
167
174
  self_learning: bool = False, # 是否启用agent自我学习
168
175
  tools: List[Union[str, Callable]] = None, # 支持混合输入
169
176
  debug: bool = False, # 是否启用调试模式
@@ -182,6 +189,9 @@ class LightAgent:
182
189
  :param websocket_base_url: WebSocket 的基础 URL。
183
190
  :param memory: 外部传入的记忆模块,需实现 `retrieve` 和 `store` 方法。
184
191
  :param tree_of_thought: 是否启用思维链功能。
192
+ :param tot_model: 使用的模型名称。
193
+ :param tot_api_key: API 密钥。
194
+ :param tot_base_url: API 的基础 URL。
185
195
  :param tools: 工具列表,支持函数名称(字符串)或函数对象。
186
196
  :param debug: 是否启用调试模式。
187
197
  :param log_level: 日志级别(INFO, DEBUG, ERROR)。
@@ -236,9 +246,21 @@ class LightAgent:
236
246
  base_url = f"https://api.openai.com/v1"
237
247
 
238
248
  self.client = OpenAI(
239
- base_url=base_url,
240
- api_key=self.api_key
249
+ base_url = base_url,
250
+ api_key = self.api_key
241
251
  )
252
+ if self.tree_of_thought:
253
+ if tot_api_key is None:
254
+ tot_api_key = api_key
255
+ if tot_base_url is None:
256
+ tot_base_url = base_url
257
+ if not tot_model:
258
+ tot_model = "deepseek-r1" # 默认思维推理模型为deepseek-r1
259
+ self.tot_model = tot_model
260
+ self.tot_client = OpenAI(
261
+ base_url = tot_base_url,
262
+ api_key = tot_api_key
263
+ )
242
264
 
243
265
  def get_tool(self, tool_name: str) -> Callable:
244
266
  """
@@ -272,6 +294,7 @@ class LightAgent:
272
294
  # 注册工具函数
273
295
  if hasattr(tool_func, "tool_info"):
274
296
  tool_info = tool_func.tool_info
297
+ _FUNCTION_INFO[tool_name] = tool_info # 注册工具info信息
275
298
  _FUNCTION_MAPPINGS[tool_name] = tool_func
276
299
 
277
300
  # 构建 OpenAI 格式的工具描述
@@ -358,7 +381,7 @@ class LightAgent:
358
381
  query: str,
359
382
  light_swarm=None,
360
383
  stream: bool = False,
361
- max_retry: int = 5,
384
+ max_retry: int = 10,
362
385
  user_id: str = "default_user",
363
386
  history: list = None,
364
387
  metadata: Optional[Dict] = None,
@@ -398,7 +421,6 @@ class LightAgent:
398
421
  return result
399
422
 
400
423
  # 2. 正常处理任务
401
-
402
424
  now = datetime.now()
403
425
  current_date = now.strftime("%Y-%m-%d")
404
426
  current_time = now.strftime("%H:%M:%S")
@@ -483,10 +505,28 @@ class LightAgent:
483
505
  combined_response += chunk # 将每个 chunk 叠加
484
506
  if combined_response == "":
485
507
  combined_response = "".join(tool_response)
508
+
509
+ # 将 combined_response 解析为 JSON 对象(如果它是 JSON 字符串)
510
+ try:
511
+ combined_response = json.loads(combined_response) # 解析 JSON
512
+ except json.JSONDecodeError:
513
+ pass # 如果不是 JSON 字符串,保持原样
514
+
515
+ # 将 JSON 对象中的 Unicode 编码转换为中文字符
516
+ if isinstance(combined_response, dict):
517
+ combined_response = json.dumps(combined_response, ensure_ascii=False) # 确保中文字符不转义
518
+
486
519
  tool_responses.append(combined_response) # 将叠加后的完整响应添加到列表
487
520
  else:
488
521
  # print(f"Non-streaming response from tool: {function_call.name}")
489
522
  combined_response = tool_response
523
+ # 如果是 JSON 字符串,解析并转换为中文
524
+ if isinstance(combined_response, str):
525
+ try:
526
+ combined_response = json.loads(combined_response) # 解析 JSON
527
+ combined_response = json.dumps(combined_response, ensure_ascii=False) # 转换为中文
528
+ except json.JSONDecodeError:
529
+ pass # 如果不是 JSON 字符串,保持原样
490
530
  tool_responses.append(combined_response) # 直接添加普通响应
491
531
 
492
532
  self.log("INFO", "tool_response", {"tool_response": combined_response})
@@ -520,6 +560,7 @@ class LightAgent:
520
560
  # 更新响应
521
561
  if function_call_name == 'finish':
522
562
  return # 如果最后调用了finish工具,则结束生成器
563
+ # print(params)
523
564
  response = self.client.chat.completions.create(**params)
524
565
 
525
566
  # 重试次数用尽
@@ -583,6 +624,7 @@ class LightAgent:
583
624
  if tool_call["name"]: # 确保工具调用有名称
584
625
  function_call = {
585
626
  "name": tool_call["name"],
627
+ "title": _FUNCTION_INFO.get(tool_call["name"], {}).get('tool_title') or '',
586
628
  "arguments": tool_call["arguments"],
587
629
  }
588
630
  self.log("INFO", "tool_call", {"function_call": function_call})
@@ -610,7 +652,16 @@ class LightAgent:
610
652
  # print(f"Streaming response from tool: {function_call['name']}")
611
653
  combined_response = ""
612
654
  for chunk in tool_response:
613
- yield chunk
655
+ # 将工具返回的数据继续流出
656
+ tool_output = {
657
+ "name": tool_call["name"],
658
+ "title": _FUNCTION_INFO.get(tool_call["name"], {}).get(
659
+ 'tool_title') or '',
660
+ "output": chunk,
661
+ }
662
+ self.log("INFO", "tool_call", {"tool_output": tool_output})
663
+ yield tool_output
664
+ # 将工具的调用信息推送给开发者
614
665
  if function_call_name == 'finish':
615
666
  content = chunk.choices[0].delta.content or ""
616
667
  combined_response += content # 将每个 chunk 叠加
@@ -788,18 +839,21 @@ class LightAgent:
788
839
 
789
840
  def run_thought(self, query: str, stream=False, tools=None):
790
841
  """使用思维树的方式 让大模型先根据get_tools_str生成一个解答用户query的工具使用计划"""
791
- tot_model = "deepseek-chat" # self.model
842
+ tot_model = self.tot_model # self.model
792
843
  tools = get_tools_str()
793
844
  if not isinstance(tools, str):
794
845
  tools = str(tools) # 确保 tools 是字符串
795
- system_prompt = f"""你是一个智能助手,请根据用户输入的问题,结合工具使用计划,生成一个思维树,并按照思维树依次调用工具步骤,最终生成一个最终回答。/n 工具列表: {tools}"""
846
+ now = datetime.now()
847
+ current_date = now.strftime("%Y-%m-%d")
848
+ current_time = now.strftime("%H:%M:%S")
849
+ system_prompt = f"""你是一个智能助手,请根据用户输入的问题,结合工具使用计划,生成一个思维树,并按照思维树依次调用工具步骤,最终生成一个最终回答。/n 今日的日期: {current_date} 当前时间: {current_time} /n 工具列表: {tools}"""
796
850
  self.log("DEBUG", "run_thought", {"system_prompt": system_prompt})
797
851
 
798
852
  # 第一次请求,生成初始的工具使用计划
799
853
  params = dict(model=tot_model,
800
854
  messages=[{"role": "system", "content": system_prompt}, {"role": "user", "content": query}],
801
855
  stream=False)
802
- response = self.client.chat.completions.create(**params)
856
+ response = self.tot_client.chat.completions.create(**params)
803
857
  initial_content = response.choices[0].message.content
804
858
  self.log("DEBUG", "initial_response", {"response": initial_content})
805
859
 
@@ -812,7 +866,7 @@ class LightAgent:
812
866
  ], stream=False)
813
867
  self.log("DEBUG", "reflection_params", {"params": reflection_params})
814
868
 
815
- reflection_response = self.client.chat.completions.create(**reflection_params)
869
+ reflection_response = self.tot_client.chat.completions.create(**reflection_params)
816
870
  refined_content = reflection_response.choices[0].message.content
817
871
  self.log("DEBUG", "refined_response", {"response": refined_content})
818
872
  return refined_content
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LightAgent
3
- Version: 0.2.6
4
- Summary: **LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek, Qwen series large models, and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟
3
+ Version: 0.2.8
4
+ Summary: **LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek R1, Qwen series large models, and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟
5
5
  Home-page: https://github.com/wxai-space/LightAgent
6
6
  License: Apache 2.0
7
7
  Author: caiweige
@@ -54,7 +54,7 @@ Description-Content-Type: text/markdown
54
54
  <h1>LightAgent🚀 (Next Generation Agentic AI Framework)</h1>
55
55
  </div>
56
56
 
57
- **LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek, Qwen series large models, and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟
57
+ **LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek, Qwen, stepfun and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟
58
58
 
59
59
  ---
60
60
 
@@ -72,6 +72,15 @@ Description-Content-Type: text/markdown
72
72
  - **Tool Generator** 🚀: Just provide your API documentation to the [Tool Generator], which will automatically create exclusive tools for you, allowing you to quickly build hundreds of personalized custom tools in just 1 hour to improve efficiency and unleash your creative potential.
73
73
  - **Agent Self-Learning** 🧠️: Each agent has its own scene memory capabilities and the ability to self-learn from user conversations.
74
74
 
75
+ ---
76
+ ## News
77
+ - <img src="https://img.alicdn.com/imgextra/i3/O1CN01SFL0Gu26nrQBFKXFR_!!6000000007707-2-tps-500-500.png" alt="new" width="30" height="30"/>**[2025-02-19]** LightAgent v0.2.7 supports deepseek-r1 model for tot now.Significantly enhances the multi-tool planning capability for complex tasks.
78
+ - **[2025-02-06]** LightAgent version 0.2.5 is released now.
79
+ - **[2025-01-20]** LightAgent version 0.2.0 is released now.
80
+ - **[2025-01-05]** LightAgent version 0.1.0 is released now.
81
+
82
+ ---
83
+
75
84
  ## 🚧 Coming Soon
76
85
 
77
86
  - **Adaptive Tool Mechanism** 🛠️: Supports adding an unlimited number of tools, allowing the large model to first select a candidate tool set from thousands of tools, filtering irrelevant tools before submitting context to the large model, significantly reducing token consumption.
@@ -79,6 +88,7 @@ Description-Content-Type: text/markdown
79
88
  - **Agent Assessment** 📊: Built-in agent assessment tool for conveniently evaluating and optimizing the agents you build, aligning with business scenarios, and continuously improving intelligence levels.
80
89
 
81
90
  ## Built-in "Thought Flow"
91
+ ### ToT now supports DeepSeek-R1.
82
92
  The Thought Flow method effectively addresses challenges in complex scenarios through systematic, structured, and flexible thinking processes. Here are the specific implementation steps:
83
93
  ```text
84
94
  Problem Definition: Clarify the core problems and objectives.
@@ -488,7 +498,7 @@ agent.create_tool(text, tools_directory=tools_directory)
488
498
  After execution, two files will be generated in the tools directory: get_stock_kline_data.py and get_stock_realtime_data.py.
489
499
 
490
500
  ### 4. Tree of Thought (ToT)
491
- The built-in Tree of Thought module supports complex task decomposition and multi-step reasoning. Through the Tree of Thought, the agent can better handle complex tasks.
501
+ Currently, it is already supported to independently customize the use of the deepseek-r1 model for planning and thinking.The built-in Tree of Thought module supports complex task decomposition and multi-step reasoning. Through the Tree of Thought, the agent can better handle complex tasks.
492
502
 
493
503
  ```python
494
504
  # Enable Tree of Thought
@@ -497,6 +507,9 @@ agent = LightAgent(
497
507
  api_key="your_api_key",
498
508
  base_url="your_base_url",
499
509
  tree_of_thought=True, # Enable Tree of Thought
510
+ tot_model="deepseek-r1",
511
+ tot_api_key="sk-uXx0H0B***17778F1", # your deepseek r1 API Key
512
+ tot_base_url="https://api.deepseek.com/v1", # api url
500
513
  )
501
514
  ```
502
515
 
@@ -758,7 +771,7 @@ We look forward to your feedback and work together to make LightAgent even stron
758
771
  <h1>LightAgent🚀(下一代Agentic AI框架)</h1>
759
772
  </div>
760
773
 
761
- **LightAgent** 是一个极其轻量的带记忆(`mem0`)、工具(`Tools`)、思维树(`ToT`)的主动式 Agentic Framework(自主性框架)。它支持比Openai Swarm更简单的多智能体协同,构建具备自我学习能力的agent,并支持Agent测评,底层模型支持 OpenAI、智谱 ChatGLM、DeepSeek、阶跃星辰、Qwen千问大模型等。同时,LightAgent 支持 OpenAI 流格式 API 服务输出,无缝接入各大主流 Chat 框架。🌟
774
+ **LightAgent** 是一个极其轻量的带记忆(`mem0`)、工具(`Tools`)、思维树(`ToT`)的主动式 Agentic Framework(自主性框架)。它支持比Openai Swarm更简单的多智能体协同,构建具备自我学习能力的agent,并支持Agent测评,底层模型支持 OpenAI、智谱 ChatGLM、DeepSeek、阶跃星辰、Qwen通义千问大模型等。同时,LightAgent 支持 OpenAI 流格式 API 服务输出,无缝接入各大主流 Chat 框架。🌟
762
775
 
763
776
  ---
764
777
 
@@ -776,6 +789,14 @@ We look forward to your feedback and work together to make LightAgent even stron
776
789
  - **Tools工具生成器** 🚀:只需将您的API文档交给[Tools工具生成器],它将自动化地为您打造专属的tools,助您在短短1小时内快速构建数百个个性化的自定义工具,提升效率,释放您的创新潜能。
777
790
  - **agent自我学习** 🧠️:每个agent拥有自己的场景记忆能力,拥有从用户的对话中进行自我学习能力。
778
791
 
792
+ ---
793
+ ## 新闻
794
+ - <img src="https://img.alicdn.com/imgextra/i3/O1CN01SFL0Gu26nrQBFKXFR_!!6000000007707-2-tps-500-500.png" alt="new" width="30" height="30"/>**[2025-02-19]** LightAgent v0.2.7 支持单独采用 deepseek-r1 作为的agent推理规划ToT引擎,大幅度提升复杂任务的多工具Plan能力.
795
+ - **[2025-02-06]** LightAgent version 0.2.5 is released now.
796
+ - **[2025-01-20]** LightAgent version 0.2.0 is released now.
797
+ - **[2025-01-05]** LightAgent version 0.1.0 is released now.
798
+
799
+ ---
779
800
 
780
801
  ## 🚧 即将推出
781
802
 
@@ -784,7 +805,8 @@ We look forward to your feedback and work together to make LightAgent even stron
784
805
  - **Agent 测评** 📊:内置 Agent 测评工具,方便评估和优化你构建的Agent,对齐业务场景,持续提升智能水平。
785
806
 
786
807
 
787
- ## 内置 “思考流”
808
+ ## 🔥内置 “思考流”
809
+ ### ToT现已支持DeepSeek-R1
788
810
  (Thought Flow)方法通过系统性、结构化和灵活的思维过程,能够有效应对复杂场景中的挑战。
789
811
  以下是具体实施步骤:
790
812
  ```text
@@ -1197,7 +1219,7 @@ agent.create_tool(text, tools_directory=tools_directory)
1197
1219
  执行后将在tools目录中生成2个文件:get_stock_kline_data.py和get_stock_realtime_data.py
1198
1220
 
1199
1221
  ### 4. 思维树(ToT)
1200
- 内置思维树模块,支持复杂任务分解和多步推理。通过思维树,Agent 可以更好地处理复杂任务。
1222
+ 当前已经支持单独自定义使用deepseek-r1模型来做规划思考。内置思维树模块,支持复杂任务分解和多步推理。通过思维树,Agent 可以更好地处理复杂任务。
1201
1223
 
1202
1224
  ```python
1203
1225
  # 启用思维树
@@ -1206,6 +1228,9 @@ agent = LightAgent(
1206
1228
  api_key="your_api_key",
1207
1229
  base_url= "your_base_url",
1208
1230
  tree_of_thought=True, # 启用思维树
1231
+ tot_model="deepseek-r1",
1232
+ tot_api_key="sk-uXx0H0B***17778F1", # 替换为你的 deepseek r1 API Key
1233
+ tot_base_url="https://api.deepseek.com/v1", # api url
1209
1234
  )
1210
1235
  ```
1211
1236
 
@@ -33,7 +33,7 @@
33
33
  <h1>LightAgent🚀 (Next Generation Agentic AI Framework)</h1>
34
34
  </div>
35
35
 
36
- **LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek, Qwen series large models, and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟
36
+ **LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek, Qwen, stepfun and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟
37
37
 
38
38
  ---
39
39
 
@@ -51,6 +51,15 @@
51
51
  - **Tool Generator** 🚀: Just provide your API documentation to the [Tool Generator], which will automatically create exclusive tools for you, allowing you to quickly build hundreds of personalized custom tools in just 1 hour to improve efficiency and unleash your creative potential.
52
52
  - **Agent Self-Learning** 🧠️: Each agent has its own scene memory capabilities and the ability to self-learn from user conversations.
53
53
 
54
+ ---
55
+ ## News
56
+ - <img src="https://img.alicdn.com/imgextra/i3/O1CN01SFL0Gu26nrQBFKXFR_!!6000000007707-2-tps-500-500.png" alt="new" width="30" height="30"/>**[2025-02-19]** LightAgent v0.2.7 supports deepseek-r1 model for tot now.Significantly enhances the multi-tool planning capability for complex tasks.
57
+ - **[2025-02-06]** LightAgent version 0.2.5 is released now.
58
+ - **[2025-01-20]** LightAgent version 0.2.0 is released now.
59
+ - **[2025-01-05]** LightAgent version 0.1.0 is released now.
60
+
61
+ ---
62
+
54
63
  ## 🚧 Coming Soon
55
64
 
56
65
  - **Adaptive Tool Mechanism** 🛠️: Supports adding an unlimited number of tools, allowing the large model to first select a candidate tool set from thousands of tools, filtering irrelevant tools before submitting context to the large model, significantly reducing token consumption.
@@ -58,6 +67,7 @@
58
67
  - **Agent Assessment** 📊: Built-in agent assessment tool for conveniently evaluating and optimizing the agents you build, aligning with business scenarios, and continuously improving intelligence levels.
59
68
 
60
69
  ## Built-in "Thought Flow"
70
+ ### ToT now supports DeepSeek-R1.
61
71
  The Thought Flow method effectively addresses challenges in complex scenarios through systematic, structured, and flexible thinking processes. Here are the specific implementation steps:
62
72
  ```text
63
73
  Problem Definition: Clarify the core problems and objectives.
@@ -467,7 +477,7 @@ agent.create_tool(text, tools_directory=tools_directory)
467
477
  After execution, two files will be generated in the tools directory: get_stock_kline_data.py and get_stock_realtime_data.py.
468
478
 
469
479
  ### 4. Tree of Thought (ToT)
470
- The built-in Tree of Thought module supports complex task decomposition and multi-step reasoning. Through the Tree of Thought, the agent can better handle complex tasks.
480
+ Currently, it is already supported to independently customize the use of the deepseek-r1 model for planning and thinking.The built-in Tree of Thought module supports complex task decomposition and multi-step reasoning. Through the Tree of Thought, the agent can better handle complex tasks.
471
481
 
472
482
  ```python
473
483
  # Enable Tree of Thought
@@ -476,6 +486,9 @@ agent = LightAgent(
476
486
  api_key="your_api_key",
477
487
  base_url="your_base_url",
478
488
  tree_of_thought=True, # Enable Tree of Thought
489
+ tot_model="deepseek-r1",
490
+ tot_api_key="sk-uXx0H0B***17778F1", # your deepseek r1 API Key
491
+ tot_base_url="https://api.deepseek.com/v1", # api url
479
492
  )
480
493
  ```
481
494
 
@@ -33,7 +33,7 @@
33
33
  <h1>LightAgent🚀(下一代Agentic AI框架)</h1>
34
34
  </div>
35
35
 
36
- **LightAgent** 是一个极其轻量的带记忆(`mem0`)、工具(`Tools`)、思维树(`ToT`)的主动式 Agentic Framework(自主性框架)。它支持比Openai Swarm更简单的多智能体协同,构建具备自我学习能力的agent,并支持Agent测评,底层模型支持 OpenAI、智谱 ChatGLM、DeepSeek、阶跃星辰、Qwen千问大模型等。同时,LightAgent 支持 OpenAI 流格式 API 服务输出,无缝接入各大主流 Chat 框架。🌟
36
+ **LightAgent** 是一个极其轻量的带记忆(`mem0`)、工具(`Tools`)、思维树(`ToT`)的主动式 Agentic Framework(自主性框架)。它支持比Openai Swarm更简单的多智能体协同,构建具备自我学习能力的agent,并支持Agent测评,底层模型支持 OpenAI、智谱 ChatGLM、DeepSeek、阶跃星辰、Qwen通义千问大模型等。同时,LightAgent 支持 OpenAI 流格式 API 服务输出,无缝接入各大主流 Chat 框架。🌟
37
37
 
38
38
  ---
39
39
 
@@ -51,6 +51,14 @@
51
51
  - **Tools工具生成器** 🚀:只需将您的API文档交给[Tools工具生成器],它将自动化地为您打造专属的tools,助您在短短1小时内快速构建数百个个性化的自定义工具,提升效率,释放您的创新潜能。
52
52
  - **agent自我学习** 🧠️:每个agent拥有自己的场景记忆能力,拥有从用户的对话中进行自我学习能力。
53
53
 
54
+ ---
55
+ ## 新闻
56
+ - <img src="https://img.alicdn.com/imgextra/i3/O1CN01SFL0Gu26nrQBFKXFR_!!6000000007707-2-tps-500-500.png" alt="new" width="30" height="30"/>**[2025-02-19]** LightAgent v0.2.7 支持单独采用 deepseek-r1 作为的agent推理规划ToT引擎,大幅度提升复杂任务的多工具Plan能力.
57
+ - **[2025-02-06]** LightAgent version 0.2.5 is released now.
58
+ - **[2025-01-20]** LightAgent version 0.2.0 is released now.
59
+ - **[2025-01-05]** LightAgent version 0.1.0 is released now.
60
+
61
+ ---
54
62
 
55
63
  ## 🚧 即将推出
56
64
 
@@ -59,7 +67,8 @@
59
67
  - **Agent 测评** 📊:内置 Agent 测评工具,方便评估和优化你构建的Agent,对齐业务场景,持续提升智能水平。
60
68
 
61
69
 
62
- ## 内置 “思考流”
70
+ ## 🔥内置 “思考流”
71
+ ### ToT现已支持DeepSeek-R1
63
72
  (Thought Flow)方法通过系统性、结构化和灵活的思维过程,能够有效应对复杂场景中的挑战。
64
73
  以下是具体实施步骤:
65
74
  ```text
@@ -472,7 +481,7 @@ agent.create_tool(text, tools_directory=tools_directory)
472
481
  执行后将在tools目录中生成2个文件:get_stock_kline_data.py和get_stock_realtime_data.py
473
482
 
474
483
  ### 4. 思维树(ToT)
475
- 内置思维树模块,支持复杂任务分解和多步推理。通过思维树,Agent 可以更好地处理复杂任务。
484
+ 当前已经支持单独自定义使用deepseek-r1模型来做规划思考。内置思维树模块,支持复杂任务分解和多步推理。通过思维树,Agent 可以更好地处理复杂任务。
476
485
 
477
486
  ```python
478
487
  # 启用思维树
@@ -481,6 +490,9 @@ agent = LightAgent(
481
490
  api_key="your_api_key",
482
491
  base_url= "your_base_url",
483
492
  tree_of_thought=True, # 启用思维树
493
+ tot_model="deepseek-r1",
494
+ tot_api_key="sk-uXx0H0B***17778F1", # 替换为你的 deepseek r1 API Key
495
+ tot_base_url="https://api.deepseek.com/v1", # api url
484
496
  )
485
497
  ```
486
498
 
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "LightAgent"
3
- version = "0.2.6"
4
- description = "**LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek, Qwen series large models, and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟"
3
+ version = "0.2.8"
4
+ description = "**LightAgent** is an extremely lightweight active Agentic Framework with memory (`mem0`), tools (`Tools`), and a Tree of Thought (`ToT`). It supports swarm-like multi-agent collaboration, automated tool generation, and agent assessment, with underlying model support for OpenAI, Zhipu ChatGLM, Baichuan Large Model, DeepSeek R1, Qwen series large models, and more. At the same time, LightAgent supports OpenAI streaming format API service output, seamlessly integrating with major mainstream chat frameworks. 🌟"
5
5
  authors = ["caiweige <caiweige@qq.com>"]
6
6
  license = "Apache 2.0"
7
7
  readme = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes