aiecs 1.1.0__py3-none-any.whl → 1.2.1__py3-none-any.whl

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.

Potentially problematic release.


This version of aiecs might be problematic. Click here for more details.

Files changed (81) hide show
  1. aiecs/__init__.py +1 -1
  2. aiecs/aiecs_client.py +1 -1
  3. aiecs/config/config.py +38 -0
  4. aiecs/domain/__init__.py +95 -0
  5. aiecs/domain/community/__init__.py +159 -0
  6. aiecs/domain/community/agent_adapter.py +516 -0
  7. aiecs/domain/community/analytics.py +465 -0
  8. aiecs/domain/community/collaborative_workflow.py +99 -7
  9. aiecs/domain/community/communication_hub.py +649 -0
  10. aiecs/domain/community/community_builder.py +322 -0
  11. aiecs/domain/community/community_integration.py +365 -12
  12. aiecs/domain/community/community_manager.py +481 -5
  13. aiecs/domain/community/decision_engine.py +459 -13
  14. aiecs/domain/community/exceptions.py +238 -0
  15. aiecs/domain/community/models/__init__.py +36 -0
  16. aiecs/domain/community/resource_manager.py +1 -1
  17. aiecs/domain/community/shared_context_manager.py +621 -0
  18. aiecs/domain/context/context_engine.py +37 -33
  19. aiecs/infrastructure/monitoring/__init__.py +22 -0
  20. aiecs/infrastructure/monitoring/global_metrics_manager.py +207 -0
  21. aiecs/infrastructure/persistence/file_storage.py +41 -28
  22. aiecs/llm/__init__.py +44 -7
  23. aiecs/llm/callbacks/__init__.py +12 -0
  24. aiecs/llm/{custom_callbacks.py → callbacks/custom_callbacks.py} +1 -1
  25. aiecs/llm/client_factory.py +23 -6
  26. aiecs/llm/clients/__init__.py +35 -0
  27. aiecs/llm/{base_client.py → clients/base_client.py} +73 -1
  28. aiecs/llm/{googleai_client.py → clients/googleai_client.py} +19 -15
  29. aiecs/llm/{openai_client.py → clients/openai_client.py} +9 -14
  30. aiecs/llm/{vertex_client.py → clients/vertex_client.py} +15 -15
  31. aiecs/llm/{xai_client.py → clients/xai_client.py} +36 -50
  32. aiecs/llm/config/__init__.py +54 -0
  33. aiecs/llm/config/config_loader.py +275 -0
  34. aiecs/llm/config/config_validator.py +237 -0
  35. aiecs/llm/config/model_config.py +132 -0
  36. aiecs/llm/utils/__init__.py +11 -0
  37. aiecs/llm/utils/validate_config.py +91 -0
  38. aiecs/main.py +32 -2
  39. aiecs/scripts/aid/VERSION_MANAGEMENT.md +97 -0
  40. aiecs/scripts/aid/__init__.py +15 -0
  41. aiecs/scripts/aid/version_manager.py +224 -0
  42. aiecs/scripts/dependance_check/download_nlp_data.py +1 -0
  43. aiecs/tools/__init__.py +23 -23
  44. aiecs/tools/docs/__init__.py +5 -2
  45. aiecs/tools/docs/ai_document_orchestrator.py +39 -26
  46. aiecs/tools/docs/ai_document_writer_orchestrator.py +61 -38
  47. aiecs/tools/docs/content_insertion_tool.py +48 -28
  48. aiecs/tools/docs/document_creator_tool.py +47 -29
  49. aiecs/tools/docs/document_layout_tool.py +35 -20
  50. aiecs/tools/docs/document_parser_tool.py +56 -36
  51. aiecs/tools/docs/document_writer_tool.py +115 -62
  52. aiecs/tools/schema_generator.py +56 -56
  53. aiecs/tools/statistics/__init__.py +82 -0
  54. aiecs/tools/statistics/ai_data_analysis_orchestrator.py +581 -0
  55. aiecs/tools/statistics/ai_insight_generator_tool.py +473 -0
  56. aiecs/tools/statistics/ai_report_orchestrator_tool.py +629 -0
  57. aiecs/tools/statistics/data_loader_tool.py +518 -0
  58. aiecs/tools/statistics/data_profiler_tool.py +599 -0
  59. aiecs/tools/statistics/data_transformer_tool.py +531 -0
  60. aiecs/tools/statistics/data_visualizer_tool.py +460 -0
  61. aiecs/tools/statistics/model_trainer_tool.py +470 -0
  62. aiecs/tools/statistics/statistical_analyzer_tool.py +426 -0
  63. aiecs/tools/task_tools/chart_tool.py +2 -1
  64. aiecs/tools/task_tools/image_tool.py +43 -43
  65. aiecs/tools/task_tools/office_tool.py +39 -36
  66. aiecs/tools/task_tools/pandas_tool.py +37 -33
  67. aiecs/tools/task_tools/report_tool.py +67 -56
  68. aiecs/tools/task_tools/research_tool.py +32 -31
  69. aiecs/tools/task_tools/scraper_tool.py +53 -46
  70. aiecs/tools/task_tools/search_tool.py +1123 -0
  71. aiecs/tools/task_tools/stats_tool.py +20 -15
  72. aiecs/tools/tool_executor/__init__.py +2 -2
  73. aiecs/tools/tool_executor/tool_executor.py +3 -3
  74. {aiecs-1.1.0.dist-info → aiecs-1.2.1.dist-info}/METADATA +5 -1
  75. aiecs-1.2.1.dist-info/RECORD +144 -0
  76. {aiecs-1.1.0.dist-info → aiecs-1.2.1.dist-info}/entry_points.txt +1 -0
  77. aiecs/tools/task_tools/search_api.py +0 -7
  78. aiecs-1.1.0.dist-info/RECORD +0 -114
  79. {aiecs-1.1.0.dist-info → aiecs-1.2.1.dist-info}/WHEEL +0 -0
  80. {aiecs-1.1.0.dist-info → aiecs-1.2.1.dist-info}/licenses/LICENSE +0 -0
  81. {aiecs-1.1.0.dist-info → aiecs-1.2.1.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  """
2
- 自动 Schema 生成工具
2
+ Automatic Schema Generation Tool
3
3
 
4
- 从方法签名和类型注解自动生成 Pydantic Schema
4
+ Automatically generate Pydantic Schema from method signatures and type annotations
5
5
  """
6
6
 
7
7
  import inspect
@@ -14,14 +14,14 @@ logger = logging.getLogger(__name__)
14
14
 
15
15
  def _normalize_type(param_type: Type) -> Type:
16
16
  """
17
- 标准化类型,处理不支持的类型
17
+ Normalize types, handle unsupported types
18
18
 
19
- pandas.DataFrame 等复杂类型映射为 Any
19
+ Map complex types like pandas.DataFrame to Any
20
20
  """
21
- # 获取类型名称
21
+ # Get type name
22
22
  type_name = getattr(param_type, '__name__', str(param_type))
23
23
 
24
- # 检查是否是 pandas 类型
24
+ # Check if it's a pandas type
25
25
  if 'DataFrame' in type_name or 'Series' in type_name:
26
26
  return Any
27
27
 
@@ -30,9 +30,9 @@ def _normalize_type(param_type: Type) -> Type:
30
30
 
31
31
  def _extract_param_description_from_docstring(docstring: str, param_name: str) -> Optional[str]:
32
32
  """
33
- 从文档字符串中提取参数描述
33
+ Extract parameter description from docstring
34
34
 
35
- 支持格式:
35
+ Supported formats:
36
36
  - Google style: Args: param_name: description
37
37
  - NumPy style: Parameters: param_name : type description
38
38
  """
@@ -47,26 +47,26 @@ def _extract_param_description_from_docstring(docstring: str, param_name: str) -
47
47
  for line in lines:
48
48
  stripped = line.strip()
49
49
 
50
- # 检测 Args/Parameters 部分
50
+ # Detect Args/Parameters section
51
51
  if stripped in ['Args:', 'Arguments:', 'Parameters:']:
52
52
  in_args_section = True
53
53
  continue
54
54
 
55
- # 检测结束
55
+ # Detect end
56
56
  if in_args_section and stripped in ['Returns:', 'Raises:', 'Yields:', 'Examples:', 'Note:', 'Notes:']:
57
57
  break
58
58
 
59
59
  if in_args_section:
60
- # Google style: param_name: description param_name (type): description
60
+ # Google style: param_name: description or param_name (type): description
61
61
  if ':' in stripped and not stripped.startswith(' '):
62
- # 保存之前的参数
62
+ # Save previous parameter
63
63
  if current_param == param_name and description_lines:
64
64
  return ' '.join(description_lines).strip()
65
65
 
66
- # 解析新参数
66
+ # Parse new parameter
67
67
  parts = stripped.split(':', 1)
68
68
  if len(parts) == 2:
69
- # 移除可能的类型注解 (type)
69
+ # Remove possible type annotation (type)
70
70
  param_part = parts[0].strip()
71
71
  if '(' in param_part:
72
72
  param_part = param_part.split('(')[0].strip()
@@ -74,10 +74,10 @@ def _extract_param_description_from_docstring(docstring: str, param_name: str) -
74
74
  current_param = param_part
75
75
  description_lines = [parts[1].strip()]
76
76
  elif current_param and stripped:
77
- # 继续描述
77
+ # Continue description
78
78
  description_lines.append(stripped)
79
79
 
80
- # 检查最后一个参数
80
+ # Check last parameter
81
81
  if current_param == param_name and description_lines:
82
82
  return ' '.join(description_lines).strip()
83
83
 
@@ -90,59 +90,59 @@ def generate_schema_from_method(
90
90
  base_class: Type[BaseModel] = BaseModel
91
91
  ) -> Optional[Type[BaseModel]]:
92
92
  """
93
- 从方法签名自动生成 Pydantic Schema
93
+ Automatically generate Pydantic Schema from method signature
94
94
 
95
95
  Args:
96
- method: 要生成 Schema 的方法
97
- method_name: 方法名称
98
- base_class: Schema 基类
96
+ method: Method to generate Schema for
97
+ method_name: Method name
98
+ base_class: Schema base class
99
99
 
100
100
  Returns:
101
- 生成的 Pydantic Schema 类,如果无法生成则返回 None
101
+ Generated Pydantic Schema class, returns None if unable to generate
102
102
  """
103
103
  try:
104
- # 获取方法签名
104
+ # Get method signature
105
105
  sig = inspect.signature(method)
106
106
 
107
- # 获取类型注解
107
+ # Get type annotations
108
108
  try:
109
109
  type_hints = get_type_hints(method)
110
110
  except Exception as e:
111
111
  logger.debug(f"Failed to get type hints for {method_name}: {e}")
112
112
  type_hints = {}
113
113
 
114
- # 获取文档字符串
114
+ # Get docstring
115
115
  docstring = inspect.getdoc(method) or f"Execute {method_name} operation"
116
116
 
117
- # 提取简短描述(第一行)
117
+ # Extract short description (first line)
118
118
  first_line = docstring.split('\n')[0].strip()
119
119
  schema_description = first_line if first_line else f"Execute {method_name} operation"
120
120
 
121
- # 构建字段定义
121
+ # Build field definitions
122
122
  field_definitions = {}
123
123
 
124
124
  for param_name, param in sig.parameters.items():
125
- # 跳过 self 参数
125
+ # Skip self parameter
126
126
  if param_name == 'self':
127
127
  continue
128
128
 
129
- # 获取参数类型并标准化
129
+ # Get parameter type and normalize
130
130
  param_type = type_hints.get(param_name, Any)
131
131
  param_type = _normalize_type(param_type)
132
132
 
133
- # 获取默认值
133
+ # Get default value
134
134
  has_default = param.default != inspect.Parameter.empty
135
135
  default_value = param.default if has_default else ...
136
136
 
137
- # 从文档字符串提取参数描述
137
+ # Extract parameter description from docstring
138
138
  field_description = _extract_param_description_from_docstring(docstring, param_name)
139
139
  if not field_description:
140
140
  field_description = f"Parameter {param_name}"
141
141
 
142
- # 创建 Field
142
+ # Create Field
143
143
  if has_default:
144
144
  if default_value is None:
145
- # Optional 参数
145
+ # Optional parameter
146
146
  field_definitions[param_name] = (
147
147
  param_type,
148
148
  Field(default=None, description=field_description)
@@ -153,21 +153,21 @@ def generate_schema_from_method(
153
153
  Field(default=default_value, description=field_description)
154
154
  )
155
155
  else:
156
- # 必需参数
156
+ # Required parameter
157
157
  field_definitions[param_name] = (
158
158
  param_type,
159
159
  Field(description=field_description)
160
160
  )
161
161
 
162
- # 如果没有参数(除了 self),返回 None
162
+ # If no parameters (except self), return None
163
163
  if not field_definitions:
164
164
  logger.debug(f"No parameters found for {method_name}, skipping schema generation")
165
165
  return None
166
166
 
167
- # 生成 Schema 类名
167
+ # Generate Schema class name
168
168
  schema_name = f"{method_name.title().replace('_', '')}Schema"
169
169
 
170
- # 创建 Schema 类,允许任意类型
170
+ # Create Schema class, allow arbitrary types
171
171
  schema_class = create_model(
172
172
  schema_name,
173
173
  __base__=base_class,
@@ -186,40 +186,40 @@ def generate_schema_from_method(
186
186
 
187
187
  def generate_schemas_for_tool(tool_class: Type) -> Dict[str, Type[BaseModel]]:
188
188
  """
189
- 为工具类的所有方法生成 Schema
189
+ Generate Schema for all methods of a tool class
190
190
 
191
191
  Args:
192
- tool_class: 工具类
192
+ tool_class: Tool class
193
193
 
194
194
  Returns:
195
- 方法名到 Schema 类的映射
195
+ Mapping from method names to Schema classes
196
196
  """
197
197
  schemas = {}
198
198
 
199
199
  for method_name in dir(tool_class):
200
- # 跳过私有方法和特殊方法
200
+ # Skip private methods and special methods
201
201
  if method_name.startswith('_'):
202
202
  continue
203
203
 
204
- # 跳过基类方法
204
+ # Skip base class methods
205
205
  if method_name in ['run', 'run_async', 'run_batch']:
206
206
  continue
207
207
 
208
208
  method = getattr(tool_class, method_name)
209
209
 
210
- # 跳过非方法属性
210
+ # Skip non-method attributes
211
211
  if not callable(method):
212
212
  continue
213
213
 
214
- # 跳过类(如 Config, Schema 等)
214
+ # Skip classes (like Config, Schema, etc.)
215
215
  if isinstance(method, type):
216
216
  continue
217
217
 
218
- # 生成 Schema
218
+ # Generate Schema
219
219
  schema = generate_schema_from_method(method, method_name)
220
220
 
221
221
  if schema:
222
- # 标准化方法名(移除下划线,转小写)
222
+ # Normalize method name (remove underscores, convert to lowercase)
223
223
  normalized_name = method_name.replace('_', '').lower()
224
224
  schemas[normalized_name] = schema
225
225
  logger.info(f"Generated schema for {method_name}")
@@ -230,36 +230,36 @@ def generate_schemas_for_tool(tool_class: Type) -> Dict[str, Type[BaseModel]]:
230
230
 
231
231
 
232
232
 
233
- # 使用示例
233
+ # Usage example
234
234
  if __name__ == '__main__':
235
235
  import sys
236
236
  sys.path.insert(0, '/home/coder1/python-middleware-dev')
237
237
 
238
238
  from aiecs.tools import discover_tools, TOOL_CLASSES
239
239
 
240
- # 配置日志
240
+ # Configure logging
241
241
  logging.basicConfig(level=logging.INFO)
242
242
 
243
- # 发现工具
243
+ # Discover tools
244
244
  discover_tools()
245
245
 
246
- # PandasTool 生成 Schema
247
- print(" PandasTool 生成 Schema:")
246
+ # Generate Schema for PandasTool
247
+ print("Generating Schema for PandasTool:")
248
248
  print("=" * 80)
249
249
 
250
250
  pandas_tool = TOOL_CLASSES['pandas']
251
251
  schemas = generate_schemas_for_tool(pandas_tool)
252
252
 
253
- print(f"\n生成了 {len(schemas)} 个 Schema:\n")
253
+ print(f"\nGenerated {len(schemas)} Schemas:\n")
254
254
 
255
- # 显示前3个示例
255
+ # Show first 3 examples
256
256
  for method_name, schema in list(schemas.items())[:3]:
257
257
  print(f"{schema.__name__}:")
258
- print(f" 描述: {schema.__doc__}")
259
- print(f" 字段:")
258
+ print(f" Description: {schema.__doc__}")
259
+ print(f" Fields:")
260
260
  for field_name, field_info in schema.model_fields.items():
261
- required = "必需" if field_info.is_required() else "可选"
262
- default = f" (默认: {field_info.default})" if not field_info.is_required() and field_info.default is not None else ""
261
+ required = "Required" if field_info.is_required() else "Optional"
262
+ default = f" (default: {field_info.default})" if not field_info.is_required() and field_info.default is not None else ""
263
263
  print(f" - {field_name}: {field_info.description} [{required}]{default}")
264
264
  print()
265
265
 
@@ -0,0 +1,82 @@
1
+ """
2
+ Statistics and Data Analysis Tools Module
3
+
4
+ This module contains specialized tools for data analysis and statistical operations:
5
+ - data_loader: Universal data loading from multiple file formats
6
+ - data_profiler: Comprehensive data profiling and quality assessment
7
+ - data_transformer: Data cleaning, transformation, and feature engineering
8
+ - data_visualizer: Smart data visualization and chart generation
9
+ - statistical_analyzer: Advanced statistical analysis and hypothesis testing
10
+ - model_trainer: AutoML and machine learning model training
11
+ - ai_data_analysis_orchestrator: AI-powered end-to-end analysis orchestration
12
+ - ai_insight_generator: AI-driven insight discovery and pattern detection
13
+ - ai_report_orchestrator: AI-powered comprehensive report generation
14
+ """
15
+
16
+ # Lazy import strategy to avoid heavy dependencies at import time
17
+ import os
18
+ import logging
19
+
20
+ logger = logging.getLogger(__name__)
21
+
22
+ # Define available tools for lazy loading
23
+ _AVAILABLE_STATISTICS_TOOLS = [
24
+ 'data_loader_tool',
25
+ 'data_profiler_tool',
26
+ 'data_transformer_tool',
27
+ 'data_visualizer_tool',
28
+ 'statistical_analyzer_tool',
29
+ 'model_trainer_tool',
30
+ 'ai_data_analysis_orchestrator',
31
+ 'ai_insight_generator_tool',
32
+ 'ai_report_orchestrator_tool'
33
+ ]
34
+
35
+ # Track which tools have been loaded
36
+ _LOADED_STATISTICS_TOOLS = set()
37
+
38
+ def _lazy_load_statistics_tool(tool_name: str):
39
+ """Lazy load a specific statistics tool module"""
40
+ if tool_name in _LOADED_STATISTICS_TOOLS:
41
+ return
42
+
43
+ try:
44
+ if tool_name == 'data_loader_tool':
45
+ from . import data_loader_tool
46
+ elif tool_name == 'data_profiler_tool':
47
+ from . import data_profiler_tool
48
+ elif tool_name == 'data_transformer_tool':
49
+ from . import data_transformer_tool
50
+ elif tool_name == 'data_visualizer_tool':
51
+ from . import data_visualizer_tool
52
+ elif tool_name == 'statistical_analyzer_tool':
53
+ from . import statistical_analyzer_tool
54
+ elif tool_name == 'model_trainer_tool':
55
+ from . import model_trainer_tool
56
+ elif tool_name == 'ai_data_analysis_orchestrator':
57
+ from . import ai_data_analysis_orchestrator
58
+ elif tool_name == 'ai_insight_generator_tool':
59
+ from . import ai_insight_generator_tool
60
+ elif tool_name == 'ai_report_orchestrator_tool':
61
+ from . import ai_report_orchestrator_tool
62
+
63
+ _LOADED_STATISTICS_TOOLS.add(tool_name)
64
+ logger.info(f"Successfully loaded statistics tool: {tool_name}")
65
+
66
+ except Exception as e:
67
+ logger.warning(f"Failed to load statistics tool {tool_name}: {e}")
68
+
69
+ def load_all_statistics_tools():
70
+ """Load all available statistics tools"""
71
+ for tool_name in _AVAILABLE_STATISTICS_TOOLS:
72
+ _lazy_load_statistics_tool(tool_name)
73
+
74
+ # Auto-load all tools when module is imported
75
+ # This ensures all tools are registered
76
+ load_all_statistics_tools()
77
+
78
+ __all__ = [
79
+ 'load_all_statistics_tools',
80
+ '_lazy_load_statistics_tool'
81
+ ]
82
+