Find similar error patterns. Args: error_type: Type of error to match error_message: Error message to match limit: Maximum results to return Returns: List of (pattern, similarity_score) tuples
(self, error_type: str, error_message: str,
limit: int = 5)
| 258 | self.record_fix(key, fix, success) |
| 259 | |
| 260 | def find_similar_errors(self, error_type: str, error_message: str, |
| 261 | limit: int = 5) -> List[Tuple[ErrorPattern, float]]: |
| 262 | """ |
| 263 | Find similar error patterns. |
| 264 | |
| 265 | Args: |
| 266 | error_type: Type of error to match |
| 267 | error_message: Error message to match |
| 268 | limit: Maximum results to return |
| 269 | |
| 270 | Returns: |
| 271 | List of (pattern, similarity_score) tuples |
| 272 | """ |
| 273 | query = ErrorPattern(error_type, error_message, "", False) |
| 274 | results = [] |
| 275 | |
| 276 | for pattern in self._cache.values(): |
| 277 | score = query.similarity_score(pattern) |
| 278 | if score > 0.3: # Minimum similarity threshold |
| 279 | results.append((pattern, score)) |
| 280 | |
| 281 | # Sort by similarity |
| 282 | results.sort(key=lambda x: x[1], reverse=True) |
| 283 | return results[:limit] |
| 284 | |
| 285 | def suggest_fix(self, error_type: str, error_message: str) -> Optional[str]: |
| 286 | """ |