LightAgent 0.2.8__tar.gz → 0.2.81__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.
- {lightagent-0.2.8 → lightagent-0.2.81}/LightAgent/la_core.py +14 -10
- {lightagent-0.2.8 → lightagent-0.2.81}/PKG-INFO +5 -1
- {lightagent-0.2.8 → lightagent-0.2.81}/README.md +2 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.zh-CN.md +2 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/pyproject.toml +1 -1
- {lightagent-0.2.8 → lightagent-0.2.81}/LICENSE +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/LightAgent/__init__.py +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.de.md +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.es.md +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.fr.md +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.ja.md +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.ko.md +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.pt.md +0 -0
- {lightagent-0.2.8 → lightagent-0.2.81}/README.ru.md +0 -0
|
@@ -11,6 +11,7 @@ import logging
|
|
|
11
11
|
import os
|
|
12
12
|
import httpx
|
|
13
13
|
import importlib
|
|
14
|
+
from openai.types.chat import ChatCompletionChunk
|
|
14
15
|
|
|
15
16
|
# 全局工具注册表
|
|
16
17
|
_FUNCTION_MAPPINGS = {} # 工具名称 -> 工具函数
|
|
@@ -18,7 +19,7 @@ _FUNCTION_INFO = {} # 工具名称 -> 工具info信息
|
|
|
18
19
|
_OPENAI_FUNCTION_SCHEMAS = [] # OpenAI 格式的工具描述
|
|
19
20
|
_PROMPT_FUNCTION_SCHEMAS = [] # prompt 格式的工具描述
|
|
20
21
|
|
|
21
|
-
__version__ = "0.2.
|
|
22
|
+
__version__ = "0.2.81" # 你可以根据需要设置版本号
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
def register_tool_manually(tools: List[Union[str, Callable]]) -> bool:
|
|
@@ -653,14 +654,17 @@ class LightAgent:
|
|
|
653
654
|
combined_response = ""
|
|
654
655
|
for chunk in tool_response:
|
|
655
656
|
# 将工具返回的数据继续流出
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
657
|
+
if isinstance(chunk, ChatCompletionChunk):
|
|
658
|
+
yield chunk
|
|
659
|
+
else:
|
|
660
|
+
tool_output = {
|
|
661
|
+
"name": tool_call["name"],
|
|
662
|
+
"title": _FUNCTION_INFO.get(tool_call["name"], {}).get(
|
|
663
|
+
'tool_title') or '',
|
|
664
|
+
"output": chunk,
|
|
665
|
+
}
|
|
666
|
+
self.log("INFO", "tool_call", {"tool_output": tool_output})
|
|
667
|
+
yield tool_output
|
|
664
668
|
# 将工具的调用信息推送给开发者
|
|
665
669
|
if function_call_name == 'finish':
|
|
666
670
|
content = chunk.choices[0].delta.content or ""
|
|
@@ -1087,4 +1091,4 @@ class LightSwarm:
|
|
|
1087
1091
|
if __name__ == "__main__":
|
|
1088
1092
|
# Example of registering and using a tool
|
|
1089
1093
|
print("This is LightAgent")
|
|
1090
|
-
# print(dispatch_tool("example_tool", {"param1": "test"}))
|
|
1094
|
+
# print(dispatch_tool("example_tool", {"param1": "test"}))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LightAgent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.81
|
|
4
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
|
|
@@ -356,6 +356,7 @@ def get_weather(
|
|
|
356
356
|
# Define tool information inside the function
|
|
357
357
|
get_weather.tool_info = {
|
|
358
358
|
"tool_name": "get_weather",
|
|
359
|
+
"tool_title": "get weather",
|
|
359
360
|
"tool_description": "Get current weather information for the specified city.",
|
|
360
361
|
"tool_params": [
|
|
361
362
|
{"name": "city_name", "description": "The name of the city to query", "type": "string", "required": True},
|
|
@@ -378,6 +379,7 @@ def search_news(
|
|
|
378
379
|
# Define tool information inside the function
|
|
379
380
|
search_news.tool_info = {
|
|
380
381
|
"tool_name": "search_news",
|
|
382
|
+
"tool_title": "search news",
|
|
381
383
|
"tool_description": "Search news based on keywords.",
|
|
382
384
|
"tool_params": [
|
|
383
385
|
{"name": "keyword", "description": "Search keyword", "type": "string", "required": True},
|
|
@@ -1077,6 +1079,7 @@ def get_weather(
|
|
|
1077
1079
|
# 在函数内部定义工具信息
|
|
1078
1080
|
get_weather.tool_info = {
|
|
1079
1081
|
"tool_name": "get_weather",
|
|
1082
|
+
"tool_name": "获取天气",
|
|
1080
1083
|
"tool_description": "获取指定城市的当前天气信息",
|
|
1081
1084
|
"tool_params": [
|
|
1082
1085
|
{"name": "city_name", "description": "要查询的城市名称", "type": "string", "required": True},
|
|
@@ -1099,6 +1102,7 @@ def search_news(
|
|
|
1099
1102
|
# 在函数内部定义工具信息
|
|
1100
1103
|
search_news.tool_info = {
|
|
1101
1104
|
"tool_name": "search_news",
|
|
1105
|
+
"tool_name": "联网搜索",
|
|
1102
1106
|
"tool_description": "根据关键词搜索新闻",
|
|
1103
1107
|
"tool_params": [
|
|
1104
1108
|
{"name": "keyword", "description": "搜索关键词", "type": "string", "required": True},
|
|
@@ -335,6 +335,7 @@ def get_weather(
|
|
|
335
335
|
# Define tool information inside the function
|
|
336
336
|
get_weather.tool_info = {
|
|
337
337
|
"tool_name": "get_weather",
|
|
338
|
+
"tool_title": "get weather",
|
|
338
339
|
"tool_description": "Get current weather information for the specified city.",
|
|
339
340
|
"tool_params": [
|
|
340
341
|
{"name": "city_name", "description": "The name of the city to query", "type": "string", "required": True},
|
|
@@ -357,6 +358,7 @@ def search_news(
|
|
|
357
358
|
# Define tool information inside the function
|
|
358
359
|
search_news.tool_info = {
|
|
359
360
|
"tool_name": "search_news",
|
|
361
|
+
"tool_title": "search news",
|
|
360
362
|
"tool_description": "Search news based on keywords.",
|
|
361
363
|
"tool_params": [
|
|
362
364
|
{"name": "keyword", "description": "Search keyword", "type": "string", "required": True},
|
|
@@ -339,6 +339,7 @@ def get_weather(
|
|
|
339
339
|
# 在函数内部定义工具信息
|
|
340
340
|
get_weather.tool_info = {
|
|
341
341
|
"tool_name": "get_weather",
|
|
342
|
+
"tool_name": "获取天气",
|
|
342
343
|
"tool_description": "获取指定城市的当前天气信息",
|
|
343
344
|
"tool_params": [
|
|
344
345
|
{"name": "city_name", "description": "要查询的城市名称", "type": "string", "required": True},
|
|
@@ -361,6 +362,7 @@ def search_news(
|
|
|
361
362
|
# 在函数内部定义工具信息
|
|
362
363
|
search_news.tool_info = {
|
|
363
364
|
"tool_name": "search_news",
|
|
365
|
+
"tool_name": "联网搜索",
|
|
364
366
|
"tool_description": "根据关键词搜索新闻",
|
|
365
367
|
"tool_params": [
|
|
366
368
|
{"name": "keyword", "description": "搜索关键词", "type": "string", "required": True},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "LightAgent"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.81"
|
|
4
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"
|
|
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
|