text_model_grouping
Text model grouping utilities.
Provides functionality to group text generation models by base name (stripping quantization information) and aggregate metrics across grouped variants.
merge_deletion_flags
Merge multiple deletion risk flags using logical OR.
If any variant has a flag set, the merged result will have that flag set.
Parameters:
-
flags_list(list[DeletionRiskFlags]) –List of DeletionRiskFlags from all variants.
Returns:
-
DeletionRiskFlags–Merged DeletionRiskFlags.
Source code in src/horde_model_reference/analytics/text_model_grouping.py
merge_usage_trends
Merge usage trends using weighted average.
Parameters:
-
trends(list[UsageTrend]) –List of UsageTrend objects from variants.
-
weights(list[int]) –Weights for each trend (e.g., monthly usage counts).
Returns:
-
UsageTrend–Merged UsageTrend with weighted average ratios.
Source code in src/horde_model_reference/analytics/text_model_grouping.py
group_risk_models
Group text model variants by base name and aggregate metrics.
Combines multiple quantization variants (Q4_K_M, Q5_0, etc.) into a single model entry with aggregated metrics.
Parameters:
-
models(list[ModelDeletionRiskInfo]) –List of ModelDeletionRiskInfo objects to group.
Returns:
-
list[ModelDeletionRiskInfo]–List of grouped ModelDeletionRiskInfo objects with aggregated metrics.
Source code in src/horde_model_reference/analytics/text_model_grouping.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
recalculate_risk_summary
recalculate_risk_summary(
models: list[ModelDeletionRiskInfo],
category_total_usage: int,
) -> CategoryDeletionRiskSummary
Recalculate risk summary after grouping models.
Parameters:
-
models(list[ModelDeletionRiskInfo]) –List of (potentially grouped) ModelDeletionRiskInfo objects.
-
category_total_usage(int) –Total monthly usage for the category.
Returns:
-
CategoryDeletionRiskSummary–New CategoryDeletionRiskSummary with updated counts.
Source code in src/horde_model_reference/analytics/text_model_grouping.py
apply_text_model_grouping_to_risk_response
apply_text_model_grouping_to_risk_response(
risk_response: CategoryDeletionRiskResponse,
) -> CategoryDeletionRiskResponse
Apply text model grouping to deletion risk response.
Groups text generation models by base name and recalculates summary.
Parameters:
-
risk_response(CategoryDeletionRiskResponse) –Original CategoryDeletionRiskResponse.
Returns:
-
CategoryDeletionRiskResponse–New CategoryDeletionRiskResponse with grouped models and updated summary.