massgen 0.1.0a3__py3-none-any.whl → 0.1.2__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 massgen might be problematic. Click here for more details.
- massgen/__init__.py +1 -1
- massgen/agent_config.py +17 -0
- massgen/api_params_handler/_api_params_handler_base.py +1 -0
- massgen/api_params_handler/_chat_completions_api_params_handler.py +15 -2
- massgen/api_params_handler/_claude_api_params_handler.py +8 -1
- massgen/api_params_handler/_gemini_api_params_handler.py +73 -0
- massgen/api_params_handler/_response_api_params_handler.py +8 -1
- massgen/backend/base.py +83 -0
- massgen/backend/{base_with_mcp.py → base_with_custom_tool_and_mcp.py} +286 -15
- massgen/backend/capabilities.py +6 -6
- massgen/backend/chat_completions.py +200 -103
- massgen/backend/claude.py +115 -18
- massgen/backend/claude_code.py +378 -14
- massgen/backend/docs/CLAUDE_API_RESEARCH.md +3 -3
- massgen/backend/gemini.py +1333 -1629
- massgen/backend/gemini_mcp_manager.py +545 -0
- massgen/backend/gemini_trackers.py +344 -0
- massgen/backend/gemini_utils.py +43 -0
- massgen/backend/grok.py +39 -6
- massgen/backend/response.py +147 -81
- massgen/cli.py +605 -110
- massgen/config_builder.py +376 -27
- massgen/configs/README.md +123 -80
- massgen/configs/basic/multi/three_agents_default.yaml +3 -3
- massgen/configs/basic/single/single_agent.yaml +1 -1
- massgen/configs/providers/openai/gpt5_nano.yaml +3 -3
- massgen/configs/tools/custom_tools/claude_code_custom_tool_example.yaml +32 -0
- massgen/configs/tools/custom_tools/claude_code_custom_tool_example_no_path.yaml +28 -0
- massgen/configs/tools/custom_tools/claude_code_custom_tool_with_mcp_example.yaml +40 -0
- massgen/configs/tools/custom_tools/claude_code_custom_tool_with_wrong_mcp_example.yaml +38 -0
- massgen/configs/tools/custom_tools/claude_code_wrong_custom_tool_with_mcp_example.yaml +38 -0
- massgen/configs/tools/custom_tools/claude_custom_tool_example.yaml +24 -0
- massgen/configs/tools/custom_tools/claude_custom_tool_example_no_path.yaml +22 -0
- massgen/configs/tools/custom_tools/claude_custom_tool_with_mcp_example.yaml +35 -0
- massgen/configs/tools/custom_tools/claude_custom_tool_with_wrong_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/claude_wrong_custom_tool_with_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/gemini_custom_tool_example.yaml +24 -0
- massgen/configs/tools/custom_tools/gemini_custom_tool_example_no_path.yaml +22 -0
- massgen/configs/tools/custom_tools/gemini_custom_tool_with_mcp_example.yaml +35 -0
- massgen/configs/tools/custom_tools/gemini_custom_tool_with_wrong_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/gemini_wrong_custom_tool_with_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/github_issue_market_analysis.yaml +94 -0
- massgen/configs/tools/custom_tools/gpt5_nano_custom_tool_example.yaml +24 -0
- massgen/configs/tools/custom_tools/gpt5_nano_custom_tool_example_no_path.yaml +22 -0
- massgen/configs/tools/custom_tools/gpt5_nano_custom_tool_with_mcp_example.yaml +35 -0
- massgen/configs/tools/custom_tools/gpt5_nano_custom_tool_with_wrong_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/gpt5_nano_wrong_custom_tool_with_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/gpt_oss_custom_tool_example.yaml +25 -0
- massgen/configs/tools/custom_tools/gpt_oss_custom_tool_example_no_path.yaml +23 -0
- massgen/configs/tools/custom_tools/gpt_oss_custom_tool_with_mcp_example.yaml +34 -0
- massgen/configs/tools/custom_tools/gpt_oss_custom_tool_with_wrong_mcp_example.yaml +34 -0
- massgen/configs/tools/custom_tools/gpt_oss_wrong_custom_tool_with_mcp_example.yaml +34 -0
- massgen/configs/tools/custom_tools/grok3_mini_custom_tool_example.yaml +24 -0
- massgen/configs/tools/custom_tools/grok3_mini_custom_tool_example_no_path.yaml +22 -0
- massgen/configs/tools/custom_tools/grok3_mini_custom_tool_with_mcp_example.yaml +35 -0
- massgen/configs/tools/custom_tools/grok3_mini_custom_tool_with_wrong_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/grok3_mini_wrong_custom_tool_with_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/qwen_api_custom_tool_example.yaml +25 -0
- massgen/configs/tools/custom_tools/qwen_api_custom_tool_example_no_path.yaml +23 -0
- massgen/configs/tools/custom_tools/qwen_api_custom_tool_with_mcp_example.yaml +36 -0
- massgen/configs/tools/custom_tools/qwen_api_custom_tool_with_wrong_mcp_example.yaml +34 -0
- massgen/configs/tools/custom_tools/qwen_api_wrong_custom_tool_with_mcp_example.yaml +34 -0
- massgen/configs/tools/custom_tools/qwen_local_custom_tool_example.yaml +24 -0
- massgen/configs/tools/custom_tools/qwen_local_custom_tool_example_no_path.yaml +22 -0
- massgen/configs/tools/custom_tools/qwen_local_custom_tool_with_mcp_example.yaml +35 -0
- massgen/configs/tools/custom_tools/qwen_local_custom_tool_with_wrong_mcp_example.yaml +33 -0
- massgen/configs/tools/custom_tools/qwen_local_wrong_custom_tool_with_mcp_example.yaml +33 -0
- massgen/configs/tools/filesystem/claude_code_context_sharing.yaml +1 -1
- massgen/configs/tools/planning/five_agents_discord_mcp_planning_mode.yaml +7 -29
- massgen/configs/tools/planning/five_agents_filesystem_mcp_planning_mode.yaml +5 -6
- massgen/configs/tools/planning/five_agents_notion_mcp_planning_mode.yaml +4 -4
- massgen/configs/tools/planning/five_agents_twitter_mcp_planning_mode.yaml +4 -4
- massgen/configs/tools/planning/gpt5_mini_case_study_mcp_planning_mode.yaml +2 -2
- massgen/configs/voting/gemini_gpt_voting_sensitivity.yaml +67 -0
- massgen/formatter/_chat_completions_formatter.py +104 -0
- massgen/formatter/_claude_formatter.py +120 -0
- massgen/formatter/_gemini_formatter.py +448 -0
- massgen/formatter/_response_formatter.py +88 -0
- massgen/frontend/coordination_ui.py +4 -2
- massgen/logger_config.py +35 -3
- massgen/message_templates.py +56 -6
- massgen/orchestrator.py +512 -16
- massgen/stream_chunk/base.py +3 -0
- massgen/tests/custom_tools_example.py +392 -0
- massgen/tests/mcp_test_server.py +17 -7
- massgen/tests/test_config_builder.py +423 -0
- massgen/tests/test_custom_tools.py +401 -0
- massgen/tests/test_intelligent_planning_mode.py +643 -0
- massgen/tests/test_tools.py +127 -0
- massgen/token_manager/token_manager.py +13 -4
- massgen/tool/README.md +935 -0
- massgen/tool/__init__.py +39 -0
- massgen/tool/_async_helpers.py +70 -0
- massgen/tool/_basic/__init__.py +8 -0
- massgen/tool/_basic/_two_num_tool.py +24 -0
- massgen/tool/_code_executors/__init__.py +10 -0
- massgen/tool/_code_executors/_python_executor.py +74 -0
- massgen/tool/_code_executors/_shell_executor.py +61 -0
- massgen/tool/_exceptions.py +39 -0
- massgen/tool/_file_handlers/__init__.py +10 -0
- massgen/tool/_file_handlers/_file_operations.py +218 -0
- massgen/tool/_manager.py +634 -0
- massgen/tool/_registered_tool.py +88 -0
- massgen/tool/_result.py +66 -0
- massgen/tool/_self_evolution/_github_issue_analyzer.py +369 -0
- massgen/tool/docs/builtin_tools.md +681 -0
- massgen/tool/docs/exceptions.md +794 -0
- massgen/tool/docs/execution_results.md +691 -0
- massgen/tool/docs/manager.md +887 -0
- massgen/tool/docs/workflow_toolkits.md +529 -0
- massgen/tool/workflow_toolkits/__init__.py +57 -0
- massgen/tool/workflow_toolkits/base.py +55 -0
- massgen/tool/workflow_toolkits/new_answer.py +126 -0
- massgen/tool/workflow_toolkits/vote.py +167 -0
- {massgen-0.1.0a3.dist-info → massgen-0.1.2.dist-info}/METADATA +87 -129
- {massgen-0.1.0a3.dist-info → massgen-0.1.2.dist-info}/RECORD +120 -44
- {massgen-0.1.0a3.dist-info → massgen-0.1.2.dist-info}/WHEEL +0 -0
- {massgen-0.1.0a3.dist-info → massgen-0.1.2.dist-info}/entry_points.txt +0 -0
- {massgen-0.1.0a3.dist-info → massgen-0.1.2.dist-info}/licenses/LICENSE +0 -0
- {massgen-0.1.0a3.dist-info → massgen-0.1.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""Test script for MassGen tool implementation."""
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
|
|
7
|
+
from massgen.tool._code_executors import run_python_script
|
|
8
|
+
from massgen.tool._file_handlers import read_file_content
|
|
9
|
+
from massgen.tool._manager import ToolManager
|
|
10
|
+
from massgen.tool._result import ExecutionResult, TextContent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def sample_math_tool(x: int, y: int) -> ExecutionResult:
|
|
14
|
+
"""Add two numbers together.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
x: First number
|
|
18
|
+
y: Second number
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
Sum of the two numbers
|
|
22
|
+
"""
|
|
23
|
+
result = x + y
|
|
24
|
+
return ExecutionResult(
|
|
25
|
+
output_blocks=[
|
|
26
|
+
TextContent(data=f"The sum of {x} and {y} is {result}"),
|
|
27
|
+
],
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
async def test_tool_manager():
|
|
32
|
+
"""Test the tool manager functionality."""
|
|
33
|
+
print("Testing MassGen Tool Manager\n" + "=" * 40)
|
|
34
|
+
|
|
35
|
+
# Create manager
|
|
36
|
+
manager = ToolManager()
|
|
37
|
+
print("✓ Tool manager created")
|
|
38
|
+
|
|
39
|
+
# Create categories
|
|
40
|
+
manager.setup_category(
|
|
41
|
+
category_name="math",
|
|
42
|
+
description="Mathematical operations",
|
|
43
|
+
enabled=True,
|
|
44
|
+
usage_hints="Use these tools for calculations",
|
|
45
|
+
)
|
|
46
|
+
print("✓ Created 'math' category")
|
|
47
|
+
|
|
48
|
+
manager.setup_category(
|
|
49
|
+
category_name="file_ops",
|
|
50
|
+
description="File operations",
|
|
51
|
+
enabled=False,
|
|
52
|
+
)
|
|
53
|
+
print("✓ Created 'file_ops' category")
|
|
54
|
+
|
|
55
|
+
# Register tools
|
|
56
|
+
manager.add_tool_function(
|
|
57
|
+
func=sample_math_tool,
|
|
58
|
+
category="math",
|
|
59
|
+
description="Adds two numbers",
|
|
60
|
+
)
|
|
61
|
+
print("✓ Registered sample_math_tool")
|
|
62
|
+
|
|
63
|
+
manager.add_tool_function(
|
|
64
|
+
func=run_python_script,
|
|
65
|
+
category="default",
|
|
66
|
+
description="Execute Python code",
|
|
67
|
+
)
|
|
68
|
+
print("✓ Registered run_python_script")
|
|
69
|
+
|
|
70
|
+
manager.add_tool_function(
|
|
71
|
+
func=read_file_content,
|
|
72
|
+
category="file_ops",
|
|
73
|
+
description="Read file contents",
|
|
74
|
+
)
|
|
75
|
+
print("✓ Registered read_file_content")
|
|
76
|
+
|
|
77
|
+
# Get schemas
|
|
78
|
+
schemas = manager.fetch_tool_schemas()
|
|
79
|
+
print(f"\n✓ Active tool schemas: {len(schemas)} tools")
|
|
80
|
+
for schema in schemas:
|
|
81
|
+
print(f" - {schema['function']['name']}: {schema['function'].get('description', 'No description')}")
|
|
82
|
+
|
|
83
|
+
# Test tool execution
|
|
84
|
+
print("\nTesting tool execution:")
|
|
85
|
+
|
|
86
|
+
# Test math tool
|
|
87
|
+
tool_request = {
|
|
88
|
+
"name": "sample_math_tool",
|
|
89
|
+
"input": {"x": 5, "y": 3},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async for result in manager.execute_tool(tool_request):
|
|
93
|
+
print(f" Math result: {result.output_blocks[0].data}")
|
|
94
|
+
|
|
95
|
+
# Test Python execution
|
|
96
|
+
python_request = {
|
|
97
|
+
"name": "run_python_script",
|
|
98
|
+
"input": {
|
|
99
|
+
"source_code": "print('Hello from MassGen!')\nprint(2 + 2)",
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async for result in manager.execute_tool(python_request):
|
|
104
|
+
output = result.output_blocks[0].data
|
|
105
|
+
if "<stdout>" in output:
|
|
106
|
+
stdout_start = output.find("<stdout>") + 8
|
|
107
|
+
stdout_end = output.find("</stdout>")
|
|
108
|
+
stdout = output[stdout_start:stdout_end]
|
|
109
|
+
print(f" Python output: {stdout.strip()}")
|
|
110
|
+
|
|
111
|
+
# Test enabling file_ops category
|
|
112
|
+
print("\nEnabling file_ops category...")
|
|
113
|
+
manager.modify_categories(["file_ops"], enabled=True)
|
|
114
|
+
schemas_after = manager.fetch_tool_schemas()
|
|
115
|
+
print(f"✓ Active tools after enabling: {len(schemas_after)}")
|
|
116
|
+
|
|
117
|
+
# Get category hints
|
|
118
|
+
hints = manager.fetch_category_hints()
|
|
119
|
+
if hints:
|
|
120
|
+
print(f"\nCategory hints:\n{hints}")
|
|
121
|
+
|
|
122
|
+
print("\n" + "=" * 40)
|
|
123
|
+
print("All tests completed successfully! ✓")
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
if __name__ == "__main__":
|
|
127
|
+
asyncio.run(test_tool_manager())
|
|
@@ -59,10 +59,19 @@ class TokenCostCalculator:
|
|
|
59
59
|
"o3-mini": ModelPricing(0.0011, 0.0044, 200000, 100000),
|
|
60
60
|
},
|
|
61
61
|
"Anthropic": {
|
|
62
|
-
|
|
63
|
-
"claude-
|
|
64
|
-
"claude-
|
|
65
|
-
|
|
62
|
+
# Claude 4.5 models (October 2024+)
|
|
63
|
+
"claude-haiku-4-5": ModelPricing(0.001, 0.005, 200000, 65536), # $1/MTok input, $5/MTok output, 64K max output
|
|
64
|
+
"claude-sonnet-4-5": ModelPricing(0.003, 0.015, 200000, 65536), # $3/MTok input, $15/MTok output, 64K max output
|
|
65
|
+
# Claude 4 models
|
|
66
|
+
"claude-opus-4.1": ModelPricing(0.015, 0.075, 200000, 32768), # $15/MTok input, $75/MTok output, 32K max output
|
|
67
|
+
"claude-opus-4": ModelPricing(0.015, 0.075, 200000, 32768), # $15/MTok input, $75/MTok output, 32K max output
|
|
68
|
+
"claude-sonnet-4": ModelPricing(0.003, 0.015, 200000, 8192), # $3/MTok input, $15/MTok output
|
|
69
|
+
# Claude 3.5 models
|
|
70
|
+
"claude-3-5-sonnet": ModelPricing(0.003, 0.015, 200000, 8192), # $3/MTok input, $15/MTok output
|
|
71
|
+
"claude-3-5-haiku": ModelPricing(0.0008, 0.004, 200000, 8192), # $0.80/MTok input, $4/MTok output
|
|
72
|
+
# Claude 3 models (deprecated)
|
|
73
|
+
"claude-3-opus": ModelPricing(0.015, 0.075, 200000, 4096), # Deprecated
|
|
74
|
+
"claude-3-sonnet": ModelPricing(0.003, 0.015, 200000, 4096), # Deprecated
|
|
66
75
|
"claude-3-haiku": ModelPricing(0.00025, 0.00125, 200000, 4096),
|
|
67
76
|
},
|
|
68
77
|
"Google": {
|