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

Function _trim_bootstrap_profile

agents/coldstart-agent/main.py:958–975  ·  view source on GitHub ↗
(profile: Dict[str, Any])

Source from the content-addressed store, hash-verified

956
957
958def _trim_bootstrap_profile(profile: Dict[str, Any]) -> None:
959 core_items = sorted(
960 (profile.get("core_directions") or {}).items(),
961 key=lambda item: (-float(item[1]), str(item[0])),
962 )
963 kept_core = dict(core_items[:BOOTSTRAP_MAX_CORE_DIRECTIONS])
964 kept_keys = set(kept_core)
965
966 profile["core_directions"] = kept_core
967 profile["topic_weights"] = {
968 key: float(value)
969 for key, value in sorted(
970 (profile.get("topic_weights") or {}).items(),
971 key=lambda item: (-float(item[1]), str(item[0])),
972 )
973 if key in kept_keys or float(value or 0.0) >= 0.35
974 }
975 profile["interest_vector"] = generate_interest_vector(kept_core) if kept_core else []
976
977
978def _build_bootstrap_fragment_from_structured_sources(

Calls 2

generate_interest_vectorFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected