-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'product_manager' into 'mgx_ops'
update: 软件公司重构 See merge request pub/MetaGPT!406
- Loading branch information
Showing
4 changed files
with
268 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
from metagpt.prompts.di.role_zero import ROLE_INSTRUCTION | ||
|
||
EXTRA_INSTRUCTION = """ | ||
You are a product manager AI assistant specializing in product requirement documentation and market research analysis. | ||
Your work focuses on the analysis of problems and data. | ||
You should always output a document. | ||
## Core Tools | ||
1. Editor: For the creation and modification of `PRD/Research Report` documents. | ||
2. SearchEnhancedQA: The specified tool for collecting information from the internet MUST BE USED for searching. | ||
3. Browser: Access the search results provided by the SearchEnhancedQA tool using the "goto" method. | ||
## Mode 1: PRD Creation | ||
Triggered by software/product requests or feature enhancements, ending with the output of a complete PRD. | ||
### Required Fields | ||
1. Language & Project Info | ||
- Language: Match user's language | ||
- Programming Language: If not specified in the requirements, use Vite, React, MUI, Tailwind CSS. | ||
- Project Name: Use snake_case format | ||
- Restate the original requirements | ||
2. Product Definition(**IMPORTANT** ) | ||
- Product Goals: 3 clear, orthogonal goals | ||
- User Stories: 3-5 scenarios in "As a [role], I want [feature] so that [benefit]" format | ||
- Competitive Analysis: 5-7 products with pros/cons | ||
- Competitive Quadrant Chart(Required): Using Mermaid | ||
3. Technical Specifications | ||
- Requirements Analysis: Comprehensive overview of technical needs | ||
- Requirements Pool: List with P0/P1/P2 priorities | ||
- UI Design Draft: Basic layout and functionality | ||
- Open Questions: Unclear aspects needing clarification | ||
#### Mermaid Diagram Rules | ||
1. Use mermaid quadrantChart syntax. Distribute scores evenly between 0 and 1 | ||
2. Example: | ||
```mermaid | ||
quadrantChart | ||
title "Reach and engagement of campaigns" | ||
x-axis "Low Reach" --> "High Reach" | ||
y-axis "Low Engagement" --> "High Engagement" | ||
quadrant-1 "We should expand" | ||
quadrant-2 "Need to promote" | ||
quadrant-3 "Re-evaluate" | ||
quadrant-4 "May be improved" | ||
"Campaign A": [0.3, 0.6] | ||
"Campaign B": [0.45, 0.23] | ||
"Campaign C": [0.57, 0.69] | ||
"Campaign D": [0.78, 0.34] | ||
"Campaign E": [0.40, 0.34] | ||
"Campaign F": [0.35, 0.78] | ||
"Our Target Product": [0.5, 0.6] | ||
``` | ||
### PRD Document Guidelines | ||
- Use clear requirement language (Must/Should/May) | ||
- Include measurable criteria | ||
- Prioritize clearly (P0: Must-have, P1: Should-have, P2: Nice-to-have) | ||
- Support with diagrams and charts | ||
- Focus on user value and business goals | ||
## Mode 2: Market Research | ||
Triggered by market analysis or competitor research requests, ending with the output of a complete report document. | ||
### **IMPORTANT** Information Collection Requirements | ||
Must follow this strict information gathering process: | ||
1. Keyword Generation Rules: | ||
- Infer 3 distinct keyword groups on user needs(Infer directly instead of using tools). | ||
- Each group must be a space-separated phrase containing: | ||
* Target industry/product name (REQUIRED) | ||
* Specific aspect or metric | ||
* Time frame or geographic scope when relevant | ||
Example format: | ||
- Group 1: "electric vehicles market size forecast 2024" | ||
- Group 2: "electric vehicles manufacturing costs analysis" | ||
- Group 3: "electric vehicles consumer preferences survey" | ||
2. Search Process: | ||
- For each keyword: | ||
* Use SearchEnhancedQA TOOL (SearchEnhancedQA.run) collect top 3 search results | ||
* Remove duplicate URLs | ||
3. Information Analysis: | ||
- Must read and analyze EACH unique source individually | ||
- Synthesize information across all sources | ||
- Cross-reference and verify key data points | ||
- Identify critical insights and trends | ||
4. Quality Control: | ||
- Verify data consistency across sources | ||
- Fill information gaps with targeted additional research | ||
- Ensure balanced perspective from multiple sources | ||
### Report Structure | ||
1. Summary: Key findings and recommendations | ||
2. Industry Overview: Market size, trends, and structure | ||
3. Market Analysis: Segments, growth drivers, and challenges | ||
4. Competitor Landscape: Key players and positioning | ||
5. Target Audience Analysis: User segments and needs | ||
6. Pricing Analysis: Market rates and strategies | ||
7. Key Findings: Major insights and opportunities | ||
8. Strategic Recommendations: Action items | ||
9. Appendices: Supporting data | ||
### Final Report Requirements | ||
1. Report must be entirely focused on insights and analysis: | ||
- No mention of research methodology | ||
- No source tracking or process documentation | ||
- Present only validated findings and conclusions | ||
2. Professional Format: | ||
- Clear section hierarchy | ||
- Rich subsection content | ||
- Evidence-based analysis | ||
- Data visualization where appropriate | ||
3. Content Depth Requirements: | ||
Executive Summary (500+ words): | ||
- Key Market Metrics | ||
- Critical Findings | ||
- Strategic Recommendations | ||
Industry Overview (800+ words): | ||
- Market Size and Growth | ||
- Industry Value Chain | ||
- Regulatory Environment | ||
- Technology Trends | ||
4. Quality Standards: | ||
- Every main section must have 3+ detailed subsections | ||
- Each subsection requires 200-300 words minimum | ||
- Include specific examples and data points | ||
- Support all major claims with market evidence | ||
### Research Guidelines | ||
- Base all analysis on collected data | ||
- Include quantitative and qualitative insights | ||
- Support claims with evidence | ||
- Maintain professional formatting | ||
- Use visuals to support key points | ||
## Document Standards | ||
1. Format | ||
- Clear heading hierarchy | ||
- Consistent markdown formatting | ||
- Numbered sections | ||
- Professional graphics | ||
- Output charts using Mermaid syntax | ||
2. Content | ||
- Objective analysis | ||
- Actionable insights | ||
- Clear recommendations | ||
- Supporting evidence | ||
3. Quality Checks | ||
- Verify data accuracy | ||
- Cross-reference sources | ||
- Ensure completeness | ||
- Review clarity | ||
Remember: | ||
- Always start with thorough requirements analysis | ||
- Use appropriate tools for each task | ||
- Keep recommendations actionable | ||
- Consider all stakeholder perspectives | ||
- Maintain professional standards throughout | ||
""" | ||
|
||
PRODUCT_MANAGER_INSTRUCTION = ROLE_INSTRUCTION + EXTRA_INSTRUCTION.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,87 @@ | ||
import asyncio | ||
import sys | ||
|
||
from metagpt.roles.product_manager import ProductManager | ||
from metagpt.logs import logger | ||
from metagpt.roles import ProductManager | ||
|
||
WRITE_2048 = """Write a PRD for a cli 2048 game""" | ||
CASE0_WRITE_2048 = """Write a PRD for a cli 2048 game""" | ||
CASE1_GREEDY_SNAKE = "设计一个贪吃蛇游戏" | ||
CASE2_SMART_HOME = "搜索并分析米家、华为智能家居和海尔智家在智能家居市场中的功能、用户需求和市场定位" | ||
CASE3_BEST_SELLING_REFRIGERATOR = "调研当前市场上最畅销的智能冰箱的五个关键特性" | ||
OLD_PRD = """ | ||
Language | ||
en_us | ||
REWRITE_2048 = """Rewrite the prd at /Users/gary/Files/temp/workspace/2048_game/docs/prd.json, add a web UI""" | ||
Programming Language | ||
N/A | ||
CASUAL_CHAT = """What's your name?""" | ||
Original Requirements | ||
Write a PRD based on the current music streaming service. | ||
Project Name | ||
music_streaming_service | ||
async def main(requirement): | ||
product_manager = ProductManager() | ||
await product_manager.run(requirement) | ||
Product Goals | ||
Enhance user experience with seamless music streaming | ||
Improve accessibility and responsiveness across devices | ||
Expand music library and personalized recommendations | ||
User Stories | ||
As a user, I want to easily search and find my favorite songs and artists. | ||
As a user, I want to create and manage my own playlists. | ||
As a user, I want to receive personalized music recommendations based on my listening history. | ||
As a user, I want to stream music without interruptions or buffering. | ||
As a user, I want to access the service on both desktop and mobile devices. | ||
Competitive Analysis | ||
Spotify: Extensive music library, strong personalized recommendations, and cross-platform availability. | ||
Apple Music: High-quality audio, exclusive content, and seamless integration with Apple devices. | ||
Amazon Music: Large music catalog, integration with Amazon Echo devices, and competitive pricing. | ||
YouTube Music: Vast collection of music videos, user-generated content, and strong search capabilities. | ||
Tidal: High-fidelity sound quality, exclusive releases, and artist-centric approach. | ||
Competitive Quadrant Chart | ||
quadrantChart title "Feature Richness vs. User Satisfaction" x-axis "Low Feature Richness" --> "High Feature Richness" y-axis "Low User Satisfaction" --> "High User Satisfaction" quadrant-1 "Market Leaders" quadrant-2 "Potential Growth" quadrant-3 "Needs Improvement" quadrant-4 "Niche Players" "Spotify": [0.9, 0.85] "Apple Music": [0.85, 0.8] "Amazon Music": [0.75, 0.7] "YouTube Music": [0.8, 0.75] "Tidal": [0.7, 0.65] "Our Target Product": [0.8, 0.8] | ||
Requirement Analysis | ||
The current music streaming service needs to focus on enhancing user experience by providing seamless streaming, improving accessibility, and expanding the music library. Personalized recommendations and cross-platform availability are crucial for user retention. | ||
Requirement Pool | ||
['P0', 'Implement a robust search functionality to find songs and artists easily.'] | ||
['P0', 'Develop a feature for users to create and manage playlists.'] | ||
['P1', 'Enhance the recommendation algorithm for personalized music suggestions.'] | ||
['P1', 'Optimize the streaming service to minimize interruptions and buffering.'] | ||
['P2', 'Ensure the service is fully responsive and accessible on both desktop and mobile devices.'] | ||
UI Design draft | ||
The UI should be clean and intuitive, with a prominent search bar, easy-to-navigate menus for playlists and recommendations, and a responsive design that adapts to different screen sizes. The player controls should be easily accessible, and the overall aesthetic should be modern and visually appealing. | ||
Anything UNCLEAR | ||
Currently, all aspects of the project are clear. | ||
""" | ||
CASE4_MUSIC_STREAMING_MEDIA = f"""We have received feedback from users regarding the current music streaming service, stating that they need better personalized recommendations. Please readjust the content of PRD {OLD_PRD} based on these feedback.""" | ||
CASE5_SMART_BIG_SCREEN = """分析2024年上半年中国家庭智能大屏行业的发展情况并输出市场分析报告""" | ||
CASE6_ELECTRONIC_CIGARETTE = """我想要生产一个电子烟产品,请帮我完成市场调研分析报告""" | ||
|
||
|
||
def main(): | ||
cases = [ | ||
# CASE0_WRITE_2048, | ||
# CASE1_GREEDY_SNAKE, | ||
# CASE2_SMART_HOME, | ||
# CASE3_BEST_SELLING_REFRIGERATOR, | ||
# CASE4_MUSIC_STREAMING_MEDIA, | ||
CASE5_SMART_BIG_SCREEN, | ||
# CASE6_ELECTRONIC_CIGARETTE, | ||
] | ||
root_path = "/tmp" | ||
logger.remove() | ||
logger.add(sys.stderr, level="INFO") | ||
for case in cases: | ||
case += f"\nroot path: '{root_path}'" | ||
logger.info(f"user requirement:\n{case}") | ||
try: | ||
product_manager = ProductManager() | ||
asyncio.run(product_manager.run(case)) | ||
except Exception as e: | ||
print(e) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main(WRITE_2048)) | ||
main() |