Spaces:
Sleeping
Sleeping
User can choose model
Browse files- src/streamlit_app.py +10 -1
- src/workflows_v2.py +83 -70
src/streamlit_app.py
CHANGED
|
@@ -205,6 +205,14 @@ def main():
|
|
| 205 |
help="The more detailed your description, the better the validation will be."
|
| 206 |
)
|
| 207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
submitted = st.form_submit_button("π Validate My Idea", use_container_width=True)
|
| 209 |
|
| 210 |
with col2:
|
|
@@ -232,7 +240,7 @@ def main():
|
|
| 232 |
# Keep the example in session state until form is submitted
|
| 233 |
|
| 234 |
# Process the form submission
|
| 235 |
-
if submitted and startup_idea:
|
| 236 |
# Clear the selected example when submitting
|
| 237 |
if 'selected_example' in st.session_state:
|
| 238 |
del st.session_state.selected_example
|
|
@@ -253,6 +261,7 @@ def main():
|
|
| 253 |
return await startup_validation_workflow.arun(
|
| 254 |
message=message,
|
| 255 |
startup_idea=startup_idea,
|
|
|
|
| 256 |
progress_callback=tracker.update_progress # Pass the real-time callback
|
| 257 |
)
|
| 258 |
|
|
|
|
| 205 |
help="The more detailed your description, the better the validation will be."
|
| 206 |
)
|
| 207 |
|
| 208 |
+
# Model selection toggle
|
| 209 |
+
model_id = st.selectbox(
|
| 210 |
+
"π€ Model to use:",
|
| 211 |
+
options=["gpt-4o", "gpt-4o-mini", "o1", "o3-mini"],
|
| 212 |
+
index=0, # Default to gpt-4o
|
| 213 |
+
help="Choose which AI model to use for the validation analysis"
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
submitted = st.form_submit_button("π Validate My Idea", use_container_width=True)
|
| 217 |
|
| 218 |
with col2:
|
|
|
|
| 240 |
# Keep the example in session state until form is submitted
|
| 241 |
|
| 242 |
# Process the form submission
|
| 243 |
+
if submitted and startup_idea and model_id:
|
| 244 |
# Clear the selected example when submitting
|
| 245 |
if 'selected_example' in st.session_state:
|
| 246 |
del st.session_state.selected_example
|
|
|
|
| 261 |
return await startup_validation_workflow.arun(
|
| 262 |
message=message,
|
| 263 |
startup_idea=startup_idea,
|
| 264 |
+
model_id=model_id, # Pass the selected model
|
| 265 |
progress_callback=tracker.update_progress # Pass the real-time callback
|
| 266 |
)
|
| 267 |
|
src/workflows_v2.py
CHANGED
|
@@ -20,18 +20,19 @@ load_dotenv(env_path)
|
|
| 20 |
from atla_insights import configure, instrument, instrument_agno, instrument_openai, mark_success, mark_failure, tool
|
| 21 |
|
| 22 |
# Model configuration - using same model across all agents but you can change them to any model you want
|
| 23 |
-
|
| 24 |
|
| 25 |
# Define metadata for tracing
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
| 32 |
|
| 33 |
# Configure Atla Insights with metadata - REQUIRED FIRST
|
| 34 |
-
configure(token=os.getenv("ATLA_INSIGHTS_TOKEN"), metadata=
|
| 35 |
|
| 36 |
# Instrument based on detected framework and LLM provider
|
| 37 |
instrument_agno("openai") # Agno framework with OpenAI
|
|
@@ -95,71 +96,76 @@ class ValidationReport(BaseModel):
|
|
| 95 |
next_steps: str = Field(..., description="Recommended next steps.")
|
| 96 |
|
| 97 |
|
| 98 |
-
# ---
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
market_research_agent = Agent(
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
| 130 |
|
| 131 |
-
competitor_analysis_agent = Agent(
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
)
|
| 147 |
|
| 148 |
-
report_agent = Agent(
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
)
|
|
|
|
|
|
|
| 163 |
|
| 164 |
|
| 165 |
# --- Execution function ---
|
|
@@ -168,11 +174,15 @@ async def startup_validation_execution(
|
|
| 168 |
workflow: Workflow,
|
| 169 |
execution_input: WorkflowExecutionInput,
|
| 170 |
startup_idea: str,
|
|
|
|
| 171 |
progress_callback=None,
|
| 172 |
**kwargs: Any,
|
| 173 |
) -> str:
|
| 174 |
"""Execute the complete startup idea validation workflow"""
|
| 175 |
|
|
|
|
|
|
|
|
|
|
| 176 |
# Get inputs
|
| 177 |
message: str = execution_input.message
|
| 178 |
idea: str = startup_idea
|
|
@@ -184,9 +194,11 @@ async def startup_validation_execution(
|
|
| 184 |
if progress_callback:
|
| 185 |
progress_callback(f"π Starting startup idea validation for: {idea}")
|
| 186 |
progress_callback(f"π‘ Validation request: {message}")
|
|
|
|
| 187 |
else:
|
| 188 |
print(f"π Starting startup idea validation for: {idea}")
|
| 189 |
print(f"π‘ Validation request: {message}")
|
|
|
|
| 190 |
|
| 191 |
# Phase 1: Idea Clarification
|
| 192 |
if progress_callback:
|
|
@@ -451,6 +463,7 @@ if __name__ == "__main__":
|
|
| 451 |
result = await startup_validation_workflow.arun(
|
| 452 |
message="Please validate this startup idea with comprehensive market research and competitive analysis",
|
| 453 |
startup_idea=idea,
|
|
|
|
| 454 |
)
|
| 455 |
|
| 456 |
pprint_run_response(result, markdown=True)
|
|
|
|
| 20 |
from atla_insights import configure, instrument, instrument_agno, instrument_openai, mark_success, mark_failure, tool
|
| 21 |
|
| 22 |
# Model configuration - using same model across all agents but you can change them to any model you want
|
| 23 |
+
DEFAULT_MODEL_ID = "gpt-4o"
|
| 24 |
|
| 25 |
# Define metadata for tracing
|
| 26 |
+
def get_metadata(model_id):
|
| 27 |
+
return {
|
| 28 |
+
"model": model_id,
|
| 29 |
+
"prompt": "v1.1",
|
| 30 |
+
"environment": "prod",
|
| 31 |
+
"agent_name": "Startup Idea Validator"
|
| 32 |
+
}
|
| 33 |
|
| 34 |
# Configure Atla Insights with metadata - REQUIRED FIRST
|
| 35 |
+
configure(token=os.getenv("ATLA_INSIGHTS_TOKEN"), metadata=get_metadata(DEFAULT_MODEL_ID))
|
| 36 |
|
| 37 |
# Instrument based on detected framework and LLM provider
|
| 38 |
instrument_agno("openai") # Agno framework with OpenAI
|
|
|
|
| 96 |
next_steps: str = Field(..., description="Recommended next steps.")
|
| 97 |
|
| 98 |
|
| 99 |
+
# --- Agent creation functions ---
|
| 100 |
+
def create_agents(model_id: str = DEFAULT_MODEL_ID):
|
| 101 |
+
"""Create all agents with the specified model"""
|
| 102 |
+
|
| 103 |
+
idea_clarifier_agent = Agent(
|
| 104 |
+
name="Idea Clarifier",
|
| 105 |
+
model=OpenAIChat(id=model_id),
|
| 106 |
+
instructions=[
|
| 107 |
+
"Given a user's startup idea, your goal is to refine that idea.",
|
| 108 |
+
"Evaluate the originality of the idea by comparing it with existing concepts.",
|
| 109 |
+
"Define the mission and objectives of the startup.",
|
| 110 |
+
"Provide clear, actionable insights about the core business concept.",
|
| 111 |
+
],
|
| 112 |
+
add_history_to_messages=True,
|
| 113 |
+
add_datetime_to_instructions=True,
|
| 114 |
+
response_model=IdeaClarification,
|
| 115 |
+
debug_mode=False,
|
| 116 |
+
)
|
| 117 |
|
| 118 |
+
market_research_agent = Agent(
|
| 119 |
+
name="Market Research Agent",
|
| 120 |
+
model=OpenAIChat(id=model_id),
|
| 121 |
+
tools=[GoogleSearchTools()],
|
| 122 |
+
instructions=[
|
| 123 |
+
"You are provided with a startup idea and the company's mission and objectives.",
|
| 124 |
+
"Estimate the total addressable market (TAM), serviceable available market (SAM), and serviceable obtainable market (SOM).",
|
| 125 |
+
"Define target customer segments and their characteristics.",
|
| 126 |
+
"Search the web for resources and data to support your analysis.",
|
| 127 |
+
"Provide specific market size estimates with supporting data sources.",
|
| 128 |
+
],
|
| 129 |
+
add_history_to_messages=True,
|
| 130 |
+
add_datetime_to_instructions=True,
|
| 131 |
+
response_model=MarketResearch,
|
| 132 |
+
debug_mode=False,
|
| 133 |
+
)
|
| 134 |
|
| 135 |
+
competitor_analysis_agent = Agent(
|
| 136 |
+
name="Competitor Analysis Agent",
|
| 137 |
+
model=OpenAIChat(id=model_id),
|
| 138 |
+
tools=[GoogleSearchTools()],
|
| 139 |
+
instructions=[
|
| 140 |
+
"You are provided with a startup idea and market research data.",
|
| 141 |
+
"Identify existing competitors in the market.",
|
| 142 |
+
"Perform Strengths, Weaknesses, Opportunities, and Threats (SWOT) analysis for each competitor.",
|
| 143 |
+
"Assess the startup's potential positioning relative to competitors.",
|
| 144 |
+
"Search for recent competitor information and market positioning.",
|
| 145 |
+
],
|
| 146 |
+
add_history_to_messages=True,
|
| 147 |
+
add_datetime_to_instructions=True,
|
| 148 |
+
response_model=CompetitorAnalysis,
|
| 149 |
+
debug_mode=False,
|
| 150 |
+
)
|
| 151 |
|
| 152 |
+
report_agent = Agent(
|
| 153 |
+
name="Report Generator",
|
| 154 |
+
model=OpenAIChat(id=model_id),
|
| 155 |
+
instructions=[
|
| 156 |
+
"You are provided with comprehensive data about a startup idea including clarification, market research, and competitor analysis.",
|
| 157 |
+
"Synthesize all information into a comprehensive validation report.",
|
| 158 |
+
"Provide clear executive summary, assessment, and actionable recommendations.",
|
| 159 |
+
"Structure the report professionally with clear sections and insights.",
|
| 160 |
+
"Include specific next steps for the entrepreneur.",
|
| 161 |
+
],
|
| 162 |
+
add_history_to_messages=True,
|
| 163 |
+
add_datetime_to_instructions=True,
|
| 164 |
+
response_model=ValidationReport,
|
| 165 |
+
debug_mode=False,
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
+
return idea_clarifier_agent, market_research_agent, competitor_analysis_agent, report_agent
|
| 169 |
|
| 170 |
|
| 171 |
# --- Execution function ---
|
|
|
|
| 174 |
workflow: Workflow,
|
| 175 |
execution_input: WorkflowExecutionInput,
|
| 176 |
startup_idea: str,
|
| 177 |
+
model_id: str = DEFAULT_MODEL_ID,
|
| 178 |
progress_callback=None,
|
| 179 |
**kwargs: Any,
|
| 180 |
) -> str:
|
| 181 |
"""Execute the complete startup idea validation workflow"""
|
| 182 |
|
| 183 |
+
# Create agents with the specified model
|
| 184 |
+
idea_clarifier_agent, market_research_agent, competitor_analysis_agent, report_agent = create_agents(model_id)
|
| 185 |
+
|
| 186 |
# Get inputs
|
| 187 |
message: str = execution_input.message
|
| 188 |
idea: str = startup_idea
|
|
|
|
| 194 |
if progress_callback:
|
| 195 |
progress_callback(f"π Starting startup idea validation for: {idea}")
|
| 196 |
progress_callback(f"π‘ Validation request: {message}")
|
| 197 |
+
progress_callback(f"π€ Using model: {model_id}")
|
| 198 |
else:
|
| 199 |
print(f"π Starting startup idea validation for: {idea}")
|
| 200 |
print(f"π‘ Validation request: {message}")
|
| 201 |
+
print(f"π€ Using model: {model_id}")
|
| 202 |
|
| 203 |
# Phase 1: Idea Clarification
|
| 204 |
if progress_callback:
|
|
|
|
| 463 |
result = await startup_validation_workflow.arun(
|
| 464 |
message="Please validate this startup idea with comprehensive market research and competitive analysis",
|
| 465 |
startup_idea=idea,
|
| 466 |
+
model_id=DEFAULT_MODEL_ID,
|
| 467 |
)
|
| 468 |
|
| 469 |
pprint_run_response(result, markdown=True)
|