def create_sample_datasource()

in demo-python/code/community-integration/ragas/lib/utils.py [0:0]


def create_sample_datasource(
        indexer_client: SearchIndexerClient,
        blob_container_name: str,
        index_name: str,
        search_blob_connection_string: str):
    # Create a data source 
    container = SearchIndexerDataContainer(name=blob_container_name)
    data_source_connection = SearchIndexerDataSourceConnection(
        name=f"{index_name}-blob",
        type="azureblob",
        connection_string=search_blob_connection_string,
        container=container,
        data_deletion_detection_policy=NativeBlobSoftDeleteDeletionDetectionPolicy()
    )
    return indexer_client.create_or_update_data_source_connection(data_source_connection)