(cls, state: MemoryPolicyState)
| 27 | |
| 28 | @classmethod |
| 29 | def from_state(cls, state: MemoryPolicyState) -> "MemoryPolicy": |
| 30 | kwargs: dict = dict( |
| 31 | max_injected_units=state.max_injected_units, |
| 32 | max_injected_tokens=state.max_injected_tokens, |
| 33 | recent_bonus_hours=state.recent_bonus_hours, |
| 34 | keyword_weight=state.keyword_weight, |
| 35 | metadata_weight=state.metadata_weight, |
| 36 | importance_weight=state.importance_weight, |
| 37 | recency_weight=state.recency_weight, |
| 38 | ) |
| 39 | if state.type_boosts: |
| 40 | kwargs["type_boosts"] = dict(state.type_boosts) |
| 41 | return cls(**kwargs) |
| 42 | |
| 43 | @classmethod |
| 44 | def from_profile(cls, profile: str) -> "MemoryPolicy": |
no outgoing calls
no test coverage detected