-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbaseline_framework.py
76 lines (58 loc) · 2.7 KB
/
baseline_framework.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import os
import sys
import logging
from pydantic import BaseModel, Field
from dotenv import load_dotenv
# Add the project root directory to the Python path
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__)))
sys.path.insert(0, project_root)
from agents.base_agent import BaseAgent
class BaselineAnalysis(BaseModel):
total_analysis: str = Field(..., description="Detailed analysis of the startup")
score: float = Field(..., description="Overall score between 1 and 10")
recommendation: str = Field(..., description="Recommendation: 'Successful' or 'Unsuccessful'")
# Load environment variables
load_dotenv()
class BaselineFramework(BaseAgent):
def __init__(self, model="gpt-4o-mini"):
super().__init__(model)
self.logger = logging.getLogger(__name__)
def analyze_startup(self, startup_info: str) -> dict:
"""Simple baseline analysis using only ChatGPT"""
self.logger.info("Starting baseline analysis")
# Format startup info similar to other agents
prompt = """
You are an experienced venture capitalist analyzing a startup. Based on the provided information,
give a comprehensive analysis and predict if the startup will be successful or not.
Your analysis should include:
1. Market analysis
2. Product/technology evaluation
3. Founder/team assessment
4. Overall score (1-10)
5. Investment recommendation
"""
try:
response = self.get_json_response(BaselineAnalysis, prompt, "Startup Info: " + startup_info)
return response.dict()
except Exception as e:
self.logger.error(f"Error in baseline analysis: {str(e)}")
return {"error": str(e)}
if __name__ == "__main__":
def test_baseline_framework():
# Create a BaselineFramework instance
framework = BaselineFramework()
# Test startup info following the pattern from FounderAgent test
startup_info = "We are a startup that provides a platform for AI-powered software development. Our founders are from Oxford university."
try:
print("Testing BaselineFramework analyze_startup:")
print("-" * 50)
result = framework.analyze_startup(startup_info)
print("\nAnalysis Results:")
for key, value in result.items():
print(f"\n{key}:")
print(f" {value}")
print("\nTest completed successfully!")
except Exception as e:
print(f"Test failed with error: {str(e)}")
# Run the test
test_baseline_framework()