Spaces:
Sleeping
Sleeping
| 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 | |
| } | |