default="content_vector",
)
FIELDS_METADATA = get_from_env(
    key="AZURESEARCH_FIELDS_TAG", env_key="AZURESEARCH_FIELDS_TAG", default="metadata"
)
MAX_UPLOAD_BATCH_SIZE = 1000
def _get_search_client(
    endpoint: str,
    key: str,
    index_name: str,
    semantic_configuration_name: Optional[str] = None,
    fields: Optional[List[SearchField]] = None,
    vector_search: Optional[VectorSearch] = None,
    semantic_settings: Optional[Union[SemanticSearch, SemanticSettings]] = None,
    scoring_profiles: Optional[List[ScoringProfile]] = None,
    default_scoring_profile: Optional[str] = None,
    default_fields: Optional[List[SearchField]] = None,
    user_agent: Optional[str] = "langchain",
    cors_options: Optional[CorsOptions] = None,
) -> SearchClient:
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import ResourceNotFoundError
    from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential
    from azure.search.documents import SearchClient
    from azure.search.documents.indexes import SearchIndexClient
    from azure.search.documents.indexes.models import (
        SearchIndex,
        SemanticConfiguration,
        SemanticField,
        VectorSearch,
    )
    # class names changed for versions >= 11.4.0
    try:
        from azure.search.documents.indexes.models import (
            HnswAlgorithmConfiguration,  # HnswVectorSearchAlgorithmConfiguration is old
            SemanticPrioritizedFields,  # PrioritizedFields outdated
            SemanticSearch,  # SemanticSettings outdated
        )
        NEW_VERSION = True
    except ImportError:
        from azure.search.documents.indexes.models import (