def select_context(*, collect_list: bool) -> Selector:
        """Returns a `Selector` that tries to retrieve contexts.

        Args:
            collect_list:
                Assuming the returned `Selector` describes a list of strings,
                whether to call the feedback function:
                1. [if collect_list is True]:
                        Once giving the entire list as input.
                2. [if collect_list is False]:
                        Separately for each entry in the list and aggregate the
                        results.

        Returns:
            `Selector` that tries to retrieve contexts.
        """

        def context_retrieval_processor(
            attributes: Dict[str, Any],
        ) -> List[str]:
            for curr in [
                SpanAttributes.RETRIEVAL.RETRIEVED_CONTEXTS,
                SpanAttributes.CALL.RETURN,
            ]:
                ret = attributes.get(curr)
                if (
                    ret is not None
                    and isinstance(ret, list)
                    and all(isinstance(item, str) for item in ret)
                ):
                    return ret
            raise ValueError(
                f"Could not find contexts in attributes: {attributes}"
            )

        return Selector(
            span_type=SpanAttributes.SpanType.RETRIEVAL,
            span_attributes_processor=context_retrieval_processor,
            collect_list=collect_list,
            match_only_if_no_ancestor_matched=True,
        )
Returns a `Selector` that tries to retrieve contexts.

        Args:
            collect_list:
                Assuming the returned `Selector` describes a list of strings,
                whether to call the feedback function:
                1. [if collect_list is True]:
                        Once giving the entire list as input.
                2. [if collect_list is False]:
                        Separately for each entry in the list and aggregate the
                        results.

        Returns:
            `Selector` that tries to retrieve contexts.
        
src/core/trulens/core/feedback/selector.py