(user_profile: Dict[str, Any])
| 3054 | |
| 3055 | def _summarize_profile_for_embedding(user_profile: Dict[str, Any]) -> str: |
| 3056 | core_directions = user_profile.get("core_directions", {}) or {} |
| 3057 | sorted_directions = sorted( |
| 3058 | core_directions.items(), |
| 3059 | key=lambda item: float(item[1]), |
| 3060 | reverse=True, |
| 3061 | ) |
| 3062 | direction_parts = [ |
| 3063 | f"{_format_direction_label(direction)} ({float(weight):.2f})" |
| 3064 | for direction, weight in sorted_directions[:4] |
| 3065 | ] |
| 3066 | |
| 3067 | preferences = user_profile.get("methodology_preferences", {}) or {} |
| 3068 | preference_parts: List[str] = [] |
| 3069 | if preferences.get("preference_data_driven_over_theory"): |
| 3070 | preference_parts.append("data-driven empirical work") |
| 3071 | if preferences.get("preference_systematic_work_over_incremental"): |
| 3072 | preference_parts.append("systematic end-to-end frameworks") |
| 3073 | if preferences.get("preference_bio_science_application"): |
| 3074 | preference_parts.append("bio and science applications") |
| 3075 | |
| 3076 | blocks: List[str] = [] |
| 3077 | if direction_parts: |
| 3078 | blocks.append("Research directions: " + ", ".join(direction_parts)) |
| 3079 | if preference_parts: |
| 3080 | blocks.append("Method preferences: " + ", ".join(preference_parts)) |
| 3081 | return ". ".join(blocks) |
| 3082 | |
| 3083 | |
| 3084 | def _get_reading_evidence_cache_dir() -> Path: |
| 3085 | configured = os.environ.get("READING_REPORT_EVIDENCE_CACHE_DIR", "").strip() |
no test coverage detected