DEVELOPERS

DEVELOPERS

user guides:

AIFAQ Installation & Integration Tutorial

Connecting Data, People, and Processesβ€”Securely


🌐 1. Overview

AIFAQ (AI-powered FAQ / ChatBridge) connects enterprise data stored in Snowflake and privately owned repositories into a Retrieval-Augmented Generation (RAG) knowledge assistant.
It’s designed to:

  • Respect data sovereignty (you keep your data).

  • Support public vs. private roles for content access.

  • Integrate easily within the LBGUPS business journey model (Learn β†’ Buy β†’ Get β†’ Use β†’ Pay β†’ Support).


βš™οΈ 2. Core Installation Principles

Principle

Description

Implementation Focus

Principle

Description

Implementation Focus

Snowflake Data

AIFAQ connects to Snowflake via a secure read-only service account.

Use Snowflake OAuth or key-pair authentication, and configure Network Policies.

Privately Owned Data

All files, FAQs, and documents remain in your controlled storage (S3, Azure Blob, or local disk).

AIFAQ indexes content locally or through a VPC-hosted vector databaseβ€”never sends data off-prem.

Roles & Permissions

Defines who sees what. Public users get anonymized FAQs; private users get contextual data.

Managed via Snowflake roles + AIFAQ Access Tokens.


🧩 3. Installation Steps

Step 1: Prepare Your Environment

  1. Set up Snowflake with a dedicated Warehouse and Database for AIFAQ.

  2. Create a service role (e.g., AIFAQ_READER_ROLE).

  3. Grant SELECT permissions on specific tables/views you want AIFAQ to access.

  4. If using private files: create a secure folder (e.g., data/private_docs/) and define read-only access policies.

CREATE ROLE AIFAQ_READER_ROLE; GRANT USAGE ON DATABASE MYDATA TO ROLE AIFAQ_READER_ROLE; GRANT SELECT ON ALL TABLES IN SCHEMA MYDATA.PUBLIC TO ROLE AIFAQ_READER_ROLE;

Step 2: Install AIFAQ

  1. Clone the AIFAQ repository (GitHub or local package):

    git clone https://github.com/ledgeracademy/aifaq.git cd aifaq
  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure your .env file:

    SNOWFLAKE_ACCOUNT=your_account SNOWFLAKE_USER=aifaq_reader SNOWFLAKE_PRIVATE_KEY_PATH=~/.ssh/aifaq_key.p8 VECTOR_DB_URL=postgresql://localhost:5432/aifaqdb DATA_SOURCE_PATH=./data/private_docs

Step 3: Connect to Snowflake

Use the AIFAQ setup CLI to verify Snowflake access:

python setup.py connect-snowflake

If successful, AIFAQ will automatically create metadata tables for:

  • Documents

  • Embeddings

  • Access control lists (ACLs)


Step 4: Index Private Data

Upload and embed your files locally:

python scripts/embed_docs.py --path ./data/private_docs

This will generate embeddings and store them in your private vector DB, keeping sensitive content off the public internet.


Step 5: Define Access Roles

In your AIFAQ Admin Console (localhost:8000/admin):

  • Create Public, Private, and Admin roles.

  • Assign permissions to datasets (e.g., public FAQ vs internal support playbook).

Role

Data Access

Example Use Case

Role

Data Access

Example Use Case

Public

Only published FAQs

Website chatbot

Private

Snowflake + internal docs

Employee knowledge portal

Admin

All data + logs

Compliance and monitoring


🧠 4. Integrating with LBGUPS

LBGUPS Stage

How AIFAQ Supports It

LBGUPS Stage

How AIFAQ Supports It

Learn

Create AI-driven FAQ widgets on your website to attract new users.

Buy

Use contextual chat to simplify the checkout or onboarding journey.

Get

Auto-generate personalized installation or delivery guides.

Use

Provide product tutorials (like this one!) directly from your knowledge base.

Pay

Connect billing/contract FAQs from Snowflake tables securely.

Support

Enable private, role-based AI assistants for customers and staff.


πŸ”’ 5. Data Security & Control

  • Data Never Leaves Your Environment – AIFAQ runs inside your VPC or Snowflake-native app.

  • Granular Access Controls – Snowflake RBAC + AIFAQ roles ensure data segmentation.

  • End-to-End Encryption – TLS in transit, AES-256 at rest.

  • Audit Logging – Every query and data access event is logged for compliance.


πŸš€ 6. Verification & Testing

After deployment, run:

pytest tests/

Confirm:

  • Snowflake connection succeeds

  • Local embeddings are indexed

  • Public chatbots only show authorized data


βœ… 7. Maintenance & Scaling

  • Schedule periodic re-embedding for updated datasets.

  • Use Snowflake’s Task Scheduler to trigger nightly syncs.

  • Integrate with Snowflake Cortex AI functions for native enterprise deployment.


πŸ’‘ Summary

AIFAQ bridges the gap between fragmented business data and intelligent customer experiencesβ€”all while respecting privacy, ownership, and access control.
By combining Snowflake governance, private data protection, and LBGUPS journey design, you can deliver secure, context-aware AI that works across your organization.

