How prudviraj007/sql-ai-samples works
project type and purpose
• This is a sample repository aimed at educating users through examples. It shows how to integrate an Azure SQL Database with various AI components.
• The samples cover several scenarios: using Azure Cognitive Services for vectorization and search, using T-SQL scripts for content moderation via Azure OpenAI, implementing a natural language to SQL agent via LangChain, and orchestrating an end-to-end workflow with Azure PromptFlow.
Main components
• Azure SQL Database – the central data repository where all sample data resides.
• AI/Machine Learning Services:
• Azure Cognitive Services (Cognitive Search for integrated vectorization and recommendation)
• Azure OpenAI (for vector embeddings, content moderation, and chatbot style interactions)
• LangChain (a Python-based NL2SQL agent layer)
• Azure PromptFlow (orchestrating the flow between data, OpenAI, and Azure ML endpoints)
• Sample-specific components:
• Jupyter Notebooks (e.g., the AzureSQL_CogSearch_IntegratedVectorization.ipynb and LangChain notebooks) illustrating prototype workflows.
• T-SQL Scripts (in the ContentModeration folder) that encapsulate the SQL logic to call AI services.
• Deployment and config files (YAML files, .env samples, and configuration JSON files in the PromptFlow section) showing how to deploy/operate these flows, and their integration points.
Establish the relationships and interactions
• Data Flow: Begin with the Azure SQL Database as the data center from which data is extracted.
• For the Azure Cognitive Services sample, illustrate how user reviews or text data are pulled from the database into Azure Cognitive Search. Show the flow of the data being automatically chunked and vectorized.
• For Content Moderation, show T-SQL scripts acting as a processing layer that calls out to Azure OpenAI Content Safety and Language AI. Indicate the round-trip where text is analyzed and prior results (e.g., safety scores, redacted content) are returned to the SQL side.
• For the PromptFlow sample, show a comprehensive orchestration layer that connects the SQL Database, Azure Cognitive Search, and Azure OpenAI services. Include additional integration with an Azure ML workspace if required.
Architectural patterns and design principles
• Service-oriented design: Emphasize that the microservices (cognitive search, content moderation, NL2SQL via LangChain, and PromptFlow orchestration) each are independent modules that interact with the central database.
• Configuration/Deployment: Indicate areas where environment variables (.env, config JSON files) manage the connectivity and security between services.