def _to_firestore_filter(
    standard_filters: MetadataFilters,
) -> Union[BaseFilter, BaseCompositeFilter, None]:
    """Convert from standard dataclass to filter dict."""
    firestore_filters = []

    # Convert standard filters to Firestore filters
    # Firestore filters are FieldFilter or And/Or filters
    for f in standard_filters.filters:
        if isinstance(f, MetadataFilter):
            firestore_filters.append(
                FieldFilter(f.key, _to_firestore_operator(f.operator), f.value)
            )
        elif isinstance(f, ExactMatchFilter):
            firestore_filters.append(FieldFilter(f.key, "==", f.value))

    if len(firestore_filters) == 1:
        return firestore_filters[0]

    condition = standard_filters.condition or FilterCondition.AND

    if condition == FilterCondition.AND:
        return And(filters=firestore_filters)
    if condition == FilterCondition.OR:
        return Or(filters=firestore_filters)

    return None
Convert from standard dataclass to filter dict.
llama-index-integrations/vector_stores/llama-index-vector-stores-firestore/llama_index/vector_stores/firestore/base.py