Project Plan: AIFAQ Snowflake Marketplace Launch

πŸ“Œ App Name:

AIFAQ ChatBridge

πŸ’¬ Tagline:

"Smarter Answers. Seamless Integration. AI Agents for Your Enterprise Data."


πŸ—“οΈ Soft Launch Timeline (January 2026)

Goal: App listed on Snowflake Marketplace with working demo and documentation by the end


βœ… Key Soft Launch Deliverables

  • Snowflake Native App: AIFAQ ChatBridge

  • Functioning RAG-based assistant (with prompt tuning)

  • App listed on Snowflake Marketplace

  • GitHub repo with documentation

  • Internal demo recording & soft launch social post


Β 

🧠 Application Schema: AIFAQ ChatBridge

πŸ“¦ App Purpose:

Enable enterprise users to query structured/unstructured data via a Retrieval-Augmented Generation (RAG) pipeline using Snowflake Cortex and multi-agent orchestration.


πŸ“˜ Core Components

Component

Description

Component

Description

users

Table of registered organization users and roles

documents

Metadata for ingested documents (PDF, HTML, TXT, etc.)

document_chunks

Pre-processed text chunks with embeddings

embedding_index

Vector index of chunks used for semantic search

chat_sessions

Log of user prompts and AI responses

prompt_templates

System prompts for agents

agent_logs

Multi-agent interaction metadata

configs

Environment-specific configurations (dev/test/prod)


🧩 Suggested Snowflake Tables & Columns

users

sql

CopyEdit

user_id STRING PRIMARY KEY, email STRING, role STRING, created_at TIMESTAMP

documents

sql

CopyEdit

doc_id STRING PRIMARY KEY, source_url STRING, type STRING, uploaded_by STRING, created_at TIMESTAMP

document_chunks

sql

CopyEdit

chunk_id STRING PRIMARY KEY, doc_id STRING, text STRING, embedding VECTOR(FLOAT), token_count INT, created_at TIMESTAMP

embedding_index

This may be an external vector database or Cortex-compatible Snowflake feature (e.g., VECTOR_SEARCH).

chat_sessions

sql

CopyEdit

session_id STRING, user_id STRING, question TEXT, answer TEXT, sources ARRAY, timestamp TIMESTAMP


πŸ“š Application Dependencies

🧰 Tooling & Frameworks

  • snowcli: Snowflake CLI for deploying native apps

  • Snowflake Native App Framework: Required for packaging the app

  • Cortex: Snowflake's LLM interface

  • LangChain or LlamaIndex: For building the multi-agent RAG layer

  • Python: Backend logic (via UDFs or app layer)

  • Streamlit (optional): Local UI prototype


πŸ› οΈ Developer Setup Guide: Step-by-Step

βœ… Step 1: Environment Setup

  1. Install Snowflake CLI:

    bash

    CopyEdit

    pip install snowflake-cli-labs

  2. Authenticate with your Snowflake environment:

    bash

    CopyEdit

    snow auth login

  3. Clone the AIFAQ ChatBridge repo:

    bash

    CopyEdit

    git clone https://github.com/aifaq/chatbridge-snowflake.git


βœ… Step 2: Schema & Data Prep

  1. Run schema creation scripts:

    bash

    CopyEdit

    snow sql -f schema/schema.sql

  2. Upload documents:

    • Use PUT and COPY INTO commands to load sample PDFs or HTML data.

    • Scripts should split text and embed each chunk using Cortex.


βœ… Step 3: Implement Embedding & Vector Search

  1. Use Cortex or integrated Python UDFs for embedding:

    sql

    CopyEdit

    SELECT SNOWFLAKE.CORTEX.EMBED_TEXT('Your text here');

  2. Store vector output in document_chunks.embedding.

  3. Configure semantic search:

    • Use LangChain FAISS or similar with a fallback to keyword search.


βœ… Step 4: Chat Interface Logic

  1. Create a chat UDF to:

    • Accept user query

    • Retrieve top k relevant chunks using vector search

    • Format prompt with template

    • Call Cortex for LLM completion

  2. Log all inputs/outputs in chat_sessions.


βœ… Step 5: Prompt Management

  • Define prompt_templates table to hold:

    • Role-based system prompts

    • Meta-instructions for specific agents


βœ… Step 6: Testing & Role Security

  1. Test all flows in DEV environment.

  2. Validate masking and permission rules using RBAC:

    sql

    CopyEdit

    CREATE MASKING POLICY ...


βœ… Step 7: Packaging & Deployment

  1. Use snowcli to package app:

    bash

    CopyEdit

    snow app package

  2. Publish to private listing for test group.

  3. Submit to Snowflake Marketplace for review.


βœ… Optional: UI

Use Streamlit or another frontend to demo:

  • Chat interface

  • Query history

  • Source traceability


πŸ“€ Final Deliverables

  • Snowflake Native App (chatbridge.snowflakeapp)

  • GitHub repo with deployment scripts and docs

  • Demo video or live walkthrough

  • Snowflake Marketplace submission (logo, tagline, README)