Skip to content

Commit

Permalink
Add support for AzureSQLDatabase in ContentSourceServiceFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
alistar-andrei committed Jan 29, 2024
1 parent d1db600 commit b7504e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public class AzureSQLDatabaseContentSourceServiceSettings
/// <summary>
/// The connection string used for authentication.
/// </summary>
public required string ConnectionString { get; set; }
public string? ConnectionString { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public enum ContentSourceType
/// <summary>
/// SharePoint Online document library.
/// </summary>
SharePointOnline
SharePointOnline,

/// <summary>
/// Azure SQL Database.
/// </summary>
AzureSQLDatabase
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public IContentSourceService GetService(string serviceName)
{
ContentSourceType.AzureDataLake => CreateAzureDataLakeContentSourceService(serviceName),
ContentSourceType.SharePointOnline => CreateSharePointOnlineContentSourceService(serviceName),
ContentSourceType.AzureSQLDatabase => CreateAzureSQLDatabaseContentSourceService(serviceName),
_ => throw new VectorizationException($"The content source type {contentSourceProfile.Type} is not supported."),
};
}
Expand All @@ -55,6 +56,7 @@ public IContentSourceService GetService(string serviceName)
{
ContentSourceType.AzureDataLake => (CreateAzureDataLakeContentSourceService(serviceName), contentSourceProfile),
ContentSourceType.SharePointOnline => (CreateSharePointOnlineContentSourceService(serviceName), contentSourceProfile),
ContentSourceType.AzureSQLDatabase => (CreateAzureSQLDatabaseContentSourceService(serviceName), contentSourceProfile),
_ => throw new VectorizationException($"The content source type {contentSourceProfile.Type} is not supported."),
};
}
Expand Down Expand Up @@ -83,5 +85,17 @@ private SharePointOnlineContentSourceService CreateSharePointOnlineContentSource
sharePointOnlineContentSourceServiceSettings,
_loggerFactory);
}

private AzureSQLDatabaseContentSourceService CreateAzureSQLDatabaseContentSourceService(string serviceName)
{
var azureSQLDatabaseContentSourceServiceSettings = new AzureSQLDatabaseContentSourceServiceSettings();
_configuration.Bind(
$"{AppConfigurationKeySections.FoundationaLLM_Vectorization_ContentSources}:{serviceName}",
azureSQLDatabaseContentSourceServiceSettings);

return new AzureSQLDatabaseContentSourceService(
azureSQLDatabaseContentSourceServiceSettings,
_loggerFactory);
}
}
}

0 comments on commit b7504e8

Please sign in to comment.