Spaces:
Runtime error
Runtime error
File size: 1,854 Bytes
dcb2a99 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
--- 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 []
|