def _convert_structured_datastore_response(
        self, results: Sequence[SearchResult]
    ) -> List[NodeWithScore]:
        """Converts a sequence of search results to a list of Llamaindex note_with_score."""
        note_with_score: List[NodeWithScore] = []

        for i, result in enumerate(results):
            # Structured datastore does not have relevance score. The results are ranked
            # in order. score is calculated by below. Index 0 has the highest score
            score = (len(results) - i) / len(results)

            document_dict = MessageToDict(
                result.document._pb, preserving_proto_field_name=True
            )
            note_with_score.append(
                NodeWithScore(
                    node=TextNode(
                        text=json.dumps(document_dict.get("struct_data", {}))
                    ),
                    score=score,
                )
            )

        return note_with_score
Converts a sequence of search results to a list of Llamaindex note_with_score.
llama-index-integrations/retrievers/llama-index-retrievers-vertexai-search/llama_index/retrievers/vertexai_search/base.py