--- reasoning.py +++ reasoning.py @@ -2796,297 +2796,297 @@ async def _cross_modal_alignment(self, modalities: Dict[str, List[Dict[str, Any]]], context: Dict[str, Any]) -> List[Dict[str, Any]]: """Align information across different modalities.""" try: # Extract modality types modal_types = list(modalities.keys()) # Initialize alignment results alignments = [] # Process each modality pair for i in range(len(modal_types)): for j in range(i + 1, len(modal_types)): type1, type2 = modal_types[i], modal_types[j] # Get items from each modality items1 = modalities[type1] items2 = modalities[type2] # Find alignments between items for item1 in items1: for item2 in items2: similarity = self._calculate_similarity(item1, item2) if similarity > 0.5: # Threshold for alignment alignments.append({ "type1": type1, "type2": type2, "item1": item1, "item2": item2, "similarity": similarity }) # Sort alignments by similarity alignments.sort(key=lambda x: x["similarity"], reverse=True) return alignments except Exception as e: logging.error(f"Error in cross-modal alignment: {str(e)}") return []