Spaces:
Running
Running
Fix metadata of trace
Browse files- src/workflows_v2.py +22 -6
src/workflows_v2.py
CHANGED
|
@@ -13,7 +13,6 @@ from dotenv import load_dotenv
|
|
| 13 |
import os
|
| 14 |
|
| 15 |
script_dir = os.path.dirname(os.path.abspath(__file__))
|
| 16 |
-
|
| 17 |
env_path = os.path.join(script_dir, '.env')
|
| 18 |
load_dotenv(env_path)
|
| 19 |
|
|
@@ -33,7 +32,6 @@ def get_metadata(model_id):
|
|
| 33 |
}
|
| 34 |
|
| 35 |
# Configure Atla Insights with metadata - REQUIRED FIRST
|
| 36 |
-
# Note: Initial configuration will be updated dynamically in the workflow execution
|
| 37 |
configure(token=os.getenv("ATLA_INSIGHTS_TOKEN"), metadata=get_metadata(DEFAULT_MODEL_ID))
|
| 38 |
|
| 39 |
# Instrument based on detected framework and LLM provider
|
|
@@ -171,8 +169,29 @@ def create_agents(model_id: str = DEFAULT_MODEL_ID):
|
|
| 171 |
|
| 172 |
|
| 173 |
# --- Execution function ---
|
| 174 |
-
@instrument("Startup Idea Validation Workflow")
|
| 175 |
async def startup_validation_execution(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
workflow: Workflow,
|
| 177 |
execution_input: WorkflowExecutionInput, # This is a Pydantic model to ensure type safety
|
| 178 |
startup_idea: str,
|
|
@@ -182,9 +201,6 @@ async def startup_validation_execution(
|
|
| 182 |
) -> str:
|
| 183 |
"""Execute the complete startup idea validation workflow"""
|
| 184 |
|
| 185 |
-
# Update Atla Insights configuration with the correct model_id for this execution
|
| 186 |
-
configure(token=os.getenv("ATLA_INSIGHTS_TOKEN"), metadata=get_metadata(model_id))
|
| 187 |
-
|
| 188 |
# Create agents with the specified model
|
| 189 |
idea_clarifier_agent, market_research_agent, competitor_analysis_agent, report_agent = create_agents(model_id)
|
| 190 |
|
|
|
|
| 13 |
import os
|
| 14 |
|
| 15 |
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 16 |
env_path = os.path.join(script_dir, '.env')
|
| 17 |
load_dotenv(env_path)
|
| 18 |
|
|
|
|
| 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
|
|
|
|
| 169 |
|
| 170 |
|
| 171 |
# --- Execution function ---
|
|
|
|
| 172 |
async def startup_validation_execution(
|
| 173 |
+
workflow: Workflow,
|
| 174 |
+
execution_input: WorkflowExecutionInput,
|
| 175 |
+
startup_idea: str,
|
| 176 |
+
model_id: str = DEFAULT_MODEL_ID,
|
| 177 |
+
progress_callback=None,
|
| 178 |
+
**kwargs: Any,
|
| 179 |
+
) -> str:
|
| 180 |
+
"""Wrapper function that applies instrument decorator with dynamic metadata"""
|
| 181 |
+
|
| 182 |
+
# Apply the instrument decorator with the dynamic model_id metadata
|
| 183 |
+
instrumented_func = instrument(
|
| 184 |
+
"Startup Idea Validation Workflow",
|
| 185 |
+
metadata=get_metadata(model_id)
|
| 186 |
+
)(_startup_validation_execution_impl)
|
| 187 |
+
|
| 188 |
+
# Execute the instrumented function
|
| 189 |
+
return await instrumented_func(
|
| 190 |
+
workflow, execution_input, startup_idea, model_id, progress_callback, **kwargs
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
async def _startup_validation_execution_impl(
|
| 195 |
workflow: Workflow,
|
| 196 |
execution_input: WorkflowExecutionInput, # This is a Pydantic model to ensure type safety
|
| 197 |
startup_idea: str,
|
|
|
|
| 201 |
) -> str:
|
| 202 |
"""Execute the complete startup idea validation workflow"""
|
| 203 |
|
|
|
|
|
|
|
|
|
|
| 204 |
# Create agents with the specified model
|
| 205 |
idea_clarifier_agent, market_research_agent, competitor_analysis_agent, report_agent = create_agents(model_id)
|
| 206 |
|