"""
Gemma3 prompt templates for case study generation MCP server.
This module contains structured prompts for extracting business insights
from documents, analyzing GitHub repositories, and researching companies.
"""
from typing import Dict, Any
# Document Processing Prompts
DOCUMENT_PROMPT = """
Extract key business insights from this {doc_type} document:
{document_text}
Return JSON with this exact structure:
{{
"challenges": ["specific business problems mentioned"],
"solutions": ["proposed solutions or approaches"],
"metrics": ["success metrics, KPIs, or quantifiable results"],
"context": "industry or company context",
"key_stakeholders": ["mentioned stakeholders or roles"],
"timeline": "project timeline if mentioned"
}}
Be specific and extract only factual information mentioned in the document.
"""
# GitHub Repository Analysis Prompt
GITHUB_PROMPT = """
Analyze this GitHub repository for business value:
Repository: {repo_name}
Description: {description}
Tech Stack: {tech_stack}
Key Files: {key_files}
README Content: {readme_content}
Return JSON with this exact structure:
{{
"problem_solved": "what business problem this solves",
"key_features": ["main features and capabilities"],
"business_value": "why this matters to businesses",
"technical_benefits": ["technical advantages"],
"target_users": "who would use this solution",
"scalability": "scalability considerations",
"integration_points": ["systems it can integrate with"]
}}
Focus on business value and practical applications, not just technical details.
"""
# Company Research Prompt
COMPANY_RESEARCH_PROMPT = """
Research and analyze company information for: {company_name}
Available context: {company_context}
Return JSON with this exact structure:
{{
"company_profile": "brief company description and core business",
"industry": "primary industry and market segment",
"business_model": "how the company generates revenue",
"challenges": ["common industry challenges this company likely faces"],
"opportunities": ["potential growth areas or market opportunities"],
"technology_needs": ["likely technology requirements or pain points"]
}}
Provide realistic, industry-standard insights based on the company name and any available context.
"""
# System prompts for different document types
DOCUMENT_TYPE_PROMPTS = {
"proposal": {
"focus": "proposed solutions, implementation plans, and expected outcomes",
"emphasis": "challenges being addressed and proposed value proposition"
},
"case_study": {
"focus": "implemented solutions, achieved results, and lessons learned",
"emphasis": "actual outcomes, metrics, and business impact"
},
"contract": {
"focus": "deliverables, timelines, and success criteria",
"emphasis": "scope of work and performance expectations"
},
"general": {
"focus": "key business information and insights",
"emphasis": "actionable business intelligence"
}
}
def get_document_prompt(doc_type: str, document_text: str) -> str:
"""
Get a document processing prompt customized for the document type.
Args:
doc_type: Type of document (proposal, case_study, contract, general)
document_text: The actual document content
Returns:
Formatted prompt string for Gemma3
"""
if doc_type not in DOCUMENT_TYPE_PROMPTS:
doc_type = "general"
return DOCUMENT_PROMPT.format(
doc_type=doc_type,
document_text=document_text
)
def get_github_prompt(repo_data: Dict[str, Any]) -> str:
"""
Get a GitHub analysis prompt with repository data.
Args:
repo_data: Dictionary containing repository information
Returns:
Formatted prompt string for Gemma3
"""
return GITHUB_PROMPT.format(
repo_name=repo_data.get("name", "Unknown"),
description=repo_data.get("description", "No description available"),
tech_stack=repo_data.get("tech_stack", "Unknown"),
key_files=repo_data.get("key_files", "No files analyzed"),
readme_content=repo_data.get("readme_content", "No README available")
)
def get_company_research_prompt(company_name: str, company_context: str = "") -> str:
"""
Get a company research prompt.
Args:
company_name: Name of the company to research
company_context: Any additional context about the company
Returns:
Formatted prompt string for Gemma3
"""
if not company_context:
company_context = "No additional context provided"
return COMPANY_RESEARCH_PROMPT.format(
company_name=company_name,
company_context=company_context
)
# Configuration for different analysis types
ANALYSIS_CONFIGS = {
"document_processing": {
"temperature": 0.1,
"max_tokens": 1000,
"focus": "extraction and structuring"
},
"github_analysis": {
"temperature": 0.2,
"max_tokens": 800,
"focus": "business value assessment"
},
"company_research": {
"temperature": 0.3,
"max_tokens": 600,
"focus": "strategic insights"
}
}
def get_analysis_config(analysis_type: str) -> Dict[str, Any]:
"""
Get Gemma3 configuration for specific analysis type.
Args:
analysis_type: Type of analysis being performed
Returns:
Configuration dictionary
"""
return ANALYSIS_CONFIGS.get(analysis_type, ANALYSIS_CONFIGS["document_processing"])