def test_user_agent_default(
        self, sync_client_request_saving: Elasticsearch, index: str
    ) -> None:
        """Test to make sure the user-agent is set correctly."""
        store = VectorStore(
            index=index,
            retrieval_strategy=BM25Strategy(),
            client=sync_client_request_saving,
        )
        expected_pattern = r"^elasticsearch-py-vs/\d+\.\d+\.\d+$"

        got_agent = store.client._headers["User-Agent"]
        assert (
            re.match(expected_pattern, got_agent) is not None
        ), f"The user agent '{got_agent}' does not match the expected pattern."

        texts = ["foo", "bob", "baz"]
        store.add_texts(texts)

        for request in store.client.transport.requests:  # type: ignore
            agent = request["headers"]["User-Agent"]
            assert (
                re.match(expected_pattern, agent) is not None
            ), f"The user agent '{agent}' does not match the expected pattern."
Test to make sure the user-agent is set correctly.
test_elasticsearch/test_server/test_vectorstore/test_vectorstore.py