def select_context(cls, app: Optional[Chain] = None) -> serial_utils.Lens:
        """Get the path to the context in the query output."""

        if app is None:
            raise ValueError(
                "langchain app/chain is required to determine context for langchain apps. "
                "Pass it in as the `app` argument"
            )

        retrievers = []

        app_json = json_utils.jsonify(app)
        for lens in serial_utils.all_queries(app_json):
            try:
                comp = lens.get_sole_item(app)
                if isinstance(comp, BaseRetriever):
                    retrievers.append((lens, comp))

            except Exception:
                pass

        if len(retrievers) == 0:
            raise ValueError("Cannot find any `BaseRetriever` in app.")

        if len(retrievers) > 1:
            if isinstance(retrievers[0][1], MultiQueryRetriever):
                pass
            else:
                raise ValueError(
                    "Found more than one `BaseRetriever` in app:\n\t"
                    + (
                        "\n\t".join(
                            map(
                                lambda lr: f"{type(lr[1])} at {lr[0]}",
                                retrievers,
                            )
                        )
                    )
                )

        retriever = select_schema.Select.RecordCalls + retrievers[0][0]
        if hasattr(retriever, "invoke"):
            return retriever.invoke.rets[:].page_content

        if hasattr(retriever, "_get_relevant_documents"):
            return retriever._get_relevant_documents.rets[:].page_content

        raise RuntimeError("Could not find a retriever component in app.")
Get the path to the context in the query output.
src/apps/langchain/trulens/apps/langchain/tru_chain.py