- id: setup_contextual_search
name: setup_contextual_search
tool: INPUT_TEXT
input:
- name: value
value: "We are planning a new product launch in the healthcare AI sector. What regulatory considerations, market opportunities, and technical challenges should we be aware of?"
- id: extract_search_aspects
name: extract_search_aspects
tool: OPENAI_INVOKE
config:
- name: version
value: gpt-4
input:
- name: prompt
value: |
Break down this business query into specific search aspects:
"{{steps.setup_contextual_search.result}}"
Extract and categorize into:
1. Regulatory aspects (compliance, legal, regulations)
2. Market aspects (opportunities, competition, trends)
3. Technical aspects (challenges, requirements, capabilities)
For each aspect, generate 2-3 specific search queries that would help gather relevant information.
Return as JSON:
{
"regulatory_queries": ["query1", "query2", "query3"],
"market_queries": ["query1", "query2", "query3"],
"technical_queries": ["query1", "query2", "query3"]
}
- id: search_regulatory_info
name: search_regulatory_info
tool: LLAMA_CLOUD_QUERY_WITH_LLAMA_INDEX
config:
- name: api_key
value: "{{secrets.LLAMA_CLOUD_API_KEY}}"
input:
- name: input
value: "{{steps.extract_search_aspects.result.regulatory_queries}}"
- name: system_prompt
value: "Focus on regulatory and compliance aspects when answering: {query}"
- name: name
value: "regulatory-knowledge-base"
- name: project_name
value: "compliance-research"
- name: organization_id
value: "your-org-id"
- name: similarity_top_k
value: 4
- id: search_market_info
name: search_market_info
tool: LLAMA_CLOUD_QUERY_WITH_LLAMA_INDEX
config:
- name: api_key
value: "{{secrets.LLAMA_CLOUD_API_KEY}}"
input:
- name: input
value: "{{steps.extract_search_aspects.result.market_queries}}"
- name: system_prompt
value: "Provide market analysis and business intelligence for: {query}"
- name: name
value: "market-intelligence-index"
- name: project_name
value: "market-research"
- name: organization_id
value: "your-org-id"
- name: similarity_top_k
value: 4
- id: compile_comprehensive_report
name: compile_comprehensive_report
tool: PYTHON_SANDBOX_RUN
input:
- name: script
value: |
import json
# Process all search results
regulatory_results = {{steps.search_regulatory_info.result}}
market_results = {{steps.search_market_info.result}}
def process_results(results, category):
processed = []
for result in results:
if len(result) >= 2:
processed.append({
"query": result[0],
"answer": result[1],
"references": result[2:] if len(result) > 2 else [],
"category": category
})
return processed
all_insights = []
all_insights.extend(process_results(regulatory_results, "Regulatory"))
all_insights.extend(process_results(market_results, "Market"))
# Generate structured report
report = {
"executive_summary": {
"total_insights": len(all_insights),
"regulatory_insights": len([i for i in all_insights if i["category"] == "Regulatory"]),
"market_insights": len([i for i in all_insights if i["category"] == "Market"])
},
"detailed_findings": {
"regulatory_considerations": [i for i in all_insights if i["category"] == "Regulatory"],
"market_opportunities": [i for i in all_insights if i["category"] == "Market"]
},
"action_items": [
"Review regulatory compliance requirements",
"Analyze market positioning strategies",
"Assess technical implementation challenges",
"Develop risk mitigation strategies"
]
}
print(json.dumps(report, indent=2))