All Modules

SQL Converse

AI Conversation Bridge

Bidirectional AI conversation platform for SQL Server and PostgreSQL. Database procedures and Python agents communicate seamlessly while Presidio-style filtering prevents data leaks.

How It Works

┌─────────────────────────────────────────────────────────────────┐
│                    DATABASE LAYER                                │
│  ┌────────────────────────────────────────────────────────────┐ │
│  │  Stored Procedure / Application                            │ │
│  │         │                                                  │ │
│  │         ▼                                                  │ │
│  │  EXEC sql2ai.AskAI @prompt, @format, @max_tokens...       │ │
│  │         │                                                  │ │
│  │         ▼                                                  │ │
│  │  ┌─────────────────────────────────────────┐               │ │
│  │  │     sql2ai.ConversationQueue            │               │ │
│  │  │  (Request Table - the middleware)       │               │ │
│  │  └─────────────────────────────────────────┘               │ │
│  └────────────────────────────────────────────────────────────┘ │
└───────────────────────────┬─────────────────────────────────────┘
                            │ Poll / Subscribe
                            ▼
┌─────────────────────────────────────────────────────────────────┐
│                    SQL CONVERSE AGENT (Python)                   │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │   PII Filter  │   Purview Classify  │   Custom Filters     ││
│  ├─────────────────────────────────────────────────────────────┤│
│  │   LangChain   │     LangGraph       │      LiteLLM         ││
│  └─────────────────────────────────────────────────────────────┘│
└───────────────────────────┬─────────────────────────────────────┘
                            │
          ┌─────────────────┼─────────────────┐
          ▼                 ▼                 ▼
   ┌─────────────┐   ┌─────────────┐   ┌─────────────┐
   │   OpenAI    │   │  Anthropic  │   │   Local     │
   │   GPT-4     │   │   Claude    │   │   Ollama    │
   └─────────────┘   └─────────────┘   └─────────────┘

Database Interface

-- Simple AI query from SQL Server
DECLARE @Response NVARCHAR(MAX);

EXEC sql2ai.AskAI
    @Prompt = 'Summarize the sales trend for Q4',
    @Response = @Response OUTPUT;

SELECT @Response;

-- Structured JSON response
DECLARE @Analysis NVARCHAR(MAX);

EXEC sql2ai.AskAI
    @Prompt = 'Analyze this customer feedback and extract sentiment',
    @Context = @CustomerFeedback,
    @ResponseFormat = 'json',
    @JsonSchema = '{
        "sentiment": "positive|negative|neutral",
        "confidence": "number",
        "key_themes": ["string"],
        "recommended_action": "string"
    }',
    @Response = @Analysis OUTPUT;

-- Parse JSON response
SELECT
    JSON_VALUE(@Analysis, '$.sentiment') AS Sentiment,
    JSON_VALUE(@Analysis, '$.confidence') AS Confidence,
    JSON_VALUE(@Analysis, '$.recommended_action') AS Action;

-- Multi-turn conversation
DECLARE @ConversationId UNIQUEIDENTIFIER = NEWID();

EXEC sql2ai.AskAI @ConversationId = @ConversationId,
    @Prompt = 'What are the top 3 selling products?',
    @Response = @Response1 OUTPUT;

EXEC sql2ai.AskAI @ConversationId = @ConversationId,
    @Prompt = 'Why do you think they sell well?',  -- Context preserved!
    @Response = @Response2 OUTPUT;

Security & Privacy

PII Detection

Presidio-powered scanning for:

  • • Names & Addresses
  • • Email & Phone
  • • SSN & Credit Cards
  • • Medical Licenses

Secret Detection

Block prompts containing:

  • • API keys & passwords
  • • Internal-only data
  • • Confidential markers
  • • Custom patterns

Model Routing

Route queries intelligently:

  • • Sensitive → Local LLM
  • • Code → CodeLlama
  • • General → GPT-4
  • • Cost optimization

Model Flexibility with LiteLLM

One interface for all AI providers - switch models without code changes

OpenAI
Anthropic
Azure OpenAI
AWS Bedrock
Ollama
Mistral
Cohere
Google AI

Guaranteed Response Formats

-- Ensure JSON response matches schema
EXEC sql2ai.AskAI
    @Prompt = 'Extract product information from this description',
    @Context = @ProductDescription,
    @ResponseFormat = 'json',
    @JsonSchema = '{
        "type": "object",
        "properties": {
            "name": {"type": "string"},
            "price": {"type": "number"},
            "category": {"type": "string", "enum": ["Electronics", "Clothing", "Food"]},
            "features": {"type": "array", "items": {"type": "string"}}
        },
        "required": ["name", "price", "category"]
    }',
    @MaxRetries = 3,  -- Retry if format invalid
    @Response = @Response OUTPUT;

-- Response is guaranteed to match schema or returns error

Bridge Your Database to AI

Seamless, secure AI integration for SQL Server and PostgreSQL with full privacy protection.

No credit card required • Free for individual developers