def test_prefix_text_chunks_e5(self):
        """Ensures that the default prefix and the request level prefix are applied correctly.
        for the e5-small model."""

        for index in [self.unstructured_index_e5]:
            with self.subTest(index=index.type):
                # A) prefix should default to "passage: " with the e5-small model
                self.add_documents(config=self.config, add_docs_params=AddDocsParams(
                    index_name=index.name, docs=[{"_id": "doc_a", "text": "hello"}], auto_refresh=True,
                    tensor_fields=["text"] if isinstance(index, UnstructuredMarqoIndex) else None
                ))

                # B) manually set prefix at the request level
                self.add_documents(config=self.config, add_docs_params=AddDocsParams(
                    index_name=index.name, docs=[{"_id": "doc_b", "text": "hello"}], auto_refresh=True,
                    text_chunk_prefix="passage: ",
                    tensor_fields=["text"] if isinstance(index, UnstructuredMarqoIndex) else None
                ))

                # C) Set no prefix 
                self.add_documents(config=self.config, add_docs_params=AddDocsParams(
                    index_name=index.name, docs=[{"_id": "doc_c", "text": "hello"}], auto_refresh=True,
                    text_chunk_prefix="custom_prefix: ",
                    tensor_fields=["text"] if isinstance(index, UnstructuredMarqoIndex) else None
                ))

                # Get all documents (with vectors)
                res = tensor_search.get_documents_by_ids(
                    config=self.config, index_name=index.name, document_ids=["doc_a", "doc_b", "doc_c"],
                    show_vectors=True
                ).dict(exclude_none=True, by_alias=True)["results"]
                retrieved_doc_a = res[0]
                retrieved_doc_b = res[1]
                retrieved_doc_c = res[2]

                embed_res_document_prefix = embed(
                    marqo_config=self.config, index_name=index.name,
                    embedding_request_dict={"content": ["hello"], "content_type": "document"},
                    device="cpu"
                )

                embed_res_no_prefix = embed(
                    marqo_config=self.config, index_name=index.name,
                    embedding_request_dict={"content": ["custom_prefix: hello"], "content_type": None},
                    device="cpu"
                )

                # Assert that the embedding in document_a is the same as embed_res_document_prefix with the prefix
                self.assertTrue(np.allclose(embed_res_document_prefix["embeddings"][0], retrieved_doc_a["_tensor_facets"][0]["_embedding"]))
                
                # Assert that the embedding in document_b is the same as the embedding in document_a
                self.assertTrue(np.allclose(retrieved_doc_a["_tensor_facets"][0]["_embedding"], retrieved_doc_b["_tensor_facets"][0]["_embedding"]))
                
                # Assert that the embedding in document_c is the same as the embedding with no prefix
                self.assertTrue(np.allclose(embed_res_no_prefix["embeddings"][0], retrieved_doc_c["_tensor_facets"][0]["_embedding"]))
Ensures that the default prefix and the request level prefix are applied correctly.
        for the e5-small model.
tests/integ_tests/tensor_search/test_prefix.py