::: container

RAG System Architecture for TSQL.APP

::: diagram-container :::

::: section

System Components

  1. Document Processing Pipeline
    • Document ingestion
    • Text extraction and chunking
    • Embedding generation
    • Vector database storage
  2. Query Processing Pipeline
    • Query embedding generation
    • Vector similarity search
    • Document retrieval
    • Context assembly
  3. Generation with Claude 3.7
    • Prompt construction with retrieved context
    • API call to Claude 3.7
    • Response processing and formatting
  4. Integration Layer
    • TSQL.APP stored procedures and functions
    • User interface components
    • Authentication and request handling :::

::: section

Data Flow

1. Document Ingestion

Raw Documents → Text Extraction → Chunking → Embedding → Vector DB

2. Query Processing

User Query → Query Embedding → Similarity Search → Retrieve Top K Chunks

3. Response Generation

Retrieved Chunks + Query → Prompt Construction → Claude 3.7 API → Response

4. User Interface

TSQL.APP Card → RAG Endpoint SP → Response Display

:::

::: implementation

Implementation Notes

  • The system will use a table-based vector store for simplicity
  • The OpenAI API will be used for generating embeddings (ada-002)
  • Claude 3.7 will be accessed via Anthropic API for generation
  • All components will be implemented as TSQL.APP stored procedures ::: :::