| 2957 | return all_updates |
| 2958 | |
| 2959 | def analyze_versions(self, updates: list) -> list: |
| 2960 | if not self.llm.available: |
| 2961 | print("INFO: LLM analysis skipped (LLM_API_KEY not set)") |
| 2962 | return updates |
| 2963 | print("\nRunning LLM version analysis...") |
| 2964 | for update in updates: |
| 2965 | new_items = update.get("new_items", []) |
| 2966 | if not new_items: |
| 2967 | continue |
| 2968 | doc_id = update["source_id"] |
| 2969 | analysis = self.llm.analyze(doc_id, self.registry.get(doc_id), new_items) |
| 2970 | update["llm_analysis"] = analysis |
| 2971 | if analysis.get("is_update") and analysis.get("confidence", 0) > 0.7: |
| 2972 | update["confirmed_update"] = True |
| 2973 | update["new_version"] = analysis.get("new_version") |
| 2974 | update["new_url"] = analysis.get("new_url") |
| 2975 | print(f" CONFIRMED: {doc_id} -> v{analysis.get('new_version')} " |
| 2976 | f"({analysis.get('confidence', 0):.0%})") |
| 2977 | else: |
| 2978 | print(f" UNCONFIRMED: {doc_id} - {analysis.get('reasoning','')[:80]}") |
| 2979 | time.sleep(0.5) |
| 2980 | return updates |
| 2981 | |
| 2982 | def generate_report(self, updates: list) -> dict: |
| 2983 | confirmed = [u for u in updates if u.get("confirmed_update")] |