def client_with_user_agent(
    client: Optional[firestore.Client] = None,
) -> firestore.Client:
    """Create a Firestore client with a user agent."""
    client_info = DEFAULT_CLIENT_INFO
    user_agent = USER_AGENT
    client_info.user_agent = user_agent

    if not client:
        client = firestore.Client(client_info=client_info)
    client_agent = client._client_info.user_agent

    if not client_agent:
        client._client_info.user_agent = user_agent
    elif user_agent not in client_agent:
        client._client_info.user_agent = f"{client_agent} {user_agent}"
    return client
Create a Firestore client with a user agent.
llama-index-integrations/vector_stores/llama-index-vector-stores-firestore/llama_index/vector_stores/firestore/utils.py