Spaces:
Sleeping
Sleeping
File size: 1,478 Bytes
bdcaac2 |
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 |
from questions import questions
from chain_reports import generate_short_report_for_session
from chain_problems import analyze_problems_with_chain
from chain_recommendations import generate_recommendations
from chain_summary import generate_final_summary, shorten_summary
from typing import Dict
def process_answers_pipeline(responses: Dict[str, str]) -> Dict[str, any]:
"""
Orchestrates the entire pipeline:
1. Generates a short wellness report based on responses.
2. Analyzes problems using the generated report.
3. Generates package recommendations.
4. Creates a final summary for video narration.
5. Shortens the final summary for concise video creation.
Returns a dictionary containing all outputs.
"""
# Step 1: Generate Report
report = generate_short_report_for_session(responses)
# Step 2: Analyze Problem Severity
problems = analyze_problems_with_chain(responses, report)
# Step 3: Generate Recommendations
recommendation = generate_recommendations(problems)
# Step 4: Generate Final Summary
final_summary = generate_final_summary(report, problems, recommendation)
# Step 5: Shorten Summary for Video
shortened_summary = shorten_summary(final_summary)
# Compile all results
return {
"report": report,
"problems": problems,
"recommendation": recommendation,
"final_summary": final_summary,
"shortened_summary": shortened_summary
}
|