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
massgen/message_templates.py
CHANGED
|
@@ -10,8 +10,22 @@ from typing import Any, Dict, List, Optional
|
|
|
10
10
|
class MessageTemplates:
|
|
11
11
|
"""Message templates implementing the proven MassGen approach."""
|
|
12
12
|
|
|
13
|
-
def __init__(self, **template_overrides):
|
|
14
|
-
"""Initialize with optional template overrides.
|
|
13
|
+
def __init__(self, voting_sensitivity: str = "lenient", answer_novelty_requirement: str = "lenient", **template_overrides):
|
|
14
|
+
"""Initialize with optional template overrides.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
voting_sensitivity: Controls how critical agents are when voting.
|
|
18
|
+
- "lenient": Agents vote YES more easily, fewer new answers (default)
|
|
19
|
+
- "balanced": Agents apply detailed criteria (comprehensive, accurate, complete?)
|
|
20
|
+
- "strict": Agents apply high standards of excellence (all aspects, edge cases, reference-quality)
|
|
21
|
+
answer_novelty_requirement: Controls how different new answers must be.
|
|
22
|
+
- "lenient": No additional checks (default)
|
|
23
|
+
- "balanced": Require meaningful differences
|
|
24
|
+
- "strict": Require substantially different solutions
|
|
25
|
+
**template_overrides: Custom template strings to override defaults
|
|
26
|
+
"""
|
|
27
|
+
self._voting_sensitivity = voting_sensitivity
|
|
28
|
+
self._answer_novelty_requirement = answer_novelty_requirement
|
|
15
29
|
self._template_overrides = template_overrides
|
|
16
30
|
|
|
17
31
|
# =============================================================================
|
|
@@ -57,14 +71,50 @@ class MessageTemplates:
|
|
|
57
71
|
# Make sure you actually call `vote` or `new_answer` (in tool call format).
|
|
58
72
|
#
|
|
59
73
|
# *Note*: The CURRENT TIME is **{time.strftime("%Y-%m-%d %H:%M:%S")}**."""
|
|
74
|
+
# Determine evaluation criteria based on voting sensitivity
|
|
75
|
+
if self._voting_sensitivity == "strict":
|
|
76
|
+
evaluation_section = """Does the best CURRENT ANSWER address the ORIGINAL MESSAGE exceptionally well? Consider:
|
|
77
|
+
- Is it comprehensive, addressing ALL aspects and edge cases?
|
|
78
|
+
- Is it technically accurate and well-reasoned?
|
|
79
|
+
- Does it provide clear explanations and proper justification?
|
|
80
|
+
- Is it complete with no significant gaps or weaknesses?
|
|
81
|
+
- Could it serve as a reference-quality solution?
|
|
82
|
+
|
|
83
|
+
Only use the `vote` tool if the best answer meets high standards of excellence."""
|
|
84
|
+
elif self._voting_sensitivity == "balanced":
|
|
85
|
+
evaluation_section = """Does the best CURRENT ANSWER address the ORIGINAL MESSAGE well? Consider:
|
|
86
|
+
- Is it comprehensive, accurate, and complete?
|
|
87
|
+
- Could it be meaningfully improved, refined, or expanded?
|
|
88
|
+
- Are there weaknesses, gaps, or better approaches?
|
|
89
|
+
|
|
90
|
+
Only use the `vote` tool if the best answer is strong and complete."""
|
|
91
|
+
else:
|
|
92
|
+
# Default to lenient (including explicit "lenient" or any other value)
|
|
93
|
+
evaluation_section = """Does the best CURRENT ANSWER address the ORIGINAL MESSAGE well?
|
|
94
|
+
|
|
95
|
+
If YES, use the `vote` tool to record your vote and skip the `new_answer` tool."""
|
|
96
|
+
|
|
97
|
+
# Add novelty requirement instructions if not lenient
|
|
98
|
+
novelty_section = ""
|
|
99
|
+
if self._answer_novelty_requirement == "balanced":
|
|
100
|
+
novelty_section = """
|
|
101
|
+
IMPORTANT: If you provide a new answer, it must be meaningfully different from existing answers.
|
|
102
|
+
- Don't just rephrase or reword existing solutions
|
|
103
|
+
- Introduce new insights, approaches, or tools
|
|
104
|
+
- Make substantive improvements, not cosmetic changes"""
|
|
105
|
+
elif self._answer_novelty_requirement == "strict":
|
|
106
|
+
novelty_section = """
|
|
107
|
+
CRITICAL: New answers must be SUBSTANTIALLY different from existing answers.
|
|
108
|
+
- Use a fundamentally different approach or methodology
|
|
109
|
+
- Employ different tools or techniques
|
|
110
|
+
- Provide significantly more depth or novel perspectives
|
|
111
|
+
- If you cannot provide a truly novel solution, vote instead"""
|
|
60
112
|
|
|
61
113
|
return f"""You are evaluating answers from multiple agents for final response to a message.
|
|
62
114
|
Different agents may have different builtin tools and capabilities.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
If YES, use the `vote` tool to record your vote and skip the `new_answer` tool.
|
|
115
|
+
{evaluation_section}
|
|
66
116
|
Otherwise, digest existing answers, combine their strengths, and do additional work to address their weaknesses,
|
|
67
|
-
then use the `new_answer` tool to record a better answer to the ORIGINAL MESSAGE.
|
|
117
|
+
then use the `new_answer` tool to record a better answer to the ORIGINAL MESSAGE.{novelty_section}
|
|
68
118
|
Make sure you actually call `vote` or `new_answer` (in tool call format).
|
|
69
119
|
|
|
70
120
|
*Note*: The CURRENT TIME is **{time.strftime("%Y-%m-%d %H:%M:%S")}**."""
|