MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / build_user_states

Function build_user_states

experiments/baselines/citation_enhanced/runner.py:506–525  ·  view source on GitHub ↗
(
    user_metadata: Dict[str, Dict[str, Any]],
    roles: Dict[str, Dict[str, Any]],
    episode_rows: Sequence[Dict[str, Any]],
)

Source from the content-addressed store, hash-verified

504
505
506def build_user_states(
507 user_metadata: Dict[str, Dict[str, Any]],
508 roles: Dict[str, Dict[str, Any]],
509 episode_rows: Sequence[Dict[str, Any]],
510) -> Dict[str, UserCitationState]:
511 user_ids = sorted(
512 {
513 str(row.get("user_id") or "").strip()
514 for row in episode_rows
515 if str(row.get("user_id") or "").strip()
516 }
517 | set(user_metadata.keys())
518 )
519 states: Dict[str, UserCitationState] = {}
520 for user_id in user_ids:
521 meta = user_metadata.get(user_id, {"user_id": user_id})
522 role_name = str(meta.get("role_name") or user_id.replace("user_", "")).strip()
523 profile = build_initial_profile(meta, roles.get(role_name, {}))
524 states[user_id] = UserCitationState(profile_text=make_profile_text(profile))
525 return states
526
527
528def clone_output_row(

Callers 1

rerank_episodesFunction · 0.70

Calls 4

UserCitationStateClass · 0.85
getMethod · 0.80
build_initial_profileFunction · 0.70
make_profile_textFunction · 0.70

Tested by

no test coverage detected