SimpleLLMFunc 0.2.6__tar.gz → 0.2.7__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.
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/PKG-INFO +1 -1
- simplellmfunc-0.2.7/SimpleLLMFunc/.DS_Store +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/__init__.py +2 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/interface/openai_compatible.py +0 -1
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/llm_decorator/llm_chat_decorator.py +4 -2
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/llm_decorator/utils.py +4 -3
- simplellmfunc-0.2.7/SimpleLLMFunc/tool/agent.log +5 -0
- simplellmfunc-0.2.7/SimpleLLMFunc/tool/log_indices/trace_index.json +12 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/pyproject.toml +1 -1
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/LICENSE +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/README.md +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/config.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/interface/__init__.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/interface/key_pool.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/interface/llm_interface.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/interface/token_bucket.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/llm_decorator/__init__.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/llm_decorator/llm_function_decorator.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/llm_decorator/multimodal_types.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/logger/__init__.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/logger/logger.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/logger/logger_config.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/tool/__init__.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/tool/tool.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/type/__init__.py +0 -0
- {simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: SimpleLLMFunc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: 一个轻量但完备的LLM/Agent应用开发框架,提供装饰器实现将函数DocString作为Prompt而无需函数体具体实现但能够享受函数定义和类型标注带来效率提升的开发体验。以最Code的方式,用最少的代码将LLM能力集成到任意Python项目中。
|
|
5
5
|
Author: Ni Jingzhe
|
|
6
6
|
Author-email: nijingzhe@zju.edu.cn
|
|
Binary file
|
|
@@ -466,7 +466,6 @@ class OpenAICompatible(LLM_Interface):
|
|
|
466
466
|
except Exception as e:
|
|
467
467
|
self.key_pool.decrement_task_count(key)
|
|
468
468
|
attempt += 1
|
|
469
|
-
location = get_location()
|
|
470
469
|
data = json.dumps(messages, ensure_ascii=False, indent=4)
|
|
471
470
|
push_warning(
|
|
472
471
|
f"{self.model_name} Interface attempt {attempt} failed: With message : {data} send, \n but exception : {str(e)} was caught",
|
{simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/llm_decorator/llm_chat_decorator.py
RENAMED
|
@@ -120,6 +120,7 @@ def llm_chat(
|
|
|
120
120
|
|
|
121
121
|
@wraps(func)
|
|
122
122
|
def wrapper(*args, **kwargs):
|
|
123
|
+
|
|
123
124
|
# 生成唯一的追踪ID
|
|
124
125
|
context_trace_id = get_current_trace_id()
|
|
125
126
|
current_trace_id = f"{func_name}_{uuid.uuid4()}"
|
|
@@ -405,7 +406,7 @@ async def _async_llm_chat_impl(
|
|
|
405
406
|
yield content, current_messages
|
|
406
407
|
|
|
407
408
|
# 9. 添加最终响应到历史记录
|
|
408
|
-
current_messages.append({"role": "assistant", "content": complete_content})
|
|
409
|
+
# current_messages.append({"role": "assistant", "content": complete_content})
|
|
409
410
|
yield "", current_messages
|
|
410
411
|
|
|
411
412
|
if use_log_context:
|
|
@@ -611,7 +612,8 @@ def _build_messages(
|
|
|
611
612
|
if custom_history:
|
|
612
613
|
for msg in custom_history:
|
|
613
614
|
if isinstance(msg, dict) and "role" in msg and "content" in msg:
|
|
614
|
-
|
|
615
|
+
if msg["role"] not in ["system"]:
|
|
616
|
+
messages.append(msg)
|
|
615
617
|
else:
|
|
616
618
|
push_warning(
|
|
617
619
|
f"跳过格式不正确的历史记录项: {msg}",
|
|
@@ -62,7 +62,8 @@ async def execute_llm(
|
|
|
62
62
|
func_name = get_current_context_attribute("function_name") or "Unknown Function"
|
|
63
63
|
|
|
64
64
|
# 创建消息历史副本,避免修改原始消息列表
|
|
65
|
-
current_messages = list(messages)
|
|
65
|
+
#current_messages = list(messages)
|
|
66
|
+
current_messages = messages
|
|
66
67
|
|
|
67
68
|
# 记录调用次数
|
|
68
69
|
call_count = 0
|
|
@@ -73,7 +74,6 @@ async def execute_llm(
|
|
|
73
74
|
location=get_location(),
|
|
74
75
|
)
|
|
75
76
|
|
|
76
|
-
# 如果 stream 为 True,使用流式响应
|
|
77
77
|
if stream:
|
|
78
78
|
push_debug(f"LLM 函数 '{func_name}' 使用流式响应", location=get_location())
|
|
79
79
|
|
|
@@ -583,7 +583,8 @@ def _process_tool_calls(
|
|
|
583
583
|
更新后的消息历史
|
|
584
584
|
"""
|
|
585
585
|
# 创建消息历史副本
|
|
586
|
-
current_messages = list(messages)
|
|
586
|
+
#current_messages = list(messages)
|
|
587
|
+
current_messages = messages
|
|
587
588
|
|
|
588
589
|
# 处理每个工具调用
|
|
589
590
|
for tool_call in tool_calls:
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"timestamp": "2025-06-20T18:41:11.176039", "level": "INFO", "logger": "SimpleLLMFunc", "message": "Logger initialized (dir=./, file=agent.log)", "module": "logger", "function": "setup_logger", "line": 635, "thread": "MainThread", "process": 5149}
|
|
2
|
+
{"timestamp": "2025-06-20T18:41:11.176523", "level": "INFO", "logger": "SimpleLLMFunc", "message": "全局日志系统初始化完成, 日志文件路径: .//agent.log, 日志级别: DEBUG", "module": "logger", "function": "push_info", "line": 825, "thread": "MainThread", "process": 5149}
|
|
3
|
+
{"timestamp": "2025-06-20T18:41:11.176675", "level": "DEBUG", "logger": "SimpleLLMFunc", "message": "测试DEBUG级别日志", "module": "logger", "function": "push_debug", "line": 796, "thread": "MainThread", "process": 5149}
|
|
4
|
+
{"timestamp": "2025-06-20T18:41:11.176773", "level": "INFO", "logger": "SimpleLLMFunc", "message": "测试INFO级别日志(app_log)", "module": "logger", "function": "app_log", "line": 767, "thread": "MainThread", "process": 5149}
|
|
5
|
+
{"timestamp": "2025-06-20T18:41:11.176859", "level": "INFO", "logger": "SimpleLLMFunc", "message": "测试INFO级别日志(push_info)", "module": "logger", "function": "push_info", "line": 825, "thread": "MainThread", "process": 5149}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "SimpleLLMFunc"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.7"
|
|
4
4
|
description = "一个轻量但完备的LLM/Agent应用开发框架,提供装饰器实现将函数DocString作为Prompt而无需函数体具体实现但能够享受函数定义和类型标注带来效率提升的开发体验。以最Code的方式,用最少的代码将LLM能力集成到任意Python项目中。"
|
|
5
5
|
authors = ["Ni Jingzhe <nijingzhe@zju.edu.cn>"]
|
|
6
6
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simplellmfunc-0.2.6 → simplellmfunc-0.2.7}/SimpleLLMFunc/llm_decorator/llm_function_decorator.py
RENAMED
|
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
|