test / v0_generator.py
hsynhbk's picture
Upload 18 files
e0e92df verified
Raw History Blame Contribute Delete
9.8 kB
"""
V0 Document Generator for Strike Capital.
Generates structured diligence documents from extracted Harmonic data.
"""
import json
from openai import OpenAI
from config import OPENAI_API_KEY
# Initialize OpenAI client
client = OpenAI(api_key=OPENAI_API_KEY)
# System prompt for V0 generation
V0_SYSTEM_PROMPT = """You are a senior venture capital analyst at Strike Capital.
You generate precise, high-quality diligence documents following Strike's exact template structure.
Your outputs must be:
- Factual and grounded in the provided data
- Concise but insightful
- Formatted exactly as specified
- Professional in tone
If information is not available, use "Unknown" or "Undisclosed" - NEVER fabricate data.
"""
# Section-specific prompts
SECTION_PROMPTS = {
"deal_overview": """Generate a Deal Overview section (1-2 sentences).
Include: company name, round size, stage, intro source, timing to close.
Format:
[Company] is raising [amount] in a [stage] round. [Intro source and timing details].
Note: If round details are unknown, state "Round details to be confirmed."
""",
"company_summary": """Generate a Company Summary (one concise paragraph).
Must include:
- What the product is/does
- Who uses it (target users)
- How it works at a high level
- Core problem solved vs status quo
- Indicative pricing if known
Keep it under 100 words. Be specific, not generic.
""",
"investors": """Generate an Investors section.
Format:
**Total Investors:** [count]
**Lead Investors:** [names]
**Other Investors:** [names]
**Notable Angels:** [if any]
If investor details are incomplete, note "Additional investors TBD."
""",
"company_overview": """Generate a Company Overview section with EXACTLY this bullet structure:
- **Founded:** [Year or "Unknown"]
- **HQ:** [City, Country or "Unknown"]
- **Headcount:** [Count + YoY growth if known]
- **ARR / Revenue:** [value or "Undisclosed"]
- **Total Funding (pre-current):** [Amount or "Unknown"]
- **Product Stage:** [Alpha / Beta / GA / Unknown]
- **Customers:** [# of customers, 3-5 notable logos, notes on pilots/design partners]
Use exactly this format. Do not add or remove bullets.
""",
"key_insights": """Generate 2-3 Key Insights.
These should be sharp, high-signal "fun facts" such as:
- Notable customer logos or partnerships
- Impressive technical depth or team credentials
- Strong hiring velocity or talent density
- Red flags or concerns (if any)
Format as bullets. Each insight should be surprising or noteworthy.
""",
"team_overview": """Generate a Team Overview section.
For each founder (1 bullet each, under 15 words):
- [Name], [Title]: [Last role] at [Last company], [X years]. [Notable trait].
Then one team summary bullet:
- **Team:** [Headcount] employees, [growth]. Key talent from [notable companies].
Be specific about backgrounds and previous companies.
""",
"market_overview": """Generate a Market Overview (single short paragraph).
Must include:
- Target market and buyer
- Problem surface area
- Key tailwinds
- TAM/CAGR metrics with sources (if available)
- Key unknowns to validate
If market data is limited, acknowledge gaps explicitly.
""",
"competitive_landscape": """Generate a Competitive Landscape section.
1. One sentence on market structure & competitor types:
"The market includes [direct competitors], [adjacent substitutes], and [status-quo alternatives]."
2. Competitor table (top 5):
| Company | Founded | Description | Funding | Notable Investors |
|---------|---------|-------------|---------|-------------------|
| ... | ... | ... | ... | ... |
3. 1-2 differentiation hypotheses to test:
- Hypothesis 1: [specific differentiator to validate]
- Hypothesis 2: [another angle]
4. One sentence on moat potential.
""",
"smart_talking_points": """Generate Smart Talking Points (STPs).
These are technically credible statements Strike can say on a founder call.
Format (1-2 per topic):
**ICP:**
- [Hypothesis about ideal customer]
**GTM:**
- [Hypothesis about go-to-market motion]
**Architecture:**
- [Technical hypothesis about how product is built]
**Pricing:**
- [Hypothesis about pricing model/strategy]
**Recruiting:**
- [Hypothesis about talent strategy]
Each should be conversation unlockers, grounded in evidence from the data.
""",
"ddqs": """Generate 8-12 Due Diligence Questions (DDQs) for the founder call.
Questions must be:
- Specific and evidence-anchored (reference data points)
- Not generic VC boilerplate
- Designed to validate key assumptions or fill gaps
Categories to cover:
1. Founders & Team / Founder-Market Fit
2. Problem & Vision
3. Product & 10x Insight
4. Market & Why Now
5. Competitive Landscape / Moat
6. Business Model & GTM
7. Traction & PMF Quality
8. Risk / Pre-Mortem
Format each as:
**[Category]:**
- [Question that references specific data or gap]
"""
}
def generate_section(section_name: str, extracted_data: dict) -> str:
"""
Generate a single V0 section using GPT-5.1.
Args:
section_name: Name of the section to generate
extracted_data: Full extracted data dictionary
Returns:
Generated section text
"""
if section_name not in SECTION_PROMPTS:
return f"[Unknown section: {section_name}]"
prompt = SECTION_PROMPTS[section_name]
# Build context from extracted data
context = f"""
## Available Data:
### Company Information:
{json.dumps(extracted_data.get('company_info', {}), indent=2)}
### Funding:
{json.dumps(extracted_data.get('funding', {}), indent=2)}
### Founders:
{json.dumps(extracted_data.get('founders', []), indent=2)}
### Product:
{json.dumps(extracted_data.get('product', {}), indent=2)}
### Market:
{json.dumps(extracted_data.get('market', {}), indent=2)}
### Traction:
{json.dumps(extracted_data.get('traction', {}), indent=2)}
"""
full_prompt = f"{V0_SYSTEM_PROMPT}\n\n{prompt}\n\n{context}"
# Use GPT-5.1 with Responses API and high reasoning effort
response = client.responses.create(
model="gpt-5.1",
input=full_prompt,
reasoning={"effort": "high"}
)
return response.output_text
def generate_v0_document(extracted_data: dict, company_name: str = None, progress_callback=None) -> str:
"""
Generate a complete V0 diligence document.
Args:
extracted_data: Dictionary of data extracted from Harmonic PDF
company_name: Optional company name override
progress_callback: Optional callback for progress updates
Returns:
Complete V0 document as markdown string
"""
# Get company name from data if not provided
if not company_name:
company_name = extracted_data.get("company_info", {}).get("name", "Unknown Company")
sections = [
("deal_overview", "Deal Overview"),
("company_summary", "Company Summary"),
("investors", "Investors"),
("company_overview", "Company Overview"),
("key_insights", "Key Insights"),
("team_overview", "Team Overview"),
("market_overview", "Market Overview"),
("competitive_landscape", "Competitive Landscape"),
("smart_talking_points", "Smart Talking Points"),
("ddqs", "Due Diligence Questions (DDQs)")
]
document_parts = [
f"# V0 Diligence Document: {company_name}",
f"*Generated by Strike Capital AI Diligence System*\n",
"---\n"
]
for i, (section_key, section_title) in enumerate(sections):
if progress_callback:
progress_callback(i + 1, len(sections), section_title)
print(f"Generating: {section_title}...")
section_content = generate_section(section_key, extracted_data)
document_parts.append(f"## {section_title}\n")
document_parts.append(section_content)
document_parts.append("\n---\n")
# Add footer
document_parts.append("\n*This document was auto-generated from Harmonic data. Human review recommended.*")
return "\n".join(document_parts)
def regenerate_section(section_name: str, extracted_data: dict, feedback: str = None) -> str:
"""
Regenerate a specific section with optional feedback.
Args:
section_name: Section to regenerate
extracted_data: Source data
feedback: Optional user feedback for improvement
Returns:
Regenerated section text
"""
base_content = generate_section(section_name, extracted_data)
if not feedback:
return base_content
# Apply feedback using GPT-5.1 Responses API
revision_prompt = f"""{V0_SYSTEM_PROMPT}
Here is a generated section:
{base_content}
User feedback: {feedback}
Please revise the section based on this feedback while maintaining the required format."""
response = client.responses.create(
model="gpt-5.1",
input=revision_prompt,
reasoning={"effort": "high"}
)
return response.output_text
if __name__ == "__main__":
# Test with sample data
sample_data = {
"company_info": {
"name": "Test Company",
"founded_year": 2022,
"hq_location": "San Francisco, CA",
"headcount": 15
},
"funding": {
"total_funding": "$5M",
"investors": ["Sequoia", "a16z"]
}
}
doc = generate_v0_document(sample_data)
print(doc